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.
This commit is contained in:
Levi Neely 2026-10-01 15:48:20 +02:00
parent 55856707c7
commit 3d3ccd1e11
1 changed files with 2 additions and 2 deletions

View File

@ -67,11 +67,11 @@ ListView {
// checkbox, and the item text. Returns null for non-list lines. // checkbox, and the item text. Returns null for non-list lines.
function parseListItem(line) { function parseListItem(line) {
// Unordered: - / + bullet (indented * also allowed) // Unordered: - / + bullet (indented * also allowed)
let m = line.match(/^(\s*)([-+])\s+(\[([ xX-])\]\s+)?(.*)$/); let m = line.match(/^(\s*)([-+])\s+(\[([ xX-])\]\s*)?(.*)$/);
let ordered = false; let ordered = false;
if (!m) { if (!m) {
// Ordered: 1. or 1) // Ordered: 1. or 1)
m = line.match(/^(\s*)(\d+)[.)]\s+(\[([ xX-])\]\s+)?(.*)$/); m = line.match(/^(\s*)(\d+)[.)]\s+(\[([ xX-])\]\s*)?(.*)$/);
if (!m) return null; if (!m) return null;
ordered = true; ordered = true;
} }