summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-08-17 12:07:34 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-08-17 12:07:34 +0000
commit661c0ff41b03c54232abe6ad85d5be36d076961f (patch)
tree43625c1cc42dbf77de13fdd0d90aa3c6d1baba9d
parent6bd434fe47fc20f2bcf02dc9311459ce616913a5 (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
-rw-r--r--CHANGES2
-rw-r--r--src/Fl_Input_.cxx13
2 files changed, 13 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 2ae116490..b30e3a962 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,8 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #571, STR #648, STR #692, STR
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
STR #969)
+ - Multiline Input will update right if a space character is
+ inserted in word wrap mode (STR #981)
- FLUID group labels redraw correctly (STR #959)
- FLUID now updates color of Fl_Tabs children (STR #979)
- FLUID now supports 'size_range()' (STR #851)
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();