Author: greg.ercolano
Date: 2009-09-20 12:24:24 -0700 (Sun, 20 Sep 2009)
New Revision: 6893
Log:
Fixes STR #2169: Adds missing cursor movement to OSX:
CLOVERLEAF-LEFT move cursor to beginning of line,
CLOVERLEAF-RIGHT move cursor to end of line,
CLOVERLEAF-UP move to top line
CLOVERLEAD-DOWN move to end line
..and SHIFT combos with those will do a 'text selection'
equivalents.
Modified:
branches/branch-1.3/FL/Fl_Text_Editor.H
branches/branch-1.3/src/Fl_Text_Editor.cxx
Modified: branches/branch-1.3/FL/Fl_Text_Editor.H
===================================================================
--- branches/branch-1.3/FL/Fl_Text_Editor.H 2009-09-20 17:25:25 UTC (rev
6892)
+++ branches/branch-1.3/FL/Fl_Text_Editor.H 2009-09-20 19:24:24 UTC (rev
6893)
@@ -103,6 +103,8 @@
static int kf_shift_move(int c, Fl_Text_Editor* e);
static int kf_ctrl_move(int c, Fl_Text_Editor* e);
static int kf_c_s_move(int c, Fl_Text_Editor* e);
+ static int kf_meta_move(int c, Fl_Text_Editor* e);
+ static int kf_m_s_move(int c, Fl_Text_Editor* e);
static int kf_home(int, Fl_Text_Editor* e);
static int kf_end(int c, Fl_Text_Editor* e);
static int kf_left(int c, Fl_Text_Editor* e);
Modified: branches/branch-1.3/src/Fl_Text_Editor.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Editor.cxx 2009-09-20 17:25:25 UTC (rev
6892)
+++ branches/branch-1.3/src/Fl_Text_Editor.cxx 2009-09-20 19:24:24 UTC (rev
6893)
@@ -156,6 +156,14 @@
{ 'c', FL_COMMAND, Fl_Text_Editor::kf_copy },
{ 'v', FL_COMMAND, Fl_Text_Editor::kf_paste },
{ 'a', FL_COMMAND, Fl_Text_Editor::kf_select_all },
+ { FL_Left, FL_COMMAND, Fl_Text_Editor::kf_meta_move },
+ { FL_Right, FL_COMMAND, Fl_Text_Editor::kf_meta_move },
+ { FL_Up, FL_COMMAND, Fl_Text_Editor::kf_meta_move },
+ { FL_Down, FL_COMMAND, Fl_Text_Editor::kf_meta_move },
+ { FL_Left, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move },
+ { FL_Right, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move },
+ { FL_Up, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move },
+ { FL_Down, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move },
#endif // __APPLE__
{ 0, 0, 0 }
@@ -352,6 +360,40 @@
return 1;
}
+/** Moves the current text cursor in the direction indicated by meta key */
+int Fl_Text_Editor::kf_meta_move(int c, Fl_Text_Editor* e) {
+ if (!e->buffer()->selected())
+ e->dragPos = e->insert_position();
+ if (c != FL_Up && c != FL_Down) {
+ e->buffer()->unselect();
+ e->show_insert_position();
+ }
+ switch (c) {
+ case FL_Up: // top of buffer
+ e->insert_position(0);
+ e->scroll(0, 0);
+ break;
+ case FL_Down: // end of buffer
+ e->insert_position(e->buffer()->length());
+ e->scroll(e->count_lines(0, e->buffer()->length(), 1), 0);
+ break;
+ case FL_Left: // beginning of line
+ e->insert_position(e->buffer()->line_start(e->insert_position()));
+ break;
+ case FL_Right: // end of line
+ e->insert_position(e->buffer()->line_end(e->insert_position()));
+ break;
+ }
+ return 1;
+}
+
+/** Extends the current selection in the direction indicated by meta key c. */
+int Fl_Text_Editor::kf_m_s_move(int c, Fl_Text_Editor* e) {
+ kf_meta_move(c, e);
+ fl_text_drag_me(e->insert_position(), e);
+ return 1;
+}
+
/** Extends the current selection in the direction indicated by control key c.
*/
int Fl_Text_Editor::kf_c_s_move(int c, Fl_Text_Editor* e) {
kf_ctrl_move(c, e);
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit