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)...
@$(CXX) $(LNKFLAGS) -o $@ $(FOBJPATH)/*$(OBJEXT) $(ADDS) $(LIBS) -L$(FLIBPATH)
@echo done
ifeq ($(PLATFORM),djg)
exe2coff $@
copy /b $(DJGPP)/bin/cwsdstub.exe+$(TOP)/$(BIN)/$(SHORTTARGET)$(PLATFORM) $@
endif
$(FGLIBS): $(GLIBS)

View File

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

View File

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

View File

@ -508,7 +508,7 @@ void LoadText(GMsg* msg, const char* textfile) {
*txtptr = CR;
}
if(*txtptr == LF) {
if(*(txtptr-1) != ' ' and *ptr != ' ')
if((*(txtptr-1) != ' ') and (*ptr != ' '))
*txtptr++ = ' ';
}
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.pos0();
MsgLineReIndex(msg);
if(not savedirect) {
HeaderView->Use(AA, msg);
HeaderView->Paint();

View File

@ -1189,7 +1189,7 @@ gkey kbxget_raw(int mode) {
if(alt_pressed)
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
if(special_key) {
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:
sprintf(_kludges+strlen(_kludges), "\001PID: %s\r", _buf);
strcpy(__msg->pid, _buf);
strxcpy(__msg->pid, _buf, sizeof(__msg->pid));
break;
case JAMSUB_TRACE: