Compare commits

...

2 Commits

Author SHA1 Message Date
f686edd198 fix gtk predit window 2026-05-29 02:28:49 +09:00
7e69827c13 passthrough unmatched keys 2026-05-28 23:38:23 +09:00
5 changed files with 19 additions and 19 deletions

View File

@@ -158,7 +158,9 @@ getpreedit(GtkIMContext *ctx, gchar **str, PangoAttrList **attrs,
PangoAttribute *u;
im = (Im*)ctx;
if(str)
*str = g_strdup(im->pre);
if(attrs){
*attrs = pango_attr_list_new();
if(im->prelen > 0){
u = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
@@ -166,6 +168,8 @@ getpreedit(GtkIMContext *ctx, gchar **str, PangoAttrList **attrs,
u->end_index = im->prelen;
pango_attr_list_insert(*attrs, u);
}
}
if(cursor_pos)
*cursor_pos = g_utf8_strlen(im->pre, -1);
}

1
ko.c
View File

@@ -203,7 +203,6 @@ transko(Im *im, Rune c)
e.s = im->pre;
sclear(&im->pre);
}
sputr(&e.s, c);
return e;
}

3
run.sh
View File

@@ -1,8 +1,7 @@
#!/bin/sh
cd "$(dirname "$0")"
pkill strans
pkill strans-xim
sleep 1
./strans map font &
sleep 1

View File

@@ -185,10 +185,8 @@ transmap(Im *im, Rune c)
e.s = im->pre;
sclear(&key);
sputr(&key, c);
if(!maplookup(t, &key, &e.dict)){
sputr(&e.s, c);
if(!maplookup(t, &key, &e.dict))
return e;
}
e.eat = 1;
sputr(&e.next, c);
return e;
@@ -273,14 +271,16 @@ keystroke(u32int ks, u32int mod, Str *com)
return 1;
}
if(ks > 0x7f || ks == ' '){
if(im.pre.n == 0)
return 0;
commit(com);
sputr(com, ks);
reset();
return 1;
}
dotrans(ks, com);
n = dotrans(ks, com);
show();
return 1;
return n;
}
static void

4
vi.c
View File

@@ -101,10 +101,8 @@ transvi(Im *im, Rune c)
return transmap(im, c);
memset(&e, 0, sizeof e);
if(im->pre.n == 0){
sputr(&e.s, c);
if(im->pre.n == 0)
return e;
}
if(im->pre.r[im->pre.n - 1] == '\\'){
pre = im->pre;
pre.n--;