mirror of https://github.com/fltk/fltk
STR 3460: remember cursor position in code editor
When editing code in Fluid, the COde_Type class will now remember the last cursor position and reopen the editor dialog at that position (not for external editor).
This commit is contained in:
parent
a1ebe87a88
commit
3d6b234c27
|
@ -456,6 +456,7 @@ void Fl_Code_Type::open() {
|
|||
if (!code_panel) make_code_panel();
|
||||
const char *text = name();
|
||||
code_input->buffer()->text( text ? text : "" );
|
||||
code_input->insert_position(cursor_position_);
|
||||
code_panel->show();
|
||||
const char* message = 0;
|
||||
for (;;) { // repeat as long as there are errors
|
||||
|
@ -472,6 +473,7 @@ void Fl_Code_Type::open() {
|
|||
free(c);
|
||||
break;
|
||||
}
|
||||
cursor_position_ = code_input->insert_position();
|
||||
BREAK2:
|
||||
code_panel->hide();
|
||||
}
|
||||
|
|
|
@ -193,7 +193,9 @@ public:
|
|||
|
||||
class Fl_Code_Type : public Fl_Type {
|
||||
ExternalCodeEditor editor_;
|
||||
int cursor_position_;
|
||||
public:
|
||||
Fl_Code_Type() { cursor_position_ = 0; }
|
||||
Fl_Type *make();
|
||||
void write();
|
||||
void write_code1();
|
||||
|
|
Loading…
Reference in New Issue