mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-25 08:15:27 +00:00
There's no need to have the tab size settable per window, and the
functions to do it have been missing since version 2.2. I'm tempted to just hardwire it at 8... However, ncurses and Solaris curses define a global for it, "TABSIZE". So, let's do that.
This commit is contained in:
7
curses.h
7
curses.h
@@ -15,7 +15,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: curses.h,v 1.204 2006/07/30 03:55:46 wmcbrine Exp $ */
|
||||
/* $Id: curses.h,v 1.205 2006/07/30 19:18:00 wmcbrine Exp $ */
|
||||
|
||||
/*----------------------------------------------------------------------*
|
||||
* PDCurses *
|
||||
@@ -536,7 +536,6 @@ typedef struct _win /* definition of a window */
|
||||
int _flags; /* window properties */
|
||||
chtype _attrs; /* standard attributes and colors */
|
||||
chtype _bkgd; /* background, normally blank */
|
||||
int _tabsize; /* tab character size */
|
||||
bool _clear; /* causes clear at next refresh */
|
||||
bool _leaveit; /* leaves cursor where it is */
|
||||
bool _scroll; /* allows window scrolling */
|
||||
@@ -660,6 +659,7 @@ __declspec(dllimport) SCREEN *SP;
|
||||
__declspec(dllimport) MOUSE_STATUS Mouse_status;
|
||||
__declspec(dllimport) int COLORS;
|
||||
__declspec(dllimport) int COLOR_PAIRS;
|
||||
__declspec(dllimport) int TABSIZE;
|
||||
# else
|
||||
__declspec(dllexport) extern int LINES;
|
||||
__declspec(dllexport) extern int COLS;
|
||||
@@ -669,6 +669,7 @@ __declspec(dllexport) extern SCREEN *SP;
|
||||
__declspec(dllexport) extern MOUSE_STATUS Mouse_status;
|
||||
__declspec(dllexport) extern int COLORS;
|
||||
__declspec(dllexport) extern int COLOR_PAIRS;
|
||||
__declspec(dllexport) extern int TABSIZE;
|
||||
# endif
|
||||
#else
|
||||
extern int LINES; /* terminal height */
|
||||
@@ -677,7 +678,7 @@ extern WINDOW *stdscr; /* the default screen window */
|
||||
extern WINDOW *curscr; /* the current screen image */
|
||||
extern SCREEN *SP; /* curses variables */
|
||||
extern MOUSE_STATUS Mouse_status;
|
||||
extern int COLORS, COLOR_PAIRS;
|
||||
extern int COLORS, COLOR_PAIRS, TABSIZE;
|
||||
#endif
|
||||
|
||||
#ifdef CURSES_LIBRARY
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
# undef wmove
|
||||
#endif
|
||||
|
||||
RCSID("$Id: getstr.c,v 1.26 2006/07/15 15:38:24 wmcbrine Exp $");
|
||||
RCSID("$Id: getstr.c,v 1.27 2006/07/30 19:18:00 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -149,7 +149,6 @@ int wgetnstr(WINDOW *win, char *str, int n)
|
||||
p = str;
|
||||
stop = FALSE;
|
||||
|
||||
t = win->_tabsize;
|
||||
x = win->_curx;
|
||||
|
||||
oldcbreak = SP->cbreak; /* remember states */
|
||||
@@ -181,7 +180,7 @@ int wgetnstr(WINDOW *win, char *str, int n)
|
||||
|
||||
case '\t':
|
||||
ch = ' ';
|
||||
num = t - (win->_curx - x) % t;
|
||||
num = TABSIZE - (win->_curx - x) % TABSIZE;
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (chars < n)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
# undef wnoutrefresh
|
||||
#endif
|
||||
|
||||
RCSID("$Id: initscr.c,v 1.63 2006/07/29 22:01:20 wmcbrine Exp $");
|
||||
RCSID("$Id: initscr.c,v 1.64 2006/07/30 19:18:00 wmcbrine Exp $");
|
||||
|
||||
const char *_curses_notice = "PDCurses 3.0 - Public Domain 2006";
|
||||
|
||||
@@ -49,6 +49,7 @@ WINDOW *stdscr = (WINDOW *)NULL; /* the default screen window */
|
||||
int _default_lines = 25; /* default terminal height */
|
||||
int LINES = 0; /* current terminal height */
|
||||
int COLS = 0; /* current terminal width */
|
||||
int TABSIZE = 8;
|
||||
|
||||
MOUSE_STATUS Mouse_status;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
RCSID("$Id: pdcwin.c,v 1.48 2006/07/29 06:18:24 wmcbrine Exp $");
|
||||
RCSID("$Id: pdcwin.c,v 1.49 2006/07/30 19:18:00 wmcbrine Exp $");
|
||||
|
||||
static int PDC_newline(WINDOW *, int);
|
||||
|
||||
@@ -190,7 +190,6 @@ WINDOW *PDC_makenew(int num_lines, int num_columns, int begy, int begx)
|
||||
win->_lastsy2 = LINES - 1;
|
||||
win->_lastsx2 = COLS - 1;
|
||||
win->_bkgd = ' '; /* wrs 4/10/93 -- initialize background to blank */
|
||||
win->_tabsize = 8;
|
||||
win->_clear = (bool) ((num_lines == LINES) && (num_columns == COLS));
|
||||
win->_bmarg = num_lines - 1;
|
||||
win->_parx = win->_pary = -1;
|
||||
@@ -276,7 +275,7 @@ void PDC_sync(WINDOW *win)
|
||||
|
||||
int PDC_chadd(WINDOW *win, chtype ch, bool xlat, bool advance)
|
||||
{
|
||||
int x, y, newx, ts, retval;
|
||||
int x, y, x2, retval;
|
||||
chtype attr, bktmp;
|
||||
|
||||
PDC_LOG(("PDC_chadd() - called: win=%x ch=%x "
|
||||
@@ -288,7 +287,6 @@ int PDC_chadd(WINDOW *win, chtype ch, bool xlat, bool advance)
|
||||
|
||||
x = win->_curx;
|
||||
y = win->_cury;
|
||||
ts = win->_tabsize;
|
||||
|
||||
if ((y > win->_maxy) || (x > win->_maxx) || (y < 0) || (x < 0))
|
||||
return ERR;
|
||||
@@ -341,7 +339,7 @@ int PDC_chadd(WINDOW *win, chtype ch, bool xlat, bool advance)
|
||||
switch (ch)
|
||||
{
|
||||
case '\t':
|
||||
for (newx = ((x / ts) + 1) * ts; x < newx; x++)
|
||||
for (x2 = ((x / TABSIZE) + 1) * TABSIZE; x < x2; x++)
|
||||
{
|
||||
if (waddch(win, ' ') == ERR)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
# undef wclrtobot
|
||||
#endif
|
||||
|
||||
RCSID("$Id: window.c,v 1.34 2006/07/30 18:57:23 wmcbrine Exp $");
|
||||
RCSID("$Id: window.c,v 1.35 2006/07/30 19:18:00 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -374,7 +374,6 @@ WINDOW *dupwin(WINDOW *win)
|
||||
new->_lastsx2 = win->_lastsx2;
|
||||
new->_flags = win->_flags;
|
||||
new->_attrs = win->_attrs;
|
||||
new->_tabsize = win->_tabsize;
|
||||
new->_clear = win->_clear;
|
||||
new->_leaveit = win->_leaveit;
|
||||
new->_scroll = win->_scroll;
|
||||
@@ -429,7 +428,6 @@ WINDOW *resize_window(WINDOW *win, int lins, int cols)
|
||||
new->_cury = min(win->_cury, new->_maxy);
|
||||
new->_flags = win->_flags;
|
||||
new->_attrs = win->_attrs;
|
||||
new->_tabsize = win->_tabsize;
|
||||
new->_clear = win->_clear;
|
||||
new->_leaveit = win->_leaveit;
|
||||
new->_scroll = win->_scroll;
|
||||
|
||||
Reference in New Issue
Block a user