shithub: mongrel

Download patch

ref: 2e6cf1acf48e95d9408a6063074666af586bf35e
parent: 608e406ec0d81e33bb6965c0ab6d25d5d12753cf
author: phil9 <telephil9@gmail.com>
date: Fri Feb 4 15:55:59 EST 2022

reset selection and scroll position when setting content of text widget

	this fixes a bug where scrolling in the text widget then selecting another message in the index
	lead to the new message being scrolled or the content not visible if the previous scroll position
	was greater than the new message content.

--- a/text.c
+++ b/text.c
@@ -104,6 +104,9 @@
 void
 textset(Text *t, char *data, usize ndata)
 {
+	t->s0 = -1;
+	t->s1 = -1;
+	t->offset = 0;
 	t->data = data;
 	t->ndata = ndata;
 	computelines(t);