More fixes to undo and errorneous termination, formatting.
This commit is contained in:
parent
8a3bb64045
commit
2e97e897a3
@ -12,6 +12,9 @@ ______________________________________________________________________
|
|||||||
Notes for GoldED+ 1.1.4.7, November xx 2000
|
Notes for GoldED+ 1.1.4.7, November xx 2000
|
||||||
______________________________________________________________________
|
______________________________________________________________________
|
||||||
|
|
||||||
|
+ Logged version name now combined with release date (for easy sorting
|
||||||
|
out the logs received).
|
||||||
|
|
||||||
- It was impossible to change To: field when replying to the Internet
|
- It was impossible to change To: field when replying to the Internet
|
||||||
gated message when lookup turned off. Fixed.
|
gated message when lookup turned off. Fixed.
|
||||||
|
|
||||||
|
@ -2369,6 +2369,8 @@ bool UndoStack::FixPushLine(Line* __line) {
|
|||||||
|
|
||||||
void UndoStack::PushItem(uint action, Line* __line, uint __col, uint __len) {
|
void UndoStack::PushItem(uint action, Line* __line, uint __col, uint __len) {
|
||||||
|
|
||||||
|
GFTRK("PushItem");
|
||||||
|
|
||||||
if(undo_enabled) {
|
if(undo_enabled) {
|
||||||
|
|
||||||
throw_new(last_item = new UndoItem);
|
throw_new(last_item = new UndoItem);
|
||||||
@ -2425,6 +2427,8 @@ void UndoStack::PushItem(uint action, Line* __line, uint __col, uint __len) {
|
|||||||
last_item->line = currline;
|
last_item->line = currline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GFTRK(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2432,6 +2436,8 @@ void UndoStack::PushItem(uint action, Line* __line, uint __col, uint __len) {
|
|||||||
|
|
||||||
void UndoStack::PlayItem() {
|
void UndoStack::PlayItem() {
|
||||||
|
|
||||||
|
GFTRK("PlayItem");
|
||||||
|
|
||||||
if(last_item) {
|
if(last_item) {
|
||||||
|
|
||||||
UndoItem* item;
|
UndoItem* item;
|
||||||
@ -2452,7 +2458,7 @@ void UndoStack::PlayItem() {
|
|||||||
|
|
||||||
// Let user to see the position before performing Undo, unless it's a
|
// Let user to see the position before performing Undo, unless it's a
|
||||||
// neighbour line and the same column.
|
// neighbour line and the same column.
|
||||||
undo_ready = (abs(int(curr_row_num - thisrow)) < 2 and (curr_col_num == col or col+1 > currline->txt.length()));
|
undo_ready = ((abs(int(curr_row_num - thisrow)) < 2) and ((curr_col_num == col) or (col+1 > currline->txt.length())));
|
||||||
|
|
||||||
// Move cursor up or down depending on where the undo line is,
|
// Move cursor up or down depending on where the undo line is,
|
||||||
// then refresh window if the line is invisible.
|
// then refresh window if the line is invisible.
|
||||||
@ -2478,7 +2484,7 @@ void UndoStack::PlayItem() {
|
|||||||
} while(curr_row_num != thisrow);
|
} while(curr_row_num != thisrow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
undo_ready = (abs(int(curr_col_num - col)) < 2 or col+1 > currline->txt.length());
|
undo_ready = ((abs(int(curr_col_num - col)) < 2) or (col+1 > currline->txt.length()));
|
||||||
|
|
||||||
uint _pcol = item->pcol;
|
uint _pcol = item->pcol;
|
||||||
uint _prow = item->prow;
|
uint _prow = item->prow;
|
||||||
@ -2509,7 +2515,7 @@ void UndoStack::PlayItem() {
|
|||||||
currline->txt.erase(last_item->col.num,1);
|
currline->txt.erase(last_item->col.num,1);
|
||||||
break;
|
break;
|
||||||
case EDIT_UNDO_DEL_CHAR:
|
case EDIT_UNDO_DEL_CHAR:
|
||||||
if(last_item->col.num == currline->txt.length() and last_item->data.char_int != ' ' and last_item->data.char_int != '\n')
|
if((last_item->col.num == currline->txt.length()) and (last_item->data.char_int != ' ') and (last_item->data.char_int != '\n'))
|
||||||
currline->txt += ' ';
|
currline->txt += ' ';
|
||||||
currline->txt.insert(last_item->col.num, 1, last_item->data.char_int);
|
currline->txt.insert(last_item->col.num, 1, last_item->data.char_int);
|
||||||
break;
|
break;
|
||||||
@ -2593,50 +2599,70 @@ void UndoStack::PlayItem() {
|
|||||||
|
|
||||||
} while(last_item and in_batch);
|
} while(last_item and in_batch);
|
||||||
|
|
||||||
editor->refresh(currline, row);
|
|
||||||
undo_enabled = YES;
|
undo_enabled = YES;
|
||||||
|
|
||||||
editor->getthisrow(currline);
|
editor->getthisrow(currline);
|
||||||
uint temprow = thisrow, posrow;
|
uint temprow = row;
|
||||||
|
Line *templine = currline;
|
||||||
|
Line *topline = editor->findfirstline();
|
||||||
|
|
||||||
Line *templine = editor->findfirstline();
|
int delta = _prow-thisrow;
|
||||||
if(templine) {
|
|
||||||
for(posrow=0; posrow < _prow; posrow++)
|
|
||||||
if(templine->next)
|
|
||||||
templine = templine->next;
|
|
||||||
thisrow = posrow; col = _pcol;
|
|
||||||
currline = templine;
|
|
||||||
|
|
||||||
if(not in_range(thisrow-temprow, minrow, maxrow)) {
|
if(not in_range(row+delta, minrow, maxrow)) {
|
||||||
do {
|
|
||||||
if(thisrow > temprow) {
|
// we need to fit thisrow into the screen boundaries
|
||||||
if(row > minrow)
|
if(delta > 0) {
|
||||||
temprow--, row--;
|
for (row -= delta; row < minrow; row++) {
|
||||||
else {
|
if (templine) // cause refresh() issue an error since templine should never be NULL
|
||||||
editor->refresh(templine, row);
|
templine = templine->next;
|
||||||
break;
|
}
|
||||||
}
|
temprow = maxrow;
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(row < maxrow)
|
|
||||||
temprow++, row++;
|
|
||||||
else {
|
|
||||||
editor->refresh(templine, row = minrow);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while(temprow != thisrow);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
row += thisrow-temprow;
|
for (row -= delta; row > maxrow; row--) {
|
||||||
editor->refresh(templine, row);
|
if (templine) // cause refresh() issue an error since templine should never be NULL
|
||||||
|
templine = templine->prev;
|
||||||
|
}
|
||||||
|
temprow = minrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
// move pointer to the top of screen so we refresh scrolled area
|
||||||
|
while (row != minrow) {
|
||||||
|
if (templine) // cause refresh() issue an error since templine should never be NULL
|
||||||
|
templine = templine->prev;
|
||||||
|
--row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (delta < 0) {
|
||||||
|
templine = topline;
|
||||||
|
for(thisrow=0; thisrow < _prow; thisrow++)
|
||||||
|
if(templine) // cause refresh() issue an error if thisrow != _prow
|
||||||
|
templine = templine->next;
|
||||||
|
}
|
||||||
|
temprow = row+delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
// refresh screen
|
||||||
|
editor->refresh(templine, row);
|
||||||
|
|
||||||
|
// set cursor position
|
||||||
|
thisrow = _prow;
|
||||||
|
col = _pcol;
|
||||||
|
row = temprow;
|
||||||
|
// set currline according to thisrow
|
||||||
|
currline = topline;
|
||||||
|
for(thisrow=0; thisrow < _prow; thisrow++)
|
||||||
|
if(currline)
|
||||||
|
currline = currline->next;
|
||||||
}
|
}
|
||||||
// Move the cursor to EOL if necessary
|
// Move the cursor to EOL if necessary
|
||||||
else if(col+1 > currline->txt.length())
|
else if(col+1 > currline->txt.length())
|
||||||
editor->GoEOL();
|
editor->GoEOL();
|
||||||
undo_ready = YES;
|
undo_ready = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GFTRK(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -697,7 +697,9 @@ void Initialize(int argc, char* argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Start the log
|
// Start the log
|
||||||
LOG.open(CFG->logfile, __gver_longpid__, __gver_shortlogname__, CFG->logformat);
|
char buf[200];
|
||||||
|
sprintf(buf, "%s (%s %s)", __gver_longpid__, __gver_date__, __gver_time__);
|
||||||
|
LOG.open(CFG->logfile, buf, __gver_shortlogname__, CFG->logformat);
|
||||||
|
|
||||||
// Read/compile various configs
|
// Read/compile various configs
|
||||||
compiled |= ReadLangCfg(cmdlineforce);
|
compiled |= ReadLangCfg(cmdlineforce);
|
||||||
@ -720,9 +722,8 @@ void Initialize(int argc, char* argv[]) {
|
|||||||
if(cfgerrors) {
|
if(cfgerrors) {
|
||||||
cout << "* Total CFG errors found: " << cfgerrors
|
cout << "* Total CFG errors found: " << cfgerrors
|
||||||
<< ". Press almost any key to continue." << endl;
|
<< ". Press almost any key to continue." << endl;
|
||||||
clearkeys();
|
|
||||||
kbclear();
|
kbclear();
|
||||||
kbxget();
|
waitkey();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CFG->switches.get(keybclear)) {
|
if(CFG->switches.get(keybclear)) {
|
||||||
@ -799,7 +800,6 @@ void Initialize(int argc, char* argv[]) {
|
|||||||
// Switch to keyboard polling instead of blocking
|
// Switch to keyboard polling instead of blocking
|
||||||
gkbd.polling = true;
|
gkbd.polling = true;
|
||||||
gkbd.tickinterval = 5; // Tick twice per second
|
gkbd.tickinterval = 5; // Tick twice per second
|
||||||
gkbd.tickvalue = gclock(); // Reset starting tick
|
|
||||||
kbdsettickfunc(update_statuslines);
|
kbdsettickfunc(update_statuslines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,15 +43,15 @@ gsound* snd = NULL;
|
|||||||
|
|
||||||
#if defined(__MSDOS__)
|
#if defined(__MSDOS__)
|
||||||
#define Beep(A,B) { sound(A); usleep(CFG ? B*CFG->beepfactor+1 : B*1000); }
|
#define Beep(A,B) { sound(A); usleep(CFG ? B*CFG->beepfactor+1 : B*1000); }
|
||||||
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor+1 : A*1000); }
|
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor/1000+1 : A); }
|
||||||
#define NoSound() { nosound(); }
|
#define NoSound() { nosound(); }
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
#define Beep(A,B) { DosBeep(A, CFG ? B*CFG->beepfactor/1000+1 : B); }
|
#define Beep(A,B) { DosBeep(A, CFG ? B*CFG->beepfactor/1000+1 : B); }
|
||||||
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor+1 : A*1000); }
|
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor/1000+1 : A); }
|
||||||
#define NoSound() { }
|
#define NoSound() { }
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
#define Beep(A,B) { (Beep)(A, CFG ? B*CFG->beepfactor/1000+1 : B); }
|
#define Beep(A,B) { (Beep)(A, CFG ? B*CFG->beepfactor/1000+1 : B); }
|
||||||
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor+1 : A*1000); }
|
#define Sleep(A) { usleep(CFG ? A*CFG->beepfactor/1000+1 : A); }
|
||||||
#define NoSound() { }
|
#define NoSound() { }
|
||||||
#else
|
#else
|
||||||
#define Beep(A,B) { }
|
#define Beep(A,B) { }
|
||||||
|
@ -157,9 +157,8 @@ GKbd::GKbd() {
|
|||||||
source = 0;
|
source = 0;
|
||||||
polling = 0;
|
polling = 0;
|
||||||
tickinterval = 0;
|
tickinterval = 0;
|
||||||
tickvalue = 0;
|
tickpress = tickvalue = gclock();
|
||||||
tickfunc = NULL;
|
tickfunc = NULL;
|
||||||
tickpress = 0;
|
|
||||||
inidle = 0;
|
inidle = 0;
|
||||||
quitall = NO;
|
quitall = NO;
|
||||||
|
|
||||||
|
@ -183,8 +183,14 @@ struct __int10_ah1b_statebuf {
|
|||||||
#define _YELLOW (YELLOW << 4)
|
#define _YELLOW (YELLOW << 4)
|
||||||
#define _WHITE (WHITE << 4)
|
#define _WHITE (WHITE << 4)
|
||||||
|
|
||||||
|
#ifdef BLINK
|
||||||
#undef BLINK
|
#undef BLINK
|
||||||
|
#endif
|
||||||
#define BLINK 128
|
#define BLINK 128
|
||||||
|
#ifdef INTENSE
|
||||||
|
#undef INTENSE
|
||||||
|
#endif
|
||||||
|
#define INTENSE 8
|
||||||
|
|
||||||
#if defined(__UNIX__) and not defined(__USE_NCURSES__)
|
#if defined(__UNIX__) and not defined(__USE_NCURSES__)
|
||||||
#define ACSET BLINK
|
#define ACSET BLINK
|
||||||
|
@ -110,8 +110,8 @@ int wgotoxy(int wrow, int wcol) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// calculate effective cursor coordinates and update window record
|
// calculate effective cursor coordinates and update window record
|
||||||
int row = gwin.active->row = gwin.active->srow + wrow + gwin.active->border;
|
const int &row = gwin.active->row = gwin.active->srow + wrow + gwin.active->border;
|
||||||
int col = gwin.active->column = gwin.active->scol + wcol + gwin.active->border;
|
const int &col = gwin.active->column = gwin.active->scol + wcol + gwin.active->border;
|
||||||
|
|
||||||
// set cursor location
|
// set cursor location
|
||||||
vposset(row,col);
|
vposset(row,col);
|
||||||
@ -163,9 +163,6 @@ int wopen(int srow, int scol, int erow, int ecol, int btype, int battr, int watt
|
|||||||
wrec->next=NULL;
|
wrec->next=NULL;
|
||||||
gwin.active=wrec;
|
gwin.active=wrec;
|
||||||
|
|
||||||
//printf("wopen(%i,%i,%i,%i,%i,%i,%i,%i,%i)" NL, srow, scol, erow, ecol, btype, battr, wattr, sbattr, loattr);
|
|
||||||
//getxch();
|
|
||||||
|
|
||||||
// draw and fill text box on screen
|
// draw and fill text box on screen
|
||||||
switch(gwin.style) {
|
switch(gwin.style) {
|
||||||
case STYLE_NORMAL:
|
case STYLE_NORMAL:
|
||||||
@ -290,10 +287,10 @@ int wshadow(int attr) {
|
|||||||
return gwin.werrno=W_NOERROR;
|
return gwin.werrno=W_NOERROR;
|
||||||
|
|
||||||
// get window coordinates from the window's record
|
// get window coordinates from the window's record
|
||||||
int srow = gwin.active->srow;
|
const int &srow = gwin.active->srow;
|
||||||
int scol = gwin.active->scol;
|
const int &scol = gwin.active->scol;
|
||||||
int erow = gwin.active->erow;
|
const int &erow = gwin.active->erow;
|
||||||
int ecol = gwin.active->ecol;
|
const int &ecol = gwin.active->ecol;
|
||||||
|
|
||||||
// allocate buffer to hold shadow's contents
|
// allocate buffer to hold shadow's contents
|
||||||
vatch* wsbuf = (vatch*)throw_xmalloc((((erow-srow)*sizeof(vatch))+ecol-scol+1)*sizeof(vatch));
|
vatch* wsbuf = (vatch*)throw_xmalloc((((erow-srow)*sizeof(vatch))+ecol-scol+1)*sizeof(vatch));
|
||||||
@ -332,12 +329,6 @@ int wshadow(int attr) {
|
|||||||
// draw bottom shadow
|
// draw bottom shadow
|
||||||
while(ccol<=stop) {
|
while(ccol<=stop) {
|
||||||
|
|
||||||
// read current screen character/attribute and save in shadow's buffer
|
|
||||||
//word chat = *q++ = vgetw(crow, ccol);
|
|
||||||
|
|
||||||
// write character back to screen using shadow's attribute
|
|
||||||
//vputc(crow, ccol++, attr, (char)chat);
|
|
||||||
|
|
||||||
// read attribs/chars and store in buffers
|
// read attribs/chars and store in buffers
|
||||||
*q = vgetw(crow, ccol++);
|
*q = vgetw(crow, ccol++);
|
||||||
*wptr++ = vsattr(*q, attr);
|
*wptr++ = vsattr(*q, attr);
|
||||||
@ -373,10 +364,10 @@ int wshadoff() {
|
|||||||
return gwin.werrno=W_NOERROR;
|
return gwin.werrno=W_NOERROR;
|
||||||
|
|
||||||
// get window coordinates from the window's record
|
// get window coordinates from the window's record
|
||||||
int srow = gwin.active->srow;
|
const int &srow = gwin.active->srow;
|
||||||
int scol = gwin.active->scol;
|
const int &scol = gwin.active->scol;
|
||||||
int erow = gwin.active->erow;
|
const int &erow = gwin.active->erow;
|
||||||
int ecol = gwin.active->ecol;
|
const int &ecol = gwin.active->ecol;
|
||||||
|
|
||||||
// start at upper right corner of shadow and work down
|
// start at upper right corner of shadow and work down
|
||||||
int crow = srow+1;
|
int crow = srow+1;
|
||||||
@ -415,7 +406,7 @@ int wshadoff() {
|
|||||||
int wscroll(int count, int direction) {
|
int wscroll(int count, int direction) {
|
||||||
|
|
||||||
// check for window border
|
// check for window border
|
||||||
int border = gwin.active->border;
|
const int &border = gwin.active->border;
|
||||||
|
|
||||||
vscroll(
|
vscroll(
|
||||||
gwin.active->srow + border,
|
gwin.active->srow + border,
|
||||||
@ -437,7 +428,7 @@ int wscroll(int count, int direction) {
|
|||||||
int wscrollbox(int wsrow, int wscol, int werow, int wecol, int count, int direction) {
|
int wscrollbox(int wsrow, int wscol, int werow, int wecol, int count, int direction) {
|
||||||
|
|
||||||
// check for window border
|
// check for window border
|
||||||
int border = gwin.active->border;
|
const int &border = gwin.active->border;
|
||||||
|
|
||||||
vscroll(
|
vscroll(
|
||||||
gwin.active->srow+wsrow+border,
|
gwin.active->srow+wsrow+border,
|
||||||
@ -467,8 +458,8 @@ int wputc(char ch) {
|
|||||||
// get coordinates from window's record
|
// get coordinates from window's record
|
||||||
int crow = gwin.active->row;
|
int crow = gwin.active->row;
|
||||||
int ccol = gwin.active->column;
|
int ccol = gwin.active->column;
|
||||||
int scol = gwin.active->scol;
|
const int &scol = gwin.active->scol;
|
||||||
int border = gwin.active->border;
|
const int &border = gwin.active->border;
|
||||||
|
|
||||||
// test the input character for control characters
|
// test the input character for control characters
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
@ -534,8 +525,9 @@ int wreadcur(int* wrow, int* wcol) {
|
|||||||
vposget(&row,&col);
|
vposget(&row,&col);
|
||||||
|
|
||||||
// calculate window cursor coordinates
|
// calculate window cursor coordinates
|
||||||
*wrow = row - gwin.active->srow - gwin.active->border;
|
const int &border = gwin.active->border;
|
||||||
*wcol = col - gwin.active->scol - gwin.active->border;
|
*wrow = row - gwin.active->srow - border;
|
||||||
|
*wcol = col - gwin.active->scol - border;
|
||||||
|
|
||||||
// return normally
|
// return normally
|
||||||
return gwin.werrno=W_NOERROR;
|
return gwin.werrno=W_NOERROR;
|
||||||
@ -565,8 +557,6 @@ int wdupc(char ch, int count) {
|
|||||||
|
|
||||||
int wcclear(int attr) {
|
int wcclear(int attr) {
|
||||||
|
|
||||||
register int border;
|
|
||||||
|
|
||||||
// check for active window
|
// check for active window
|
||||||
|
|
||||||
if(!gwin.total)
|
if(!gwin.total)
|
||||||
@ -574,7 +564,7 @@ int wcclear(int attr) {
|
|||||||
|
|
||||||
// check for window border
|
// check for window border
|
||||||
|
|
||||||
border=gwin.active->border;
|
const int &border = gwin.active->border;
|
||||||
|
|
||||||
vfill(
|
vfill(
|
||||||
gwin.active->srow+border,
|
gwin.active->srow+border,
|
||||||
@ -603,12 +593,13 @@ int wclreol() {
|
|||||||
return gwin.werrno=W_NOACTIVE;
|
return gwin.werrno=W_NOACTIVE;
|
||||||
|
|
||||||
// clear to end of window's line
|
// clear to end of window's line
|
||||||
|
const int &column = gwin.active->column;
|
||||||
vputx(
|
vputx(
|
||||||
gwin.active->row,
|
gwin.active->row,
|
||||||
gwin.active->column,
|
column,
|
||||||
gwin.active->attr,
|
gwin.active->attr,
|
||||||
gwin.fillch,
|
gwin.fillch,
|
||||||
gwin.active->ecol - gwin.active->border - gwin.active->column + 1
|
gwin.active->ecol - gwin.active->border - column + 1
|
||||||
);
|
);
|
||||||
|
|
||||||
// return normally
|
// return normally
|
||||||
@ -656,11 +647,11 @@ static const char* process_esc(const char* str) {
|
|||||||
|
|
||||||
int wrow,wcol;
|
int wrow,wcol;
|
||||||
|
|
||||||
int attr = gwin.active->attr;
|
|
||||||
|
|
||||||
const char *p = str;
|
const char *p = str;
|
||||||
for(; *p==ESC; p++) {
|
for(; *p==ESC; p++) {
|
||||||
|
|
||||||
|
int attr = gwin.active->attr;
|
||||||
|
|
||||||
switch(*(++p)) {
|
switch(*(++p)) {
|
||||||
|
|
||||||
case '+': // increase text attribute
|
case '+': // increase text attribute
|
||||||
@ -676,19 +667,19 @@ static const char* process_esc(const char* str) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F': // change foreground attribute
|
case 'F': // change foreground attribute
|
||||||
wtextattr((int)((*++p&7)|(attr&248)));
|
wtextattr((int)((*++p & 0x07) | (attr & ~0x07)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B': // change background attribute
|
case 'B': // change background attribute
|
||||||
wtextattr((int)((*++p&112)|(attr&143)));
|
wtextattr((int)((*++p & 0x70) | (attr & ~0x70)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I': // toggle intensity bit
|
case 'I': // toggle intensity bit
|
||||||
wtextattr((int)((attr&8)?(attr&247):(attr|8)));
|
wtextattr((int)(attr ^ INTENSE));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L': // toggle blinking bit
|
case 'L': // toggle blinking bit
|
||||||
wtextattr((int)((attr&128)?(attr&127):(attr|128)));
|
wtextattr((int)(attr ^ BLINK));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X': // reverse attribute
|
case 'X': // reverse attribute
|
||||||
@ -744,10 +735,10 @@ int wputs(const char* str) {
|
|||||||
const char* q;
|
const char* q;
|
||||||
|
|
||||||
// get effective coordinates from window's record
|
// get effective coordinates from window's record
|
||||||
int* crow = &(gwin.active->row);
|
int &crow = gwin.active->row;
|
||||||
int* ccol = &(gwin.active->column);
|
int &ccol = gwin.active->column;
|
||||||
int scol = gwin.active->scol;
|
const int &scol = gwin.active->scol;
|
||||||
int border = gwin.active->border;
|
const int &border = gwin.active->border;
|
||||||
|
|
||||||
// do while not end of string
|
// do while not end of string
|
||||||
for(q=str; *q; q++) {
|
for(q=str; *q; q++) {
|
||||||
@ -755,47 +746,47 @@ int wputs(const char* str) {
|
|||||||
// test the input character for control characters
|
// test the input character for control characters
|
||||||
switch(*q) {
|
switch(*q) {
|
||||||
case '\n':
|
case '\n':
|
||||||
(*crow)++;
|
crow++;
|
||||||
case '\r':
|
case '\r':
|
||||||
*ccol=scol+border;
|
ccol=scol+border;
|
||||||
break;
|
break;
|
||||||
case '\b':
|
case '\b':
|
||||||
if(*ccol==(scol+border)) {
|
if(ccol==(scol+border)) {
|
||||||
*ccol=gwin.active->ecol-border;
|
ccol=gwin.active->ecol-border;
|
||||||
(*crow)--;
|
crow--;
|
||||||
if(*crow<(gwin.active->srow+border))
|
if(crow<(gwin.active->srow+border))
|
||||||
(*crow)++;
|
crow++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*ccol)--;
|
ccol--;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '\t':
|
case '\t':
|
||||||
cwcol=(*ccol)-border-scol;
|
cwcol=ccol-border-scol;
|
||||||
(*ccol)+=(tabstop(cwcol,gwin.tabwidth)-cwcol);
|
ccol+=(tabstop(cwcol,gwin.tabwidth)-cwcol);
|
||||||
break;
|
break;
|
||||||
case ESC:
|
case ESC:
|
||||||
q=process_esc(q);
|
q=process_esc(q);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
vputc(*crow, (*ccol)++, gwin.active->attr, *q);
|
vputc(crow, ccol++, gwin.active->attr, *q);
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if wrap-around is needed
|
// see if wrap-around is needed
|
||||||
if((*ccol) > (gwin.active->ecol-border)) {
|
if(ccol > (gwin.active->ecol-border)) {
|
||||||
*ccol=scol+border;
|
ccol=scol+border;
|
||||||
(*crow)++;
|
crow++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if scroll is needed
|
// see if scroll is needed
|
||||||
if((*crow) > (gwin.active->erow-border)) {
|
if(crow > (gwin.active->erow-border)) {
|
||||||
wscroll(1,SUP);
|
wscroll(1,SUP);
|
||||||
(*crow)--;
|
crow--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset cursor position
|
// reset cursor position
|
||||||
vposset(*crow,*ccol);
|
vposset(crow,ccol);
|
||||||
|
|
||||||
// return normally
|
// return normally
|
||||||
return(gwin.werrno=W_NOERROR);
|
return(gwin.werrno=W_NOERROR);
|
||||||
@ -878,7 +869,8 @@ int wprints(int wrow, int wcol, int attr, const char* str) {
|
|||||||
return gwin.werrno=W_INVCOORD;
|
return gwin.werrno=W_INVCOORD;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vputs(gwin.active->srow+wrow+gwin.active->border,gwin.active->scol+wcol+gwin.active->border,attr,str);
|
const int &border = gwin.active->border;
|
||||||
|
vputs(gwin.active->srow+wrow+border,gwin.active->scol+wcol+border,attr,str);
|
||||||
return gwin.werrno=W_NOERROR;
|
return gwin.werrno=W_NOERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -898,7 +890,8 @@ int wprintvs(int wrow, int wcol, int attr, const vchar* str) {
|
|||||||
return gwin.werrno=W_INVCOORD;
|
return gwin.werrno=W_INVCOORD;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vputvs(gwin.active->srow+wrow+gwin.active->border,gwin.active->scol+wcol+gwin.active->border,attr,str);
|
const int &border = gwin.active->border;
|
||||||
|
vputvs(gwin.active->srow+wrow+border,gwin.active->scol+wcol+border,attr,str);
|
||||||
return gwin.werrno=W_NOERROR;
|
return gwin.werrno=W_NOERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,7 +900,8 @@ int wprintvs(int wrow, int wcol, int attr, const vchar* str) {
|
|||||||
|
|
||||||
int wputx(int wrow, int wcol, int attr, vchar chr, uint len) {
|
int wputx(int wrow, int wcol, int attr, vchar chr, uint len) {
|
||||||
|
|
||||||
vputx(gwin.active->srow+wrow+gwin.active->border,gwin.active->scol+wcol+gwin.active->border,attr,chr,len);
|
const int &border = gwin.active->border;
|
||||||
|
vputx(gwin.active->srow+wrow+border,gwin.active->scol+wcol+border,attr,chr,len);
|
||||||
return gwin.werrno=W_NOERROR;
|
return gwin.werrno=W_NOERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -930,7 +924,7 @@ int wprintns(int wrow, int wcol, int attr, const char* str, uint len, vchar fill
|
|||||||
if(len < olen)
|
if(len < olen)
|
||||||
*ostr = och;
|
*ostr = och;
|
||||||
else if(len > olen)
|
else if(len > olen)
|
||||||
retval = wputx(wrow, wcol+olen, fill_attr != -1 ? fill_attr : attr, fill, len-olen);
|
retval = wputx(wrow, wcol+olen, (fill_attr != -1) ? fill_attr : attr, fill, len-olen);
|
||||||
throw_xfree(istr);
|
throw_xfree(istr);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -952,7 +946,7 @@ int wprintws(int wrow, int wcol, vatch* buf, uint len) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// see if window has border
|
// see if window has border
|
||||||
int border = gwin.active->border;
|
const int &border = gwin.active->border;
|
||||||
|
|
||||||
// calculate effective coordinates
|
// calculate effective coordinates
|
||||||
int row = gwin.active->srow+wrow+border;
|
int row = gwin.active->srow+wrow+border;
|
||||||
@ -1559,7 +1553,6 @@ static void update_buffers(vatch* pcurr, int shadow) {
|
|||||||
|
|
||||||
if(shadow) {
|
if(shadow) {
|
||||||
if(__curr->next==NULL) {
|
if(__curr->next==NULL) {
|
||||||
// vputc(__crow, __ccol, vgattr(*pcurr) & BLINK ? (__curr->wsattr | BLINK) : __curr->wsattr, vgchar(*pcurr));
|
|
||||||
vputc(__crow, __ccol, __gattr & BLINK ? (__curr->wsattr | BLINK) : __curr->wsattr, *__p);
|
vputc(__crow, __ccol, __gattr & BLINK ? (__curr->wsattr | BLINK) : __curr->wsattr, *__p);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1806,7 +1799,7 @@ int wfill(int wsrow, int wscol, int werow, int wecol, vchar chr, int atr) {
|
|||||||
return gwin.werrno=W_INVCOORD;
|
return gwin.werrno=W_INVCOORD;
|
||||||
|
|
||||||
// check for window border
|
// check for window border
|
||||||
int border = gwin.active->border;
|
const int &border = gwin.active->border;
|
||||||
|
|
||||||
// fill in specified region
|
// fill in specified region
|
||||||
vfill(
|
vfill(
|
||||||
@ -1886,17 +1879,10 @@ void wpropbar(int mode, int xx, int yy, long len, long barlen, int attr, long po
|
|||||||
// pos = present position.
|
// pos = present position.
|
||||||
// size = total size of field.
|
// size = total size of field.
|
||||||
|
|
||||||
#if 0 // defined(__linux__)
|
|
||||||
const char _fld = ':';
|
|
||||||
const char _bar = '#';
|
|
||||||
const char _up = '^';
|
|
||||||
const char _dwn = 'v';
|
|
||||||
#else
|
|
||||||
const vchar _fld = ACS_BOARD;
|
const vchar _fld = ACS_BOARD;
|
||||||
const vchar _bar = ACS_BLOCK;
|
const vchar _bar = ACS_BLOCK;
|
||||||
const vchar _up = '\x18';
|
const vchar _up = '\x18';
|
||||||
const vchar _dwn = '\x19';
|
const vchar _dwn = '\x19';
|
||||||
#endif
|
|
||||||
|
|
||||||
int dir=0, x, y;
|
int dir=0, x, y;
|
||||||
long first, width, length;
|
long first, width, length;
|
||||||
@ -2041,24 +2027,14 @@ int wtitle(const char* str, int tpos, int tattr) {
|
|||||||
|
|
||||||
void wscrollbar(int orientation, uint total, uint maxpos, uint pos, int sadd) {
|
void wscrollbar(int orientation, uint total, uint maxpos, uint pos, int sadd) {
|
||||||
|
|
||||||
#if 0 // defined(__linux__)
|
|
||||||
const char barchar = '|';
|
|
||||||
const char thumbchar = '#';
|
|
||||||
const char arrowupchar = '^';
|
|
||||||
const char arrowdownchar = 'v';
|
|
||||||
const char arrowleftchar = '<';
|
|
||||||
const char arrowrightchar = '>';
|
|
||||||
#else
|
|
||||||
const vchar barchar = _box_table(gwin.active->btype, 13);
|
const vchar barchar = _box_table(gwin.active->btype, 13);
|
||||||
const vchar thumbchar = ' '; // '\xDB';
|
const vchar thumbchar = ACS_BLOCK;
|
||||||
const vchar arrowupchar = '\x18';
|
const vchar arrowupchar = '\x18';
|
||||||
const vchar arrowdownchar = '\x19';
|
const vchar arrowdownchar = '\x19';
|
||||||
const vchar arrowleftchar = '\x1B';
|
const vchar arrowleftchar = '\x1B';
|
||||||
const vchar arrowrightchar = '\x1A';
|
const vchar arrowrightchar = '\x1A';
|
||||||
#endif
|
|
||||||
|
|
||||||
int attr = (gwin.active->sbattr == -1) ? gwin.active->battr : gwin.active->sbattr;
|
int attr = (gwin.active->sbattr == -1) ? gwin.active->battr : gwin.active->sbattr;
|
||||||
int thumbattr = revsattr(attr);
|
|
||||||
|
|
||||||
int srow, scol;
|
int srow, scol;
|
||||||
uint visiblelen, barlen;
|
uint visiblelen, barlen;
|
||||||
@ -2101,7 +2077,7 @@ void wscrollbar(int orientation, uint total, uint maxpos, uint pos, int sadd) {
|
|||||||
while(row < erow1)
|
while(row < erow1)
|
||||||
vputc(row++, scol, attr|ACSET, barchar);
|
vputc(row++, scol, attr|ACSET, barchar);
|
||||||
while(row < erow2)
|
while(row < erow2)
|
||||||
vputc(row++, scol, thumbattr|ACSET, thumbchar);
|
vputc(row++, scol, attr|ACSET, thumbchar);
|
||||||
while(row < erow3)
|
while(row < erow3)
|
||||||
vputc(row++, scol, attr|ACSET, barchar);
|
vputc(row++, scol, attr|ACSET, barchar);
|
||||||
vputc(row, scol, revsattr(attr), arrowdownchar);
|
vputc(row, scol, revsattr(attr), arrowdownchar);
|
||||||
@ -2115,7 +2091,7 @@ void wscrollbar(int orientation, uint total, uint maxpos, uint pos, int sadd) {
|
|||||||
while(col < ecol1)
|
while(col < ecol1)
|
||||||
vputc(srow, col++, attr|ACSET, barchar);
|
vputc(srow, col++, attr|ACSET, barchar);
|
||||||
while(col < ecol2)
|
while(col < ecol2)
|
||||||
vputc(srow, col++, thumbattr|ACSET, thumbchar);
|
vputc(srow, col++, attr|ACSET, thumbchar);
|
||||||
while(col < ecol3)
|
while(col < ecol3)
|
||||||
vputc(srow, col++, attr|ACSET, barchar);
|
vputc(srow, col++, attr|ACSET, barchar);
|
||||||
vputc(srow, col, revsattr(attr), arrowrightchar);
|
vputc(srow, col, revsattr(attr), arrowrightchar);
|
||||||
|
Reference in New Issue
Block a user