diff options
| -rw-r--r-- | lua/clever_f/motion_executor.lua | 18 | ||||
| -rw-r--r-- | tests/run.lua | 16 |
2 files changed, 34 insertions, 0 deletions
diff --git a/lua/clever_f/motion_executor.lua b/lua/clever_f/motion_executor.lua new file mode 100644 index 0000000..198534b --- /dev/null +++ b/lua/clever_f/motion_executor.lua @@ -0,0 +1,18 @@ +local domain = require("clever_f.domain") + +local M = {} + +M.ExecutionPath = { + VISUAL = "visual", + COMMAND = "command", +} + +function M.execution_path(context) + context = domain.ModeContext.from_full_mode(context) + if context.visual_kind ~= nil then + return M.ExecutionPath.VISUAL + end + return nil +end + +return M diff --git a/tests/run.lua b/tests/run.lua index d24f3f0..8eeef32 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -13,6 +13,7 @@ local case_policy = require("clever_f.case_policy") local policy = require("clever_f.policy") local migemo_catalog = require("clever_f.migemo_catalog") local motion_plan = require("clever_f.motion_plan") +local motion_executor = require("clever_f.motion_executor") local sequence_state = require("clever_f.sequence_state") local state_transitions = require("clever_f.state_transitions") local text_topology = require("clever_f.text_topology") @@ -3106,6 +3107,21 @@ test("DestinationEngine leaves cursor and sequence state unchanged", function() same(origin, host:read_cursor()) end) +test("Motion execution routes every Visual kind to the Visual path", function() + local visual_modes = { + "v", + "V", + string.char(0x16), + } + for _, mode in ipairs(visual_modes) do + same( + motion_executor.ExecutionPath.VISUAL, + motion_executor.execution_path(mode), + mode + ) + end +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
