summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fe-common/core/formats.c2
-rw-r--r--src/fe-text/gui-entry.c6
-rw-r--r--src/fe-text/term-terminfo.c2
-rw-r--r--src/fe-text/textbuffer-view.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c
index 8fba8db5..93ee6211 100644
--- a/src/fe-common/core/formats.c
+++ b/src/fe-common/core/formats.c
@@ -306,7 +306,7 @@ static int advance (char const **str, gboolean utf8)
c = g_utf8_get_char(*str);
*str = g_utf8_next_char(*str);
- return mk_wcwidth(c);
+ return unichar_isprint(c) ? mk_wcwidth(c) : 1;
} else {
*str += 1;
diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c
index e44975c1..e0b1e8e0 100644
--- a/src/fe-text/gui-entry.c
+++ b/src/fe-text/gui-entry.c
@@ -166,7 +166,7 @@ static int pos2scrpos(GUI_ENTRY_REC *entry, int pos)
if (term_type == TERM_TYPE_BIG5)
xpos += big5_width(*p);
else if (entry->utf8)
- xpos += mk_wcwidth(*p);
+ xpos += unichar_isprint(*p) ? mk_wcwidth(*p) : 1;
else
xpos++;
}
@@ -183,7 +183,7 @@ static int scrpos2pos(GUI_ENTRY_REC *entry, int pos)
if (term_type == TERM_TYPE_BIG5)
width = big5_width(*p);
else if (entry->utf8)
- width = mk_wcwidth(*p);
+ width = unichar_isprint(*p) ? mk_wcwidth(*p) : 1;
else
width = 1;
@@ -248,7 +248,7 @@ static void gui_entry_draw_from(GUI_ENTRY_REC *entry, int pos)
else if (term_type == TERM_TYPE_BIG5)
xpos += big5_width(*p);
else if (entry->utf8)
- xpos += mk_wcwidth(*p);
+ xpos += unichar_isprint(*p) ? mk_wcwidth(*p) : 1;
else
xpos++;
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index 29a219b6..f2e552f3 100644
--- a/src/fe-text/term-terminfo.c
+++ b/src/fe-text/term-terminfo.c
@@ -425,7 +425,7 @@ void term_add_unichar(TERM_WINDOW *window, unichar chr)
switch (term_type) {
case TERM_TYPE_UTF8:
- term_printed_text(mk_wcwidth(chr));
+ term_printed_text(unichar_isprint(chr) ? mk_wcwidth(chr) : 1);
term_addch_utf8(window, chr);
break;
case TERM_TYPE_BIG5:
diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c
index 9c5f793e..8126898b 100644
--- a/src/fe-text/textbuffer-view.c
+++ b/src/fe-text/textbuffer-view.c
@@ -218,7 +218,7 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
if (get_utf8_char(&next_ptr, char_len, &chr) < 0)
char_len = 1;
else
- char_len = mk_wcwidth(chr);
+ char_len = unichar_isprint(chr) ? mk_wcwidth(chr) : 1;
next_ptr++;
}
@@ -439,7 +439,7 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
if (get_utf8_char(&end, 6, &chr)<0)
char_width = 1;
else
- char_width = mk_wcwidth(chr);
+ char_width = unichar_isprint(chr) ? mk_wcwidth(chr) : 1;
} else {
if (term_type == TERM_TYPE_BIG5 &&
is_big5(end[0], end[1]))