From f03086f6a7dc5fbbb1d4f7333adf99068aef0e9f Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Tue, 20 Mar 2001 05:21:46 +0000 Subject: [PATCH] Wrapping fixes, logo painted to yellow by default --- golded3/geedit.cpp | 25 +++++++++++++++---------- golded3/geedit.h | 2 -- golded3/geinit.cpp | 15 ++++++++------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/golded3/geedit.cpp b/golded3/geedit.cpp index 03a2984..86b9671 100644 --- a/golded3/geedit.cpp +++ b/golded3/geedit.cpp @@ -37,8 +37,6 @@ // ------------------------------------------------------------------ // Globals -int CFG__editquotewrap = YES; - Line* Edit__killbuf = NULL; Line* Edit__pastebuf = NULL; @@ -639,7 +637,7 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, boo _quotelen = 0; // Is this line quoted? - if((_thisline->type & GLINE_QUOT) and CFG__editquotewrap) { + if(_thisline->type & GLINE_QUOT) { // Get quote string and length GetQuotestr(_thisline->txt.c_str(), _quotebuf, &_quotelen); @@ -839,7 +837,7 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, boo _thislen = _thisline->txt.length(); // If we are on the cursor line, check if the cursor char was wrapped - if((_thisrow == _cursrow) and (_thislen <= _curscol) and not ((_thislen == _curscol) and (_thisline->txt[_curscol] != ' '))) { + if((_thisrow == _cursrow) and (_thislen <= _curscol)) { _curscol = _quotelen + ((_curscol > _wrappos) ? _curscol-_wrappos : 0); _cursrow++; UndoItem* i = Undo->last_item; @@ -947,6 +945,15 @@ void IEclass::insertchar(char __ch) { // Insert or overwrite the char, replacing the block if any if((selecting ? (BlockCut(true), batch_mode = BATCH_MODE) : false) or (col >= _currline_len) or (currline->txt[col] == '\n') or insert) { + if(not isspace(__ch) and (col == mincol)) { + // if previous line was wrapped on non-space character + if(currline->prev and not currline->prev->txt.empty() and + (currline->prev->txt.find('\n') == currline->prev->txt.npos) and + not isspace(currline->prev->txt[currline->prev->txt.length()-1])) { + GoUp(); + GoEOL(); + } + } Undo->PushItem(EDIT_UNDO_INS_CHAR|batch_mode); currline->txt.insert(col, 1, __ch); } else { @@ -1013,7 +1020,7 @@ void IEclass::DelChar() { // Is the next line quoted? // And is the cursor column non-zero? uint _quotelen = 0; - if((_nextline->type & GLINE_QUOT) and CFG__editquotewrap and col) { + if((_nextline->type & GLINE_QUOT) and col) { // Get quote string length char _dummybuf[100]; @@ -1022,7 +1029,7 @@ void IEclass::DelChar() { // Copy the next line's text to this line without quote string const char *_nexttext = _nextline->txt.c_str()+_quotelen; - _thisline->txt += _nexttext + strspn(_nexttext, " "); + _thisline->txt += _nexttext + (col ? strspn(_nexttext, " ") : 0); Undo->PushItem(EDIT_UNDO_CUT_TEXT|batch_mode, _thisline, col); @@ -1051,12 +1058,10 @@ void IEclass::DelChar() { // Make sure the line type still is correct setlinetype(_thisline); - uint _thisrow = row; - // Rewrap this line - wrapdel(&currline, &col, &row, false); + wrapdel(&currline, &col, &row); - refresh(_thisline, _thisrow); + refresh(currline, row); GFTRK(NULL); } diff --git a/golded3/geedit.h b/golded3/geedit.h index d8ac7fc..49778d6 100644 --- a/golded3/geedit.h +++ b/golded3/geedit.h @@ -104,8 +104,6 @@ // ------------------------------------------------------------------ // Globals -extern int CFG__editquotewrap; - extern Line* Edit__killbuf; extern Line* Edit__pastebuf; diff --git a/golded3/geinit.cpp b/golded3/geinit.cpp index 88f2518..37d6537 100644 --- a/golded3/geinit.cpp +++ b/golded3/geinit.cpp @@ -376,14 +376,15 @@ static void w_brag() { W_READ = wopen_(1, 2, MAXROW-4, MAXCOL-5, W_BBRAG, C_BRAGB, C_BRAGW); w_shadow(); - wprints(0, 0, C_BRAGW, " 88 88 88 "); - wprints(1, 0, C_BRAGW, " oooooo oooooo 88 oooo88 oooooo oooo88 o "); - wprints(2, 0, C_BRAGW, " 88 88 88 88 88 88 88 88oo88 88 88 o8o "); - wprints(3, 0, C_BRAGW, " 88oo88 88oo88 88 88oo88 88oooo 88oo88 8 "); - wprints(4, 0, C_BRAGW, " oo 88 "); - wprints(5, 0, C_BRAGW, " 88oooooo88 "); + wprints(0, 0, C_BRAGB, " 88 88 88 "); + wprints(1, 0, C_BRAGB, " oooooo oooooo 88 oooo88 oooooo oooo88 o "); + wprints(2, 0, C_BRAGB, " 88 88 88 88 88 88 88 88oo88 88 88 o8o "); + wprints(3, 0, C_BRAGB, " 88oo88 88oo88 88 88oo88 88oooo 88oo88 8 "); + wprints(4, 0, C_BRAGB, " oo 88 "); + wprints(5, 0, C_BRAGB, " 88oooooo88 "); - wprints(4, 43-strlen(__gver_longpid__), C_BRAGW, __gver_longpid__); + wprints(4, 46-strlen(__gver_longpid__)-1-strlen(__gver_ver__), C_BRAGW, __gver_longpid__); + wprints(4, 46-strlen(__gver_ver__), C_BRAGW, __gver_ver__); wprints(5, 12, C_BRAGW, "http://golded-plus.sourceforge.net");