summaryrefslogtreecommitdiff
path: root/src/gui/curses
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-07-28 18:20:13 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-07-28 18:20:13 +0200
commit43029de8f54ecb799de6230ca34d431e6fcb1062 (patch)
treeafb449ea988d3c00bb2dd85e68c013cb2d9c36d2 /src/gui/curses
parent8218151c31d2cf85c8e50cbed31c04c9d25c41cf (diff)
downloadweechat-43029de8f54ecb799de6230ca34d431e6fcb1062.zip
Fix display bug with some weird UTF-8 chars (bugs #19687 and #23943)
Diffstat (limited to 'src/gui/curses')
-rw-r--r--src/gui/curses/gui-curses-bar.c32
-rw-r--r--src/gui/curses/gui-curses-chat.c15
2 files changed, 26 insertions, 21 deletions
diff --git a/src/gui/curses/gui-curses-bar.c b/src/gui/curses/gui-curses-bar.c
index f48af84dc..3d2027480 100644
--- a/src/gui/curses/gui-curses-bar.c
+++ b/src/gui/curses/gui-curses-bar.c
@@ -787,23 +787,25 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
snprintf (utf_char, sizeof (utf_char), ".");
size_on_screen = utf8_char_size_screen (utf_char);
- if (*x + size_on_screen > bar_window->width)
+ if (size_on_screen > 0)
{
- if (CONFIG_INTEGER(gui_bar_get_option_filling (bar_window->bar)) == GUI_BAR_FILLING_VERTICAL)
- return 0;
- if (*y >= bar_window->height - 1)
- return 0;
- *x = 0;
- (*y)++;
- wmove (bar_window->win_bar, *y, *x);
+ if (*x + size_on_screen > bar_window->width)
+ {
+ if (CONFIG_INTEGER(gui_bar_get_option_filling (bar_window->bar)) == GUI_BAR_FILLING_VERTICAL)
+ return 0;
+ if (*y >= bar_window->height - 1)
+ return 0;
+ *x = 0;
+ (*y)++;
+ wmove (bar_window->win_bar, *y, *x);
+ }
+ output = string_iconv_from_internal (NULL, utf_char);
+ wprintw (bar_window->win_bar, "%s",
+ (output) ? output : utf_char);
+ if (output)
+ free (output);
+ *x += size_on_screen;
}
- output = string_iconv_from_internal (NULL, utf_char);
- wprintw (bar_window->win_bar, "%s",
- (output) ? output : utf_char);
- if (output)
- free (output);
-
- *x += size_on_screen;
string = next_char;
}
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index ce6bfb59f..9459c8e47 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -446,18 +446,21 @@ gui_chat_display_word_raw (struct t_gui_window *window, const char *string,
utf_char[next_char - string] = '\0';
if (gui_window_utf_char_valid (utf_char))
{
+ size_on_screen = utf8_strlen_screen (utf_char);
if (max_chars_on_screen > 0)
{
- size_on_screen = utf8_strlen_screen (utf_char);
if (chars_displayed + size_on_screen > max_chars_on_screen)
return;
chars_displayed += size_on_screen;
}
- output = string_iconv_from_internal (NULL, utf_char);
- wprintw (GUI_CURSES(window)->win_chat,
- "%s", (output) ? output : utf_char);
- if (output)
- free (output);
+ if (size_on_screen > 0)
+ {
+ output = string_iconv_from_internal (NULL, utf_char);
+ wprintw (GUI_CURSES(window)->win_chat,
+ "%s", (output) ? output : utf_char);
+ if (output)
+ free (output);
+ }
}
else
{