diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2005-08-17 12:07:34 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2005-08-17 12:07:34 +0000 |
| commit | 661c0ff41b03c54232abe6ad85d5be36d076961f (patch) | |
| tree | 43625c1cc42dbf77de13fdd0d90aa3c6d1baba9d /src | |
| parent | 6bd434fe47fc20f2bcf02dc9311459ce616913a5 (diff) | |
Fixed redraw range in Multiline Input with wordwrapping for space characters and for undo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4523 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Input_.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index d851cba94..1792a3fc6 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -592,8 +592,15 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) { // right after the whitespace before the current word. This will // result in sub-optimal update when such wrapping does not happen // but it is too hard to figure out for now... - if (wrap()) - while (b > 0 && !isspace(index(b) & 255)) b--; + if (wrap()) { + // if there is a space in the pasted text, the whole line may have rewrapped + for (int i=0; i<ilen; i++) + if (text[i]==' ') break; + if (i==ilen) + while (b > 0 && !isspace(index(b) & 255) && index(b)!='\n') b--; + else + while (b > 0 && index(b)!='\n') b--; + } // make sure we redraw the old selection or cursor: if (mark_ < b) b = mark_; @@ -640,6 +647,8 @@ int Fl_Input_::undo() { mark_ = b /* -ilen */; position_ = b; + if (wrap()) + while (b1 > 0 && index(b1)!='\n') b1--; minimal_update(b1); set_changed(); if (when()&FL_WHEN_CHANGED) do_callback(); |
