summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/curses/gui-curses-chat.c9
-rw-r--r--src/gui/gui-chat.c17
2 files changed, 15 insertions, 11 deletions
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index da1663421..1c6ce7f71 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -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
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index 616303acc..412a326a0 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -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);