STR #3184: fixed code editor in Fluid to check the previous line for a block comment style in the last character. If so, the previous line is include in the calculation of the current line. This seems to fix issues when changing the block-comment character combination '*/' by deleting a character or adding one in the middle.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10671 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2015-04-04 11:17:38 +00:00
parent f05b677a4b
commit 326b64d278
1 changed files with 8 additions and 0 deletions

View File

@ -307,6 +307,14 @@ void CodeEditor::style_update(int pos, int nInserted, int nDeleted,
// style character and keep updating if we have a multi-line
// comment character...
start = editor->mBuffer->line_start(pos);
// the following code checks the style of the last character of the previous
// line. If it is a block comment, the previous line is interpreted as well.
int altStart = editor->mBuffer->prev_char(start);
if (altStart>0) {
altStart = editor->mBuffer->prev_char(altStart);
if (altStart>=0 && editor->mStyleBuffer->byte_at(start-2)=='C')
start = editor->mBuffer->line_start(altStart);
}
end = editor->mBuffer->line_end(pos + nInserted);
text = editor->mBuffer->text_range(start, end);
style = editor->mStyleBuffer->text_range(start, end);