aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-21 22:43:38 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-21 22:43:38 +0200
commit398f44415c89f478298861c3ff655bdbda716af1 (patch)
tree5c143eaec6ac7c088b4b87aae01860232b72987c /vis-lua.c
parentd815268ee4c64a5c6134ee43968d0685eaac4d73 (diff)
downloadvis-398f44415c89f478298861c3ff655bdbda716af1.tar.gz
vis-398f44415c89f478298861c3ff655bdbda716af1.tar.xz
vis-lua: allow selection modification by assigning to cursor.selection
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c9
1 files changed, 9 insertions, 0 deletions
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);
}