Author: spitzak
Date: 2008-11-09 15:35:19 -0800 (Sun, 09 Nov 2008)
New Revision: 6508
Log:
Minimal changes to TextEditor to fix backspace + delete of UTF-8.
This is a STR but we should not close that until there are more tests.


Modified:
   trunk/src/TextEditor.cxx

Modified: trunk/src/TextEditor.cxx
===================================================================
--- trunk/src/TextEditor.cxx    2008-11-09 22:05:48 UTC (rev 6507)
+++ trunk/src/TextEditor.cxx    2008-11-09 23:35:19 UTC (rev 6508)
@@ -202,8 +202,9 @@
 }
 
 int TextEditor::kf_backspace(int, TextEditor* e) {
+  int oldpos = e->insert_position();
   if (!e->buffer()->selected() && e->move_left())
-    e->buffer()->select(e->insert_position(), e->insert_position()+1);
+    e->buffer()->select(e->insert_position(), oldpos);
   kill_selection(e);
   e->show_insert_position();
   e->maybe_do_callback();
@@ -343,8 +344,9 @@
 }
 
 int TextEditor::kf_delete(int, TextEditor* e) {
-  if (!e->buffer()->selected())
-    e->buffer()->select(e->insert_position(), e->insert_position()+1);
+  int oldpos = e->insert_position();
+  if (!e->buffer()->selected() && e->move_right())
+    e->buffer()->select(oldpos, e->insert_position());
   kill_selection(e);
   e->show_insert_position();
   e->maybe_do_callback();

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

Reply via email to