mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Fix #2088: restore automatic exit from visual mode
You can toggle this with the visualexitauto setting.
This commit is contained in:
parent
7510fb32fe
commit
65033343ae
2 changed files with 15 additions and 9 deletions
|
@ -357,15 +357,16 @@ config.getAsync("leavegithubalone").then(v => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
config.getAsync("visualenterauto").then(v => {
|
document.addEventListener("selectionchange", () => {
|
||||||
if (v === "false") return
|
const selection = document.getSelection()
|
||||||
document.addEventListener("selectionchange", () => {
|
if ((contentState.mode == "visual") && (config.get("visualexitauto") == "true") && (selection.anchorOffset == selection.focusOffset)) {
|
||||||
if (contentState.mode !== "normal") return
|
contentState.mode = "normal"
|
||||||
const selection = document.getSelection()
|
return
|
||||||
if (selection.anchorOffset !== selection.focusOffset) {
|
}
|
||||||
contentState.mode = "visual"
|
if ((contentState.mode !== "normal") || (config.get("visualenterauto") == "false")) return
|
||||||
}
|
if (selection.anchorOffset !== selection.focusOffset) {
|
||||||
})
|
contentState.mode = "visual"
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Listen for statistics from each content script and send them to the
|
// Listen for statistics from each content script and send them to the
|
||||||
|
|
|
@ -990,6 +990,11 @@ export class default_config {
|
||||||
* Whether to enter visual mode when text is selected. Visual mode can always be entered with `:mode visual`.
|
* Whether to enter visual mode when text is selected. Visual mode can always be entered with `:mode visual`.
|
||||||
*/
|
*/
|
||||||
visualenterauto: "true" | "false" = "true"
|
visualenterauto: "true" | "false" = "true"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to return to visual mode when text is deselected.
|
||||||
|
*/
|
||||||
|
visualexitauto: "true" | "false" = "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
|
|
Loading…
Add table
Reference in a new issue