mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 16:42:30 +02:00
BIG5 stuff is used only if term_type is big5
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3135 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
7eb2fc70e3
commit
b2d07ffd1d
3 changed files with 13 additions and 21 deletions
|
|
@ -76,6 +76,9 @@ static int _fix_big5_pos(unichar *p, int pos, int direct)
|
||||||
{
|
{
|
||||||
int newpos;
|
int newpos;
|
||||||
|
|
||||||
|
if (term_type != TERM_TYPE_BIG5)
|
||||||
|
return pos;
|
||||||
|
|
||||||
for (newpos = 0; newpos < pos && p[newpos] != 0; ) {
|
for (newpos = 0; newpos < pos && p[newpos] != 0; ) {
|
||||||
if (is_big5(p[newpos], p[newpos+1]))
|
if (is_big5(p[newpos], p[newpos+1]))
|
||||||
newpos += 2;
|
newpos += 2;
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,6 @@ static KEYBOARD_REC *keyboard;
|
||||||
static ENTRY_REDIRECT_REC *redir;
|
static ENTRY_REDIRECT_REC *redir;
|
||||||
static int escape_next_key;
|
static int escape_next_key;
|
||||||
|
|
||||||
static int big5high = FALSE;
|
|
||||||
static unichar prekey = '\0';
|
|
||||||
|
|
||||||
|
|
||||||
static int readtag;
|
static int readtag;
|
||||||
static time_t idle_time;
|
static time_t idle_time;
|
||||||
|
|
||||||
|
|
@ -152,20 +148,6 @@ static void sig_gui_key_pressed(gpointer keyp)
|
||||||
|
|
||||||
idle_time = time(NULL);
|
idle_time = time(NULL);
|
||||||
|
|
||||||
if (big5high || is_big5_hi(key)) {
|
|
||||||
if (big5high) {
|
|
||||||
big5high = FALSE;
|
|
||||||
str[0] = prekey;
|
|
||||||
str[1] = key;
|
|
||||||
str[2] = '\0';
|
|
||||||
gui_entry_insert_text(active_entry, str);
|
|
||||||
} else {
|
|
||||||
big5high = TRUE;
|
|
||||||
prekey = key;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key < 32) {
|
if (key < 32) {
|
||||||
/* control key */
|
/* control key */
|
||||||
str[0] = '^';
|
str[0] = '^';
|
||||||
|
|
@ -176,8 +158,14 @@ static void sig_gui_key_pressed(gpointer keyp)
|
||||||
str[1] = '?';
|
str[1] = '?';
|
||||||
str[2] = '\0';
|
str[2] = '\0';
|
||||||
} else if (!active_entry->utf8) {
|
} else if (!active_entry->utf8) {
|
||||||
str[0] = (char)key;
|
if (key <= 0xff) {
|
||||||
str[1] = '\0';
|
str[0] = (char)key;
|
||||||
|
str[1] = '\0';
|
||||||
|
} else {
|
||||||
|
str[0] = (char) (key >> 8);
|
||||||
|
str[1] = (char) (key & 0xff);
|
||||||
|
str[2] = '\0';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* need to convert to utf8 */
|
/* need to convert to utf8 */
|
||||||
str[utf16_char_to_utf8(key, str)] = '\0';
|
str[utf16_char_to_utf8(key, str)] = '\0';
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,8 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
|
||||||
|
|
||||||
if (!view->utf8) {
|
if (!view->utf8) {
|
||||||
/* MH */
|
/* MH */
|
||||||
if (ptr[1] == '\0' || !is_big5(ptr[0], ptr[1]))
|
if (term_type != TERM_TYPE_BIG5 ||
|
||||||
|
ptr[1] == '\0' || !is_big5(ptr[0], ptr[1]))
|
||||||
char_len = 1;
|
char_len = 1;
|
||||||
else
|
else
|
||||||
char_len = 2;
|
char_len = 2;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue