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
This commit is contained in:
Matthias Melcher 2005-08-17 12:07:34 +00:00
parent 6bd434fe47
commit 661c0ff41b
2 changed files with 13 additions and 2 deletions

View File

@ -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)

View File

@ -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();