/[adonthell]/adonthell-0.3/src/label_input.cc
ViewVC logotype

Diff of /adonthell-0.3/src/label_input.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by ksterker, Mon Oct 25 06:55:01 2004 UTC revision 1.14 by ksterker, Mon Dec 13 08:56:58 2004 UTC
# Line 39  bool label_input::input_update() Line 39  bool label_input::input_update()
39    
40      while ((c = input::get_next_unicode ()) > 0)      while ((c = input::get_next_unicode ()) > 0)
41      {      {
42          cursor_undraw ();          cursor_undraw ();
43          if (c == SDLK_BACKSPACE || c == SDLK_DELETE)          if (c == SDLK_BACKSPACE || c == SDLK_DELETE)
44          {                      {            
45              if (my_text_.empty () || my_cursor_.idx == 0) return true;              if (my_text_.empty () || my_cursor_.idx == 0) return true;
46                            
47              // possibly delete multi-byte utf-8 char              // possibly delete multi-byte utf-8 char
48              if (my_cursor_.idx > 2 && (u_int8) my_text_[my_cursor_.idx-2] >= 0xE0) count = 3;              if (my_cursor_.idx > 2 && (u_int8) my_text_[my_cursor_.idx-3] == 0xEF) count = 3;
49              else if (my_cursor_.idx > 1 && (u_int8) my_text_[my_cursor_.idx-1] >= 0x80) count = 2;              else if (my_cursor_.idx > 1 && (u_int8) my_text_[my_cursor_.idx-2] == 0xC3) count = 2;
50              else count = 1;              else count = 1;
51                            
52              my_cursor_.idx -= count;              my_cursor_.idx -= count;
53                u_int16 idx = my_cursor_.idx;
54                u_int16 glyph = ucd (idx);
55              my_text_.erase (my_cursor_.idx, count);              my_text_.erase (my_cursor_.idx, count);
56    
57              update_cursor ();              update_cursor ();
58              my_old_cursor_ = my_cursor_;              my_old_cursor_ = my_cursor_;
59    
60              lock ();              lock ();
61              fillrect (my_cursor_.pos_x, my_cursor_.pos_y,              fillrect (my_cursor_.pos_x, my_cursor_.pos_y,
62                        (*my_font_) [ucd(my_cursor_.idx)].length (),                        (*my_font_) [glyph].length (),
63                        my_font_->height (), screen::trans_col ());                        my_font_->height (), screen::trans_col ());
64              unlock ();              unlock ();
65                            

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26