From 398f44415c89f478298861c3ff655bdbda716af1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 21 Apr 2016 22:43:38 +0200 Subject: vis-lua: allow selection modification by assigning to cursor.selection --- vis-lua.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vis-lua.c') diff --git a/vis-lua.c b/vis-lua.c index a17ef3d..9c17849 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -752,6 +752,15 @@ static int window_cursor_newindex(lua_State *L) { view_cursors_to(cur, pos); return 0; } + + if (strcmp(key, "selection") == 0) { + Filerange sel = getrange(L, 3); + if (text_range_valid(&sel)) + view_cursors_selection_set(cur, &sel); + else + view_cursors_selection_clear(cur); + return 0; + } } return newindex_common(L); } -- cgit v1.2.3