summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2015-04-04 11:17:38 +0000
committerMatthias Melcher <fltk@matthiasm.com>2015-04-04 11:17:38 +0000
commit326b64d278cc990e2d03ee3fb9b18dd3a630a82b (patch)
tree262f663629721a72a324b3b4821a3dabfa6f5846 /fluid
parentf05b677a4beaeac8c27220efe481cd74cc84f39c (diff)
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
Diffstat (limited to 'fluid')
-rw-r--r--fluid/CodeEditor.cxx8
1 files changed, 8 insertions, 0 deletions
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);