From 3d3ccd1e11afdc6761af918044486175dd0c573d Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Thu, 1 Oct 2026 15:48:20 +0200 Subject: [PATCH] Align checkbox detection between QML and model The QML list parser required whitespace after the checkbox bracket (\]\s+), so a bare cookie with no trailing text (e.g. "- [X]") was not counted as a checkbox. The model's toggle regex had no such requirement, so the two disagreed on checkbox ordinals and a click could toggle the wrong item. Relax the QML regex to \]\s* so both layers count the same set of checkboxes in the same order. --- ui/qml/OutlineView.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/qml/OutlineView.qml b/ui/qml/OutlineView.qml index e25b08f..383ca1e 100644 --- a/ui/qml/OutlineView.qml +++ b/ui/qml/OutlineView.qml @@ -67,11 +67,11 @@ ListView { // checkbox, and the item text. Returns null for non-list lines. function parseListItem(line) { // Unordered: - / + bullet (indented * also allowed) - let m = line.match(/^(\s*)([-+])\s+(\[([ xX-])\]\s+)?(.*)$/); + let m = line.match(/^(\s*)([-+])\s+(\[([ xX-])\]\s*)?(.*)$/); let ordered = false; if (!m) { // Ordered: 1. or 1) - m = line.match(/^(\s*)(\d+)[.)]\s+(\[([ xX-])\]\s+)?(.*)$/); + m = line.match(/^(\s*)(\d+)[.)]\s+(\[([ xX-])\]\s*)?(.*)$/); if (!m) return null; ordered = true; }