From b5719339a2b3facf56a94f32e84d20c083d3fa7a Mon Sep 17 00:00:00 2001 From: Ianos Gnatiuc Date: Sun, 25 Jun 2006 07:45:12 +0000 Subject: [PATCH] Fixed string subscript out of range bug in editors undo stack. --- docs/notework.rus | 2 ++ docs/notework.txt | 2 ++ golded3/geedit.cpp | 17 +++++++++-------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/notework.rus b/docs/notework.rus index 700276f..dffd630 100644 --- a/docs/notework.rus +++ b/docs/notework.rus @@ -10,6 +10,8 @@ _____________________________________________________________________________ Заметки для GoldED+ 1.1.5, /snapshot/ _____________________________________________________________________________ +- Исправлен баг в стеке отката редактора, при котором голдед пробовал прочесть по + индексу больше чем размер строки. + Добавлен ReadForceDeleteMsg (по умолчанию #Del) в goldkeys.cfg для удаления сообщений минуя AreaRecicleBin. ! Изменены параметры AreaRecycleBin на AreaRecycleBin [NoAsk/Ask]. diff --git a/docs/notework.txt b/docs/notework.txt index fd57467..36aa98f 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,8 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ +- Fixed string subscript out of range in editors undo stack. + + Added ReadForceDeleteMsg (default is #Del) to the goldkeys.cfg used to delete messages without moving them to AreaRecicleBin. diff --git a/golded3/geedit.cpp b/golded3/geedit.cpp index 2b8163a..e86a410 100644 --- a/golded3/geedit.cpp +++ b/golded3/geedit.cpp @@ -1063,26 +1063,27 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, boo } } - // Was this line truncated at space? - bool truncated_at_space = make_bool(isspace(_thisline->txt[_wrappos])); - // Truncate at the wrapping location _thisline->txt.erase(_wrappos); // Was this line quoted? - if(_quotelen) { - + if (_quotelen) + { // Trim spaces off the end of the line int _trimpos = _wrappos - 1; - if(isspace(_thisline->txt[_trimpos])) { - while(_trimpos > 0 and isspace(_thisline->txt[_trimpos-1])) + if (isspace(_thisline->txt[_trimpos])) + { + while (_trimpos > 0 and isspace(_thisline->txt[_trimpos-1])) _trimpos--; if(_quotelen and (_trimpos < _quotelen)) _trimpos++; Undo->PushItem(EDIT_UNDO_OVR_CHAR|BATCH_MODE, _thisline, _trimpos); _thisline->txt.erase(_trimpos); } - Undo->PushItem((truncated_at_space?EDIT_UNDO_OVR_CHAR:EDIT_UNDO_INS_CHAR)|BATCH_MODE, _thisline, _trimpos+1); + else + { + Undo->PushItem(EDIT_UNDO_INS_CHAR|BATCH_MODE, _thisline, _trimpos + 1); + } // Append a new linefeed _thisline->txt += "\n";