summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 2595224..393d51a 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -3500,6 +3500,43 @@ test("Visual execution preserves command direction and feedback anchor", functio
same(domain.Position.new(2, 1), state:get_previous_landing("v"))
end)
+test("Forward operator motions toggle characterwise inclusivity", function()
+ for _, descriptor in ipairs({ "f", "t" }) do
+ fresh_sequence_state()
+ local host = MemoryHost.new({
+ buffer_lines = { "hoge fuge" },
+ cursor = { line = 1, byte_column = 1 },
+ mode = "no",
+ pending_operator = "delete",
+ })
+ local plan = motion_plan.build(
+ target_plan.build(target("e"), matching_policy()),
+ descriptor
+ )
+ local view = text_topology.from_host(host)
+ host:clear_operations()
+ local outcome = motion_executor.new(host):execute(
+ view,
+ "no",
+ plan,
+ 1,
+ true
+ )
+
+ same(domain.ActionKind.MOVEMENT, outcome.kind, descriptor)
+ truthy(host:operator_inclusive(), descriptor)
+ local effect_operations = {}
+ for _, operation in ipairs(host:operations()) do
+ if operation.operation == "set_operator_inclusive"
+ or operation.operation == "apply_cursor"
+ then
+ effect_operations[#effect_operations + 1] = operation.operation
+ end
+ end
+ list_same({ "set_operator_inclusive", "apply_cursor" }, effect_operations)
+ end
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then