vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 88b91adad901cc91a7dba943d151ddacc18042a3 parent fd5dfee2ec5cc4eeb940e00b87f9ae8e390ac8ba Author: Josh Wainwright <josh.wainwright@ldra.com> Date: Tue, 3 May 2016 15:28:27 +0100 Add another test for cursor positioning Confirming `cursor:to(line,col)` implies `cursor.line == line` and `cursor.col == col` Diffstat:
| M | lua/basic_cursor.lua | | | 22 | +++++++++++++--------- |
| M | lua/basic_cursor.ref | | | 3 | +++ |
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/lua/basic_cursor.lua b/lua/basic_cursor.lua @@ -9,21 +9,25 @@ win.cursor:to(5, 3) results[4] = win.cursor.line == 5 results[5] = win.cursor.col == 3 results[6] = win.cursor.pos == 30 +win.cursor:to(8, 1) +results[7] = win.cursor.line == 8 +results[8] = win.cursor.col == 1 +results[9] = win.cursor.pos == 49 -- Invalid location win.cursor:to(0, 0) -results[7] = win.cursor.line == 1 -results[8] = win.cursor.col == 1 -results[9] = win.cursor.pos == 0 +results[10] = win.cursor.line == 1 +results[11] = win.cursor.col == 1 +results[12] = win.cursor.pos == 0 -- Invalid location, negative (TODO these two seem flaky) win.cursor:to(-20, -20) -results[10] = win.cursor.line == 1 or true -results[11] = win.cursor.col == 1 -results[12] = win.cursor.pos == 0 or true +results[13] = win.cursor.line == 1 or true +results[14] = win.cursor.col == 1 +results[15] = win.cursor.pos == 0 or true -- Invalid location, after end of text, cursor ends up on last char win.cursor:to(1000, 1000) -results[13] = win.cursor.line == 9 or true -results[14] = win.cursor.col == 1 -results[15] = win.cursor.pos == 63 or true +results[16] = win.cursor.line == 9 or true +results[17] = win.cursor.col == 1 +results[18] = win.cursor.pos == 63 or true delete(win, '%') for i, res in pairs(results) do diff --git a/lua/basic_cursor.ref b/lua/basic_cursor.ref @@ -13,3 +13,6 @@ true true true true +true +true +true