vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit c5470fa8f227e6cdab822bb46a7191a796ae9926
parent e4d382ed55fc28aae927532a6764e89feccc55cd
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 15 Apr 2016 22:21:31 +0200

vis-lua: add cursor.number property

Diffstat:
MREADME.md | 1+
Mvis-lua.c | 5+++++
2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -602,6 +602,7 @@ At this time there exists no API stability guarantees. - `line` (1 based), `col` (1 based) - `to(line, col)` - `pos` bytes from start of file (0 based) + - `number` zero based index of cursor Most of the exposed objects are managed by the C core. Allthough there is a simple object life time management mechanism in place, it is still diff --git a/vis-lua.c b/vis-lua.c @@ -580,6 +580,11 @@ static int window_cursor_index(lua_State *L) { lua_pushunsigned(L, view_cursors_col(cur)); return 1; } + + if (strcmp(key, "number") == 0) { + lua_pushunsigned(L, view_cursors_number(cur)+1); + return 1; + } } return index_common(L);