minor fixes

This commit is contained in:
Alexander S. Aganichev 2001-02-19 22:53:24 +00:00
parent 741bd5e38b
commit 4d2f5ae1e5
8 changed files with 41 additions and 35 deletions

View File

@ -16,6 +16,10 @@ $(TOP)/$(BIN)/$(SHORTTARGET)$(PLATFORM)$(EXEEXT): $(OBJS) $(FGLIBS) $(ADDS)
@echo -n Linking $(TARGET)... @echo -n Linking $(TARGET)...
@$(CXX) $(LNKFLAGS) -o $@ $(FOBJPATH)/*$(OBJEXT) $(ADDS) $(LIBS) -L$(FLIBPATH) @$(CXX) $(LNKFLAGS) -o $@ $(FOBJPATH)/*$(OBJEXT) $(ADDS) $(LIBS) -L$(FLIBPATH)
@echo done @echo done
ifeq ($(PLATFORM),djg)
exe2coff $@
copy /b $(DJGPP)/bin/cwsdstub.exe+$(TOP)/$(BIN)/$(SHORTTARGET)$(PLATFORM) $@
endif
$(FGLIBS): $(GLIBS) $(FGLIBS): $(GLIBS)

View File

@ -587,9 +587,7 @@ void IEclass::GoRight() {
_test_haltab(col > maxcol, col, maxcol); _test_haltab(col > maxcol, col, maxcol);
char _cursorchar = currline->txt[col]; if((col == maxcol) or (col >= currline->txt.length()) or (currline->txt[col] == '\n')) {
if((col == maxcol) or (_cursorchar == '\n') or (_cursorchar == NUL)) {
if(currline->next != NULL) { if(currline->next != NULL) {
GoDown(); GoDown();
col = mincol; col = mincol;
@ -688,7 +686,7 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, int
int _spacepos = _wrappos; int _spacepos = _wrappos;
while(_spacepos > 0) { while(_spacepos > 0) {
_spacepos--; _spacepos--;
if (_thisline->txt[_spacepos] != ' ') if(_thisline->txt[_spacepos] != ' ')
break; break;
} }
@ -937,15 +935,15 @@ void IEclass::insertchar(char __ch) {
GFTRK("Editinsertchar"); GFTRK("Editinsertchar");
#ifndef NDEBUG
uint _currline_len = currline->txt.length(); uint _currline_len = currline->txt.length();
#ifndef NDEBUG
_test_haltab(col > _currline_len, col, _currline_len); _test_haltab(col > _currline_len, col, _currline_len);
#endif #endif
// Insert or overwrite the char, replacing the block if any // Insert or overwrite the char, replacing the block if any
if((selecting ? (BlockCut(true), batch_mode = BATCH_MODE) : false) or if((selecting ? (BlockCut(true), batch_mode = BATCH_MODE) : false) or
(currline->txt[col] == '\n') or (currline->txt[col] == NUL) or insert) { (col >= _currline_len) or (currline->txt[col] == '\n') or insert) {
Undo->PushItem(EDIT_UNDO_INS_CHAR|batch_mode); Undo->PushItem(EDIT_UNDO_INS_CHAR|batch_mode);
if(col == currline->txt.length() and __ch != ' ' and __ch != '\n') if((col == _currline_len) and (__ch != ' ') and (__ch != '\n'))
currline->txt += ' '; currline->txt += ' ';
currline->txt.insert(col, 1, __ch); currline->txt.insert(col, 1, __ch);
} else { } else {
@ -1116,28 +1114,29 @@ void IEclass::GoWordRight() {
GFTRK("EditGoWordRight"); GFTRK("EditGoWordRight");
if(currline->txt.length() == col or currline->txt[col] == '\n') { if((currline->txt.length() >= col) or (currline->txt[col] == '\n')) {
if(currline->next) { if(currline->next) {
GoDown(); GoDown();
col = 0; col = 0;
} }
} }
else { else {
size_t len = currline->txt.length();
if(not isxalnum(currline->txt[col])) { if(not isxalnum(currline->txt[col])) {
while(not isxalnum(currline->txt[col]) and ((col+1) <= currline->txt.length())) while(not isxalnum(currline->txt[col]) and ((col+1) <= len))
col++; col++;
} }
else { else {
while(isxalnum(currline->txt[col]) and ((col+1) <= currline->txt.length())) while(isxalnum(currline->txt[col]) and ((col+1) <= len))
col++; col++;
while(not isxalnum(currline->txt[col]) and ((col+1) <= currline->txt.length())) while(not isxalnum(currline->txt[col]) and ((col+1) <= len))
col++; col++;
} }
if(currline->txt[col-1] == '\n') if(currline->txt[col-1] == '\n')
col--; col--;
if(currline->txt.length() == col) { if(len == col) {
if(currline->next) { if(currline->next) {
GoDown(); GoDown();
col = 0; col = 0;
@ -1407,7 +1406,6 @@ void IEclass::Tab() {
break; break;
} while(col % tabsz); } while(col % tabsz);
GFTRK(NULL); GFTRK(NULL);
} }
@ -1785,7 +1783,7 @@ void IEclass::Reflow() {
// Strip leading spaces from the first line // Strip leading spaces from the first line
const char* ptr = _qlenptr; const char* ptr = _qlenptr;
while(*ptr and isspace(*ptr) and *ptr != '\n') ptr++; while(*ptr and isspace(*ptr) and (*ptr != '\n')) ptr++;
if(ptr != _qlenptr) { if(ptr != _qlenptr) {
Undo->PushItem(EDIT_UNDO_DEL_TEXT, currline, _qlen1, ptr-_qlenptr); Undo->PushItem(EDIT_UNDO_DEL_TEXT, currline, _qlen1, ptr-_qlenptr);
currline->txt.erase(_qlen1, ptr-_qlenptr); currline->txt.erase(_qlen1, ptr-_qlenptr);
@ -1854,8 +1852,10 @@ void IEclass::ToUpper() {
GFTRK("EditToUpper"); GFTRK("EditToUpper");
Undo->PushItem(EDIT_UNDO_OVR_CHAR); if(col < currline->txt.length()) {
currline->txt[col] = toupper(currline->txt[col]); Undo->PushItem(EDIT_UNDO_OVR_CHAR);
currline->txt[col] = toupper(currline->txt[col]);
}
GFTRK(NULL); GFTRK(NULL);
} }
@ -1867,8 +1867,10 @@ void IEclass::ToLower() {
GFTRK("EditToLower"); GFTRK("EditToLower");
Undo->PushItem(EDIT_UNDO_OVR_CHAR); if(col >= currline->txt.length()) {
currline->txt[col] = tolower(currline->txt[col]); Undo->PushItem(EDIT_UNDO_OVR_CHAR);
currline->txt[col] = tolower(currline->txt[col]);
}
GFTRK(NULL); GFTRK(NULL);
} }
@ -1880,11 +1882,13 @@ void IEclass::ToggleCase() {
GFTRK("EditToggleCase"); GFTRK("EditToggleCase");
Undo->PushItem(EDIT_UNDO_OVR_CHAR); if(col >= currline->txt.length()) {
if(toupper(currline->txt[col]) == currline->txt[col]) Undo->PushItem(EDIT_UNDO_OVR_CHAR);
currline->txt[col] = tolower(currline->txt[col]); if(toupper(currline->txt[col]) == currline->txt[col])
else currline->txt[col] = tolower(currline->txt[col]);
currline->txt[col] = toupper(currline->txt[col]); else
currline->txt[col] = toupper(currline->txt[col]);
}
GFTRK(NULL); GFTRK(NULL);
} }
@ -2143,7 +2147,7 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) {
msgmode = __mode; msgmode = __mode;
currline = __msg->lin; currline = __msg->lin;
if(AA->isinternet() and CFG->soupexportmargin <= CFG->dispmargin) if(AA->isinternet() and (CFG->soupexportmargin <= CFG->dispmargin))
margintext = CFG->soupexportmargin; margintext = CFG->soupexportmargin;
else else
margintext = CFG->dispmargin; margintext = CFG->dispmargin;
@ -2616,14 +2620,14 @@ void UndoStack::PlayItem() {
// we need to fit thisrow into the screen boundaries // we need to fit thisrow into the screen boundaries
if(delta > 0) { if(delta > 0) {
for (row -= delta; row < minrow; row++) { for (row -= delta; row < minrow; row++) {
if (templine) // cause refresh() issue an error since templine should never be NULL if(templine) // cause refresh() issue an error since templine should never be NULL
templine = templine->next; templine = templine->next;
} }
temprow = maxrow; temprow = maxrow;
} }
else { else {
for (row -= delta; row > maxrow; row--) { for (row -= delta; row > maxrow; row--) {
if (templine) // cause refresh() issue an error since templine should never be NULL if(templine) // cause refresh() issue an error since templine should never be NULL
templine = templine->prev; templine = templine->prev;
} }
temprow = minrow; temprow = minrow;
@ -2631,13 +2635,13 @@ void UndoStack::PlayItem() {
// move pointer to the top of screen so we refresh scrolled area // move pointer to the top of screen so we refresh scrolled area
while (row != minrow) { while (row != minrow) {
if (templine) // cause refresh() issue an error since templine should never be NULL if(templine) // cause refresh() issue an error since templine should never be NULL
templine = templine->prev; templine = templine->prev;
--row; --row;
} }
} }
else { else {
if (delta < 0) { if(delta < 0) {
templine = topline; templine = topline;
for(thisrow=0; thisrow < _prow; thisrow++) for(thisrow=0; thisrow < _prow; thisrow++)
if(templine) // cause refresh() issue an error if thisrow != _prow if(templine) // cause refresh() issue an error if thisrow != _prow

View File

@ -2379,7 +2379,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
reflow = quotewraphard; reflow = quotewraphard;
line->type |= GLINE_WRAP; line->type |= GLINE_WRAP;
ptr = spanfeeds(ptr); ptr = spanfeeds(ptr);
if(*bp == ' ' or isspace(*ptr)) if((*bp == ' ') or (isspace(*ptr) && (*ptr != LF)))
ptr = spanspaces(ptr); ptr = spanspaces(ptr);
else { else {
if(tmp) { if(tmp) {

View File

@ -872,7 +872,7 @@ void GThreadlist::GenTree(char* buf, int idx) {
static char graph[4]="†„<EFBFBD>"; static char graph[4]="†„<EFBFBD>";
#else #else
static char graph_ibmpc[4]="ÃÀ³"; static char graph_ibmpc[4]="ÃÀ³";
static char graph[]=""; static char graph[4]="";
if(graph[0] == NUL) { if(graph[0] == NUL) {
int table = LoadCharset(NULL, NULL, 1); int table = LoadCharset(NULL, NULL, 1);

View File

@ -508,7 +508,7 @@ void LoadText(GMsg* msg, const char* textfile) {
*txtptr = CR; *txtptr = CR;
} }
if(*txtptr == LF) { if(*txtptr == LF) {
if(*(txtptr-1) != ' ' and *ptr != ' ') if((*(txtptr-1) != ' ') and (*ptr != ' '))
*txtptr++ = ' '; *txtptr++ = ' ';
} }
else if(*txtptr != 0) else if(*txtptr != 0)

View File

@ -623,8 +623,6 @@ static void MakeMsg2(int& mode, int& status, int& forwstat, int& topline, GMsg*
msg->attr.tou0(); msg->attr.tou0();
msg->attr.pos0(); msg->attr.pos0();
MsgLineReIndex(msg);
if(not savedirect) { if(not savedirect) {
HeaderView->Use(AA, msg); HeaderView->Use(AA, msg);
HeaderView->Paint(); HeaderView->Paint();

View File

@ -1189,7 +1189,7 @@ gkey kbxget_raw(int mode) {
if(alt_pressed) if(alt_pressed)
special_key = is_numpad_key(inp); // Alt-<numpad key> special_key = is_numpad_key(inp); // Alt-<numpad key>
else if(not gkbd_nt and (ascii and not ctrl_pressed) and not (iscntrl(ascii) and shift_pressed) and not (CKS & ENHANCED_KEY)) else if(not gkbd_nt and not (CKS & ENHANCED_KEY) and (ascii and not ctrl_pressed) and not (iscntrl(ascii) and shift_pressed))
special_key = true; // It is alphanumeric key under Win9x special_key = true; // It is alphanumeric key under Win9x
if(special_key) { if(special_key) {
ReadConsole(gkbd_hin, &ascii, 1, &nread, NULL); ReadConsole(gkbd_hin, &ascii, 1, &nread, NULL);

View File

@ -200,7 +200,7 @@ int JamArea::load_message(int __mode, gmsg* __msg, JamHdr& __hdr) {
case JAMSUB_PID: case JAMSUB_PID:
sprintf(_kludges+strlen(_kludges), "\001PID: %s\r", _buf); sprintf(_kludges+strlen(_kludges), "\001PID: %s\r", _buf);
strcpy(__msg->pid, _buf); strxcpy(__msg->pid, _buf, sizeof(__msg->pid));
break; break;
case JAMSUB_TRACE: case JAMSUB_TRACE: