vis

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

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

commit 56ceb14cfac497d3c5b68e3178041d4355ade30d
parent 29d582989d13f1d5cc21525f5ba4b0c977e01c5b
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Mon, 25 Apr 2016 08:48:59 +0200

vis-lua: add file.modified property

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

diff --git a/README.md b/README.md @@ -607,6 +607,7 @@ At this time there exists no API stability guarantees. - `lines[0..#lines+1]` array giving read/write access to lines - `newlines` type of newlines either `"nl"` or `"crnl"` - `size` current file size in bytes + - `modified` whether the file contains unsaved changes - `window` - `file` - `cursors_iterator()` diff --git a/vis-lua.c b/vis-lua.c @@ -822,6 +822,11 @@ static int file_index(lua_State *L) { lua_pushunsigned(L, text_size(file->text)); return 1; } + + if (strcmp(key, "modified") == 0) { + lua_pushboolean(L, text_modified(file->text)); + return 1; + } } return index_common(L);