mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 21:36:37 +02:00
Fixed display bug with long lines
This commit is contained in:
@@ -247,7 +247,8 @@ gui_chat_draw_title (struct t_gui_buffer *buffer, int erase)
|
||||
int
|
||||
gui_chat_get_real_width (struct t_gui_window *window)
|
||||
{
|
||||
if (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_RIGHT)
|
||||
if (window->buffer->nicklist
|
||||
&& (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_RIGHT))
|
||||
return window->win_chat_width - 1;
|
||||
else
|
||||
return window->win_chat_width;
|
||||
@@ -485,16 +486,16 @@ gui_chat_display_word (struct t_gui_window *window,
|
||||
{
|
||||
num_displayed = gui_chat_get_real_width (window) - window->win_chat_cursor_x;
|
||||
pos_saved_char = gui_chat_string_real_pos (data, num_displayed);
|
||||
saved_char = data[pos_saved_char];
|
||||
data[pos_saved_char] = '\0';
|
||||
if (!simulate)
|
||||
{
|
||||
saved_char = data[pos_saved_char];
|
||||
data[pos_saved_char] = '\0';
|
||||
if ((count == 0) || (*lines_displayed >= num_lines - count))
|
||||
gui_chat_display_word_raw (window, data, 1);
|
||||
else
|
||||
gui_chat_display_word_raw (window, data, 0);
|
||||
data[pos_saved_char] = saved_char;
|
||||
}
|
||||
data[pos_saved_char] = saved_char;
|
||||
data += pos_saved_char;
|
||||
}
|
||||
else
|
||||
|
||||
+10
-7
@@ -115,20 +115,23 @@ gui_chat_strlen_screen (char *string)
|
||||
int
|
||||
gui_chat_string_real_pos (char *string, int pos)
|
||||
{
|
||||
char *real_pos;
|
||||
char *ptr_string, *real_pos;
|
||||
|
||||
if (pos <= 0)
|
||||
return 0;
|
||||
|
||||
real_pos = string;
|
||||
while (string && string[0] && (pos > 0))
|
||||
ptr_string = string;
|
||||
while (ptr_string && ptr_string[0] && (pos >= 0))
|
||||
{
|
||||
string = gui_chat_string_next_char (NULL, (unsigned char *)string, 0);
|
||||
if (string)
|
||||
ptr_string = gui_chat_string_next_char (NULL,
|
||||
(unsigned char *)ptr_string,
|
||||
0);
|
||||
if (ptr_string)
|
||||
{
|
||||
pos -= utf8_char_size_screen (string);
|
||||
string = utf8_next_char (string);
|
||||
real_pos = string;
|
||||
pos -= utf8_char_size_screen (ptr_string);
|
||||
ptr_string = utf8_next_char (ptr_string);
|
||||
real_pos = ptr_string;
|
||||
}
|
||||
}
|
||||
return 0 + (real_pos - string);
|
||||
|
||||
Reference in New Issue
Block a user