diff --git a/README.md b/README.md index 6222e558..076d94d2 100644 --- a/README.md +++ b/README.md @@ -150,4 +150,13 @@ More details in [Getting Started](docs/getting_started.md) - finish/revise using string as parameter type for wasm functions (see createWasmWrapper, createHostWrapper) - fix potential issues because of loading order when loading test-language and test-language-playground +## Vim Keybindings +- Repeat f/t motions with ,/; +- Repeat insert mode commands with . +- Macros +- Search/Replace +- Visual line mode +- More text objects + + [Test report](https://nimaoth.github.io/Absytree/testresults.html) diff --git a/config/absytree_config_wasm.wasm b/config/absytree_config_wasm.wasm index 19db96c5..6f961be0 100755 Binary files a/config/absytree_config_wasm.wasm and b/config/absytree_config_wasm.wasm differ diff --git a/config/keybindings_vim.nim b/config/keybindings_vim.nim index ce44df56..34a46001 100644 --- a/config/keybindings_vim.nim +++ b/config/keybindings_vim.nim @@ -485,7 +485,6 @@ proc loadVimKeybindings*() {.scriptActionWasmNims("load-vim-keybindings").} = addSubCommand "", "move", "^", "vim-move-first", "line-no-indent" addSubCommandWithCount "", "move", "$", vimMoveToEndOfLine - addSubCommandWithCount "", "move", "", vimMoveToEndOfLine addSubCommandWithCount "", "move", "", vimMoveToEndOfLine addSubCommand "", "move", "g0", "vim-move-first", "line" diff --git a/src/input.nim b/src/input.nim index 3f382517..de9a3d6a 100644 --- a/src/input.nim +++ b/src/input.nim @@ -662,15 +662,19 @@ proc handleNextInput( let rune = Rune(key.inputCodes.a) let rune2 = Rune(key.inputCodes.b) let bIsLower = rune.isLower - if not bIsLower and rune.isUpper: + if not bIsLower: # echo "| ".repeat(depth) & &" link state {currentState} to {nextState} for {rune.toLower} and {rune.toUpper}" - discard linkStates(dfa, currentState, nextState, rune.toLower.int64..rune2.toLower.int64, key.mods + {Shift}, functionIndex, capture) - discard linkStates(dfa, currentState, nextState, key.inputCodes, key.mods + {Shift}, functionIndex, capture) + if not linkStates(dfa, currentState, nextState, rune.toLower.int64..rune2.toLower.int64, key.mods + {Shift}, functionIndex, capture): + log lvlError, fmt"""Ambigious keybinding '{input.join("")}' at {index} ({inputToString(key.inputCodes, key.mods)})""" + if not linkStates(dfa, currentState, nextState, key.inputCodes, key.mods + {Shift}, functionIndex, capture): + log lvlError, fmt"""Ambigious keybinding '{input.join("")}' at {index} ({inputToString(key.inputCodes, key.mods)})""" if bIsLower and Shift in key.mods: # echo "| ".repeat(depth) & &" link state {currentState} to {nextState} for {rune.toLower} and {rune.toUpper}" - discard linkStates(dfa, currentState, nextState, rune.toUpper.int64..rune2.toUpper.int64, key.mods - {Shift}, functionIndex, capture) - discard linkStates(dfa, currentState, nextState, rune.toUpper.int64..rune2.toUpper.int64, key.mods, functionIndex, capture) + if not linkStates(dfa, currentState, nextState, rune.toUpper.int64..rune2.toUpper.int64, key.mods - {Shift}, functionIndex, capture): + log lvlError, fmt"""Ambigious keybinding '{input.join("")}' at {index} ({inputToString(key.inputCodes, key.mods)})""" + if not linkStates(dfa, currentState, nextState, rune.toUpper.int64..rune2.toUpper.int64, key.mods, functionIndex, capture): + log lvlError, fmt"""Ambigious keybinding '{input.join("")}' at {index} ({inputToString(key.inputCodes, key.mods)})""" nextState diff --git a/tests/unit/input/tinput.nim b/tests/unit/input/tinput.nim index b70b0b40..364afa29 100644 --- a/tests/unit/input/tinput.nim +++ b/tests/unit/input/tinput.nim @@ -113,3 +113,10 @@ suite "Input DFA": commands.add ("aB", "success") var dfa = buildDFA(commands, @[""]) check dfa.stepString("aB") == "success" + + test "": + var commands: seq[(string, string)] = @[] + commands.add ("", "success") + var dfa = buildDFA(commands, @[""]) + writeFile("dfa2.dot", dfa.dumpGraphViz()) + check dfa.stepString("") == "success"