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:
parent
55856707c7
commit
3d3ccd1e11
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue