Changeset 47519e1b for owl.c


Ignore:
Timestamp:
Jan 2, 2008, 2:42:05 AM (13 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
c60ade2
Parents:
2febcae
Message:
text entry:
* first pass at utf-8 text entry. This is not yet complete, and it certainly has bugs.
  The following is an incomplete list of functions that will probably misbehave if you use them.
  - owl_editwin_move_to_nextword()
  - owl_editwin_move_to_previousword()
  - owl_editwin_delete_nextword()
  - owl_editwin_delete_previousword()
  - owl_editwin_delete_to_endofline()
  - owl_editwin_fill_paragraph()

format text:
* owl_fmtext_curs_waddstr() contract restored to match trunk.
* owl_fmtext_curs_waddstr_without_search() added.

misc:
* Importing Markus Kuhn's wcwidth.c from
  http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
* Change wcwidth() calls to mk_wcwidth()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r5bc0f68 r47519e1b  
    7070  owl_editwin *tw;
    7171  owl_popwin *pw;
    72   int j, ret, initialsubs, debug, argcsave, followlast;
     72  int ret, initialsubs, debug, argcsave, followlast;
     73  gunichar j;
    7374  int newmsgs, nexttimediff;
    7475  struct sigaction sigact;
     
    546547      usleep(10000);
    547548    } else {
     549      /* Pull in a full utf-8 character. */
     550      if (j & 0x80) {
     551        char utf8buf[7];
     552        int bytes, i;
     553        memset(utf8buf,'\0',7);
     554        utf8buf[0] = j;
     555
     556        if (~j & 0x20) bytes = 2;
     557        else if (~j & 0x10) bytes = 3;
     558        else if (~j & 0x08) bytes = 4;
     559        else if (~j & 0x04) bytes = 5;
     560        else if (~j & 0x02) bytes = 6;
     561        else bytes = 1; /* This won't validate */
     562
     563        for (i = 1; i < bytes; i++) {
     564          utf8buf[i] = wgetch(typwin);
     565        }
     566        if (g_utf8_validate(utf8buf, -1, NULL)) {
     567          j = g_utf8_get_char(utf8buf);
     568        }
     569        else {
     570          j = ERR;
     571        }
     572      }
    548573      owl_global_update_lastinputtime(&g);
    549574      /* find and activate the current keymap.
Note: See TracChangeset for help on using the changeset viewer.