Mercurial > octave
changeset 27117:e14e48e838fa
Don't add extra closing endXXX keywords in GUI Editor (bug #56160).
* octave-qscintilla.cc (octave_qscintilla::auto_close): Add special case to
function which detects when keyword start and next line both have indent of 0.
This likely, but not necessarily, means the file isn't indented properly and
thus the algorithm for inserting endXXX can't be reliably executed.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 27 May 2019 09:39:09 -0700 |
parents | 014e137947d7 |
children | 99adef2c6e10 |
files | libgui/src/m-editor/octave-qscintilla.cc |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/octave-qscintilla.cc Mon May 27 09:32:38 2019 -0700 +++ b/libgui/src/m-editor/octave-qscintilla.cc Mon May 27 09:39:09 2019 -0700 @@ -968,6 +968,7 @@ int offset = 1; size_t next_start; QString next_line; + do // find next non-blank line { next_line = text (linenr + offset++); @@ -975,8 +976,11 @@ } while (linenr + offset < lines () && next_start == std::string::npos); + if (next_start == std::string::npos) next_start = 0; + if (start == 0 && next_start == 0) + return; // bug #56160, don't add at 0 if (next_start > start) // more indented => don't add "end" return; if (next_start == start) // same => check if already is "end"