From 326b64d278cc990e2d03ee3fb9b18dd3a630a82b Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 4 Apr 2015 11:17:38 +0000 Subject: 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 --- fluid/CodeEditor.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'fluid/CodeEditor.cxx') diff --git a/fluid/CodeEditor.cxx b/fluid/CodeEditor.cxx index c5fe85381..edc3145c8 100644 --- a/fluid/CodeEditor.cxx +++ b/fluid/CodeEditor.cxx @@ -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); -- cgit v1.2.3