Enable markup search hybrid mode (#177542)

* Enable markup search hybrid mode

* Experiment turning all cells into editing mode on replace

* Prepare for minimal find markdown mode

* Add settings for controlling the initial state for find in markdown cells

* Validate initial state
This commit is contained in:
Peng Lyu
2023-04-14 10:48:51 -07:00
committed by GitHub
parent a24f964ea1
commit 76781a1a1b
8 changed files with 90 additions and 25 deletions

View File

@@ -922,7 +922,25 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
}
});
return matches;
// filter based on options and editing state
return matches.filter(match => {
if (match.cell.cellKind === CellKind.Code) {
// code cell, we only include its match if include input is enabled
return options.includeCodeInput;
}
// markup cell, it depends on the editing state
if (match.cell.getEditState() === CellEditState.Editing) {
// editing, even if we includeMarkupPreview
return options.includeMarkupInput;
} else {
// cell in preview mode, we should only include it if includeMarkupPreview is false but includeMarkupInput is true
// if includeMarkupPreview is true, then we should include the webview match result other than this
return !options.includeMarkupPreview && options.includeMarkupInput;
}
}
);
}
replaceOne(cell: ICellViewModel, range: Range, text: string): Promise<void> {