commit 5c1248701363874eadb48c5d6344ed0056186688
parent 85e429f9ffab1451104d5aa92fd4adc40d84865a
Author: lumidify <nobody@lumidify.org>
Date: Mon, 16 May 2022 13:57:10 +0200
Fix crash when moving cursor under certain conditions
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/view.c b/view.c
@@ -1047,9 +1047,8 @@ set_pango_text_and_highlight(ledit_view *view, size_t line) {
err_overflow();
pango_layout_set_text(cl->layout, ll->text, (int)ll->len);
set_line_layout_attrs(view, line, cl->layout);
- /* FIXME: is this guard necessary? */
- vl->softlines = ll->len > 0 ? pango_layout_get_line_count(cl->layout) : 1;
pango_layout_set_width(cl->layout, vl->w * PANGO_SCALE);
+ vl->softlines = pango_layout_get_line_count(cl->layout);
int w, h;
pango_layout_get_pixel_size(cl->layout, &w, &h);
if (h != vl->h) {