mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Simplify conditions for entering visual mode
1. You can only enter visual mode from normal mode 2. Must select text to enter visual mode 3. Exit visual mode with escape, etc. This fixes #2073.
This commit is contained in:
parent
4f40438246
commit
db61f979a6
1 changed files with 2 additions and 4 deletions
|
@ -356,11 +356,9 @@ config.getAsync("leavegithubalone").then(v => {
|
|||
})
|
||||
|
||||
document.addEventListener("selectionchange", () => {
|
||||
if (contentState.mode == "ignore") return
|
||||
if (contentState.mode !== "normal") return
|
||||
const selection = document.getSelection()
|
||||
if (selection.anchorOffset == selection.focusOffset) {
|
||||
contentState.mode = "normal"
|
||||
} else {
|
||||
if (selection.anchorOffset !== selection.focusOffset) {
|
||||
contentState.mode = "visual"
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue