From cc134464a40cf07f4a92627504a471e4698d6478 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 29 Mar 2024 10:31:23 +0200 Subject: [PATCH] fix: client: vim: space --- client/key/vim/vim.js | 5 ++++- client/key/vim/vim.spec.js | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/client/key/vim/vim.js b/client/key/vim/vim.js index ef454442..99fe2acf 100644 --- a/client/key/vim/vim.js +++ b/client/key/vim/vim.js @@ -21,7 +21,7 @@ const rmFirst = (a) => { const noop = () => {}; -module.exports = (key, operations) => { +module.exports = (key, operations = {}) => { const prevStore = store(); const isVisual = visual(); const value = store(prevStore.concat(key)); @@ -169,6 +169,9 @@ module.exports = (key, operations) => { findPrevious(); return end(); } + + if (key === ' ') + return end(); }; function handleDelete(prevStore) { diff --git a/client/key/vim/vim.spec.js b/client/key/vim/vim.spec.js index d0213369..f4ea0683 100644 --- a/client/key/vim/vim.spec.js +++ b/client/key/vim/vim.spec.js @@ -11,6 +11,24 @@ test('vim: no operations', (t) => { t.end(); }); +test('vim: space', (t) => { + const moveNext = stub(); + + vim(' '); + vim('j', { + moveNext, + }); + + const args = [{ + count: 1, + isDelete: false, + isVisual: false, + }]; + + t.calledWith(moveNext, args); + t.end(); +}); + test('vim: ^', (t) => { const movePrevious = stub();