From d319084bc4bffa4839eceb3b7b738bea00a13424 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Mon, 16 Feb 2026 19:07:04 +0100 Subject: [PATCH] fix get_prev_list setting remove_offset even when no list was found --- application/gtk-text.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/application/gtk-text.c b/application/gtk-text.c index 2d0a081..4be682b 100644 --- a/application/gtk-text.c +++ b/application/gtk-text.c @@ -305,7 +305,6 @@ static int get_prev_list(GtkTextBuffer *buffer, const GtkTextIter *iter, int *de int list_depth = 0; int list_style = 0; int list_num = 0; - int remove_list_off = -1; GtkTextIter iter2 = *iter; GtkTextChildAnchor *anchor = NULL; @@ -337,18 +336,17 @@ static int get_prev_list(GtkTextBuffer *buffer, const GtkTextIter *iter, int *de chars_per_line++; } - if(chars_per_line == 1) { - // empty list element -> inserting a newline terminates the list - list_depth = 0; - *remove_offset = off + 1; - } - if(list_depth > 0) { - *depth = list_depth; - *style = list_style; - *num = list_num; - *remove_offset = -1; - return 1; + if(chars_per_line == 1) { + list_depth = 0; + *remove_offset = off + 1; + } else { + *depth = list_depth; + *style = list_style; + *num = list_num; + *remove_offset = -1; + return 1; + } } return 0; } -- 2.47.3