diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2005-12-30 10:13:17 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2005-12-30 10:13:17 +0000 |
| commit | d3db965083a783672ce39c36883c194a403abdac (patch) | |
| tree | 0c0c73ef968f7b84fcb5c2f7b59cdb83061287b8 /fluid/CodeEditor.cxx | |
| parent | 10fae2dd8a3b2383d3ec004d68a46fd945a8d4d6 (diff) | |
Fixed a few memory faults found by Valgrind (yes, I finally got my Linux
machine up and running again)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4723 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/CodeEditor.cxx')
| -rw-r--r-- | fluid/CodeEditor.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fluid/CodeEditor.cxx b/fluid/CodeEditor.cxx index 38c23c3aa..af1e0c8ac 100644 --- a/fluid/CodeEditor.cxx +++ b/fluid/CodeEditor.cxx @@ -305,14 +305,17 @@ void CodeEditor::style_update(int pos, int nInserted, int nDeleted, end = editor->mBuffer->line_end(pos + nInserted); text = editor->mBuffer->text_range(start, end); style = editor->mStyleBuffer->text_range(start, end); - last = style[end - start - 1]; + if (start==end) + last = 0; + else + last = style[end - start - 1]; style_parse(text, style, end - start); editor->mStyleBuffer->replace(start, end, style); editor->redisplay_range(start, end); - if (last != style[end - start - 1]) { + if (start==end || last != style[end - start - 1]) { // The last character on the line changed styles, so reparse the // remainder of the buffer... free(text); |
