Author: bgbnbigben
Date: 2011-05-15 00:59:01 -0700 (Sun, 15 May 2011)
New Revision: 8663
Log:
Updated the labels in test/keyboard
Fixed one of the problems with STR #1998, where certain UTF8 characters 
wouldn't cause an Input to redraw.


Modified:
   trunk/src/Input.cxx
   trunk/test/keyboard_ui.cxx

Modified: trunk/src/Input.cxx
===================================================================
--- trunk/src/Input.cxx 2011-05-15 06:04:24 UTC (rev 8662)
+++ trunk/src/Input.cxx 2011-05-15 07:59:01 UTC (rev 8663)
@@ -174,6 +174,7 @@
   avoid blinking, not to make draw() less expensive. A few minor attempts
   to make draw() not think about clipped text are implemented, though.
 */
+
 void Input::minimal_update(int p) {
   if (erase_cursor_only == this) erase_cursor_only = 0;
   // Sometimes DAMAGE_ALL is set, but widget not redrawed because it's out of 
clip region.
@@ -1020,7 +1021,13 @@
     int i = 0;
     // find first different character:
     if (text_) {
-      for (; i<size_ && i<len && str[i]==text_[i]; i++);
+      for (; i<size_ && i<len; ){
+        int length, dummy;
+        int strBytes = utf8bytes(str[i]), textBytes = utf8bytes(text_[i]);
+        if(utf8decode(str+i, str+i+strBytes, &length) == utf8decode(text_+i, 
text_+i+textBytes, &dummy))
+          i += length;
+        else break;
+      }
       if (i==size_ && i==len) ret = false;
     }
     if (ret) minimal_update(i);

Modified: trunk/test/keyboard_ui.cxx
===================================================================
--- trunk/test/keyboard_ui.cxx  2011-05-15 06:04:24 UTC (rev 8662)
+++ trunk/test/keyboard_ui.cxx  2011-05-15 07:59:01 UTC (rev 8663)
@@ -13,12 +13,12 @@
     w = o;
     o->shortcut(0xff1b);
     o->begin();
-     {fltk::Output* o = key_output = new fltk::Output(15, 15, 170, 30, 
"Fl::event_key():");
+     {fltk::Output* o = key_output = new fltk::Output(15, 15, 170, 30, 
"fltk::event_key():");
       o->textfont(fltk::COURIER);
       o->labelsize(10);
       o->align(fltk::ALIGN_TOP|fltk::ALIGN_LEFT);
     }
-     {fltk::Output* o = text_output = new fltk::Output(195, 15, 190, 30, 
"Fl::event_text():");
+     {fltk::Output* o = text_output = new fltk::Output(195, 15, 190, 30, 
"fltk::event_text():");
       o->textfont(fltk::COURIER);
       o->labelsize(10);
       o->align(fltk::ALIGN_TOP|fltk::ALIGN_LEFT);

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

Reply via email to