summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorRodri <rodri@users.noreply.github.com>2017-02-11 16:44:50 +0100
committerTingPing <tingping@tingping.se>2018-01-18 15:07:14 -0500
commit4a228d1efed20f1697f4c1fcfa3b37f77f4f7139 (patch)
tree192d2caf8751f3b308e930c6a958adf9171293aa /src/fe-gtk
parentee8926503c8f451ffbdb00760388e17edde343cb (diff)
This patch hopefully solves a bug that causes that when a tab (channel or private) is left with the scrollbar at the bottom, and some new text arrives, and then we select again that tab, sometimes the scrollbar is not completely down and there is hidden text and we have to scroll manually to the bottom to show all text.
This was previously submitted as an issue in: https://github.com/hexchat/hexchat/issues/1948
Maybe it isn't the ideal way to solve it, but at least I tested it and it seems to work.
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/xtext.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c
index 6151f5b6..6691277e 100644
--- a/src/fe-gtk/xtext.c
+++ b/src/fe-gtk/xtext.c
@@ -4964,6 +4964,14 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
 	dontscroll (buf);	/* force scrolling off */
 	xtext->adj->value = buf->old_value;
 	xtext->adj->upper = buf->num_lines;
+
+	/* if the scrollbar was down, keep it down */
+	if (xtext->buffer->scrollbar_down && xtext->adj->value <
+		xtext->adj->upper - xtext->adj->page_size)
+	{
+		xtext->adj->value = xtext->adj->upper - xtext->adj->page_size;
+	}
+
 	if (xtext->adj->upper == 0)
 		xtext->adj->upper = 1;
 	/* sanity check */