DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Pending]

Link: http://www.fltk.org/str.php?L2704
Version: 1.3.0


OK, her's what's happening: the first example works correctly. Replacing
the Button callback with a timeout behave correctly (the cursor remains
visible).

The second example misbehaves because you capture a modify callback in
which you capture adding a '\n', which is already included in the buffer,
but before it is actually counted by the widget in the insertion callback,
it is already deleted again. Deleting a '\n' however decrements the newline
count. 

Now the widget is convinced that your buffer contains -1 newline
characters, an internal inconsistency, which in turn causes the cursor
line to be out of range (not because the cursor is wrong, but because the
line count is wrong).

If you replace the special character with '@' instead of '\n', the code
works again. 

The correct way however to re-implement the function of the enter key is
to wither override Fl_Text_Display::handle(), so that the '\n' never
reaches the buffer to begin with, or to override the key action in
Fl_Text_Editor which is currently

  { FL_Enter,     FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor::kf_enter     
},


Link: http://www.fltk.org/str.php?L2704
Version: 1.3.0

_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to