summaryrefslogtreecommitdiff
path: root/fluid/CodeEditor.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/CodeEditor.cxx')
-rw-r--r--fluid/CodeEditor.cxx13
1 files changed, 11 insertions, 2 deletions
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();