summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--fluid/CodeEditor.cxx13
2 files changed, 13 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index fd4beb627..608ada8be 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #648, STR #692, STR #730, STR
#744, STR #745, STR #942)
+ - Fluid Code Editor would occasionally not draw the last character
+ in the buffer (STR #798)
- Fluid Declaration private flag fixed (STR #799)
- Fluid overlay now shows a seperate bounding box of selected
items with correct handles and a dotted boundig box for all
diff --git a/fluid/CodeEditor.cxx b/fluid/CodeEditor.cxx
index 7e9fa72c0..ed3ad3f8b 100644
--- a/fluid/CodeEditor.cxx
+++ b/fluid/CodeEditor.cxx
@@ -345,8 +345,17 @@ int CodeEditor::auto_indent(int, CodeEditor* e) {
for (ptr = text; isspace(*ptr); ptr ++);
*ptr = '\0';
- e->insert("\n");
- if (*text) e->insert(text);
+ if (*text) {
+ // use only a single 'insert' call to avoid redraw issues
+ int n = strlen(text);
+ char *b = (char*)malloc(n+2);
+ *b = '\n';
+ strcpy(b+1, text);
+ e->insert(b);
+ free(b);
+ } else {
+ e->insert("\n");
+ }
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();