diff options
| author | Manolo Gouy <Manolo> | 2012-12-24 11:45:07 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2012-12-24 11:45:07 +0000 |
| commit | cf672dba0db831679ba0cb5b9966a6dd1bbcb6e5 (patch) | |
| tree | a01386823937540124aaf43c9f6237a0c4b1fc99 /src/Fl_Text_Editor.cxx | |
| parent | 3c72b20458c943f650ddc071577b9876461d6389 (diff) | |
Mac OS text input: defined a small API that user-defined text editing widgets can use to signal marked text.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Text_Editor.cxx')
| -rw-r--r-- | src/Fl_Text_Editor.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx index d13fd7139..b580951ae 100644 --- a/src/Fl_Text_Editor.cxx +++ b/src/Fl_Text_Editor.cxx @@ -524,6 +524,16 @@ int Fl_Text_Editor::handle_key() { if (insert_mode()) insert(Fl::event_text()); else overstrike(Fl::event_text()); } +#ifdef __APPLE__ + if (Fl::marked_text_length()) { + int x, y; + int pos = this->insert_position(); + this->buffer()->select(pos - Fl::marked_text_length(), pos); + this->position_to_xy( this->insert_position(), &x, &y); + y += this->textsize(); + Fl::insertion_point_location(x, y); + } +#endif show_insert_position(); set_changed(); if (when()&FL_WHEN_CHANGED) do_callback(); @@ -561,6 +571,13 @@ int Fl_Text_Editor::handle(int event) { case FL_UNFOCUS: show_cursor(mCursorOn); // redraws the cursor +#ifdef __APPLE__ + if (buffer()->selected() && Fl::marked_text_length()) { + int pos = insert_position(); + buffer()->select(pos, pos); + Fl::reset_marked_text(); + } +#endif if (buffer()->selected()) redraw(); // Redraw selections... case FL_HIDE: if (when() & FL_WHEN_RELEASE) maybe_do_callback(); |
