]> uap-core.de Git - note.git/commitdiff
fix get_prev_list setting remove_offset even when no list was found main
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 16 Feb 2026 18:07:04 +0000 (19:07 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 16 Feb 2026 18:07:04 +0000 (19:07 +0100)
application/gtk-text.c

index 2d0a081d5fe62ee69626ad8e73d3cd91b382105c..4be682b1131c27b3bb0fc2454b3a690942af9890 100644 (file)
@@ -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;
 }