diff options
| author | Josh Wainwright <josh.wainwright@ldra.com> | 2016-05-03 15:28:27 +0100 |
|---|---|---|
| committer | Josh Wainwright <josh.wainwright@ldra.com> | 2016-05-03 15:28:27 +0100 |
| commit | f35a503d783f7ecca50cc81b85d1e3e1e5863ae0 (patch) | |
| tree | a506bba3ffd9b54b440801b96856ea7f1736e8c6 /lua | |
| parent | f415d6bd97ebfabf042ef80d3638023a19b26051 (diff) | |
| download | vis-f35a503d783f7ecca50cc81b85d1e3e1e5863ae0.tar.gz vis-f35a503d783f7ecca50cc81b85d1e3e1e5863ae0.tar.xz | |
Add another test for cursor positioning
Confirming `cursor:to(line,col)` implies `cursor.line == line` and
`cursor.col == col`
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/basic_cursor.lua | 22 | ||||
| -rw-r--r-- | lua/basic_cursor.ref | 3 |
2 files changed, 16 insertions, 9 deletions
diff --git a/lua/basic_cursor.lua b/lua/basic_cursor.lua index d78871d..bdbecaf 100644 --- 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 index 1af6f7e..c638aef 100644 --- a/lua/basic_cursor.ref +++ b/lua/basic_cursor.ref @@ -13,3 +13,6 @@ true true true true +true +true +true |
