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

[STR New]

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


When an Fl_Text_Editor's buffer()->remove() is called,
the text insert cursor disappears. (ie. *not* the mouse cursor)

Attaching cursor_problem.cxx that shows the problem:

    1) Run the program, text appears with cursor at top
    2) Hit 'remove(5,6)' button that removes the text at position [5]
    3) Cursor disappears

Problem is in (3), cursor should remain.
It seems no matter where the cursor is, remove() causes it to disappear.

Either this is a bug, or should be documented behavior.


Link: http://www.fltk.org/str.php?L2704
Version: 1.3.0
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Text_Editor.H>
#include <FL/Fl_Button.H>
void RemoveCB(Fl_Widget *w, void *cbdata) {
    Fl_Text_Editor *edit = (Fl_Text_Editor*)cbdata;
    edit->buffer()->remove(5,6);        // causes text cursor to disappear
}
int main() {
     Fl_Window *win = new Fl_Window(640, 500);
     Fl_Text_Buffer *buff = new Fl_Text_Buffer();
     Fl_Text_Editor *edit = new Fl_Text_Editor(10, 10, 640-20, 470-20);
     edit->buffer(buff);
     buff->text("line 0\nline 1\nline 2\n"
                "line 3\nline 4\nline 5\n"
                "line 6\nline 7\nline 8\n"
                "line 9\nline 10\nline 11\n"
                "line 12\nline 13\nline 14\n"
                "line 15\nline 16\nline 17\n"
                "line 18\nline 19\nline 20\n"
                "line 21\nline 22\nline 23\n");
     Fl_Button *but = new Fl_Button(10,470,140,25,"remove(5,6)");
     but->callback(RemoveCB, (void*)edit);

     win->resizable(*edit);
     win->show();
     return(Fl::run());
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to