mirror of
https://github.com/groldsf/obsidian_check_plugin.git
synced 2026-07-22 05:37:48 +00:00
fix infinite loop with tasks plugin
This commit is contained in:
parent
235f1cb942
commit
b685655e51
1 changed files with 9 additions and 5 deletions
|
|
@ -54,7 +54,9 @@ export class CheckboxLine extends AbstractLine {
|
|||
|
||||
private static getNewCheckboxLineFromTasksApi(api: any, checkboxLine: CheckboxLine, targetState: CheckboxState): CheckboxLine | null {
|
||||
let line: CheckboxLine | null = checkboxLine;
|
||||
const startChar = checkboxLine.checkChar;
|
||||
const seenChars = new Set<string>();
|
||||
seenChars.add(checkboxLine.checkChar);
|
||||
|
||||
while (true) {
|
||||
const textLine = line.toResultText();
|
||||
const newTextLine = api.executeToggleTaskDoneCommand(textLine, null);
|
||||
|
|
@ -65,9 +67,11 @@ export class CheckboxLine extends AbstractLine {
|
|||
if (newBox.checkboxState === targetState) {
|
||||
return newBox;
|
||||
}
|
||||
if (newBox.checkChar === startChar){
|
||||
if (seenChars.has(newBox.checkChar)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
seenChars.add(newBox.checkChar);
|
||||
line = newBox;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue