summaryrefslogtreecommitdiff
path: root/weechat/src/common/history.c
diff options
context:
space:
mode:
Diffstat (limited to 'weechat/src/common/history.c')
-rw-r--r--weechat/src/common/history.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/weechat/src/common/history.c b/weechat/src/common/history.c
index f7aeae403..db61276f7 100644
--- a/weechat/src/common/history.c
+++ b/weechat/src/common/history.c
@@ -99,6 +99,8 @@ history_buffer_add (void *buffer, char *string)
&& (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
{
ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history;
+ if (((t_gui_buffer *)buffer)->ptr_history == ((t_gui_buffer *)buffer)->last_history)
+ ((t_gui_buffer *)buffer)->ptr_history = ptr_history;
((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL;
if (((t_gui_buffer *)buffer)->last_history->text)
free (((t_gui_buffer *)buffer)->last_history->text);
@@ -144,6 +146,8 @@ history_global_add (char *string)
&& (num_history_global > cfg_history_max_commands))
{
ptr_history = history_global_last->prev_history;
+ if (history_global_ptr == history_global_last)
+ history_global_ptr = ptr_history;
history_global_last->prev_history->next_history = NULL;
if (history_global_last->text)
free (history_global_last->text);