fix gtk predit window

This commit is contained in:
2026-05-29 02:28:49 +09:00
parent 7e69827c13
commit f686edd198
2 changed files with 13 additions and 10 deletions

View File

@@ -158,15 +158,19 @@ getpreedit(GtkIMContext *ctx, gchar **str, PangoAttrList **attrs,
PangoAttribute *u; PangoAttribute *u;
im = (Im*)ctx; im = (Im*)ctx;
*str = g_strdup(im->pre); if(str)
*attrs = pango_attr_list_new(); *str = g_strdup(im->pre);
if(im->prelen > 0){ if(attrs){
u = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); *attrs = pango_attr_list_new();
u->start_index = 0; if(im->prelen > 0){
u->end_index = im->prelen; u = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
pango_attr_list_insert(*attrs, u); u->start_index = 0;
u->end_index = im->prelen;
pango_attr_list_insert(*attrs, u);
}
} }
*cursor_pos = g_utf8_strlen(im->pre, -1); if(cursor_pos)
*cursor_pos = g_utf8_strlen(im->pre, -1);
} }
static void static void

3
run.sh
View File

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