aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlend Fagerheim <erlendf80@gmail.com>2018-05-24 14:32:48 +0200
committerErlend Fagerheim <erlendf80@gmail.com>2018-05-24 14:32:48 +0200
commit19755726872b5b724084fe50d10e7808e8cbb0aa (patch)
tree02c91c08425a17493c2c1e225074ecacb95c0073
parentfcd07c6fd8f14fe7fe027f7ba81e829b742153c6 (diff)
downloadvis-cursors-19755726872b5b724084fe50d10e7808e8cbb0aa.tar.gz
rename methods
-rw-r--r--cursors.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/cursors.lua b/cursors.lua
index 9aee175..55bc59f 100644
--- a/cursors.lua
+++ b/cursors.lua
@@ -2,7 +2,7 @@ local module = {}
local cursors = {}
module.path = os.getenv('HOME') .. '/.cursors'
-function set_cursor_pos(win)
+function apply_cursor_pos(win)
if win.file == nil or win.file.path == nil then return end
local pos = cursors[win.file.path]
if pos == nil then return end
@@ -17,7 +17,7 @@ function file_exists(path)
end
end
-function load_cursors()
+function read_cursors()
cursors = {}
local f = io.open(module.path)
if f == nil then return end
@@ -28,11 +28,11 @@ function load_cursors()
end
f:close()
for win in vis:windows() do
- set_cursor_pos(win)
+ apply_cursor_pos(win)
end
end
-function save_cursors()
+function write_cursors()
local f = io.open(module.path, 'w+')
if f == nil then return end
local a = {}
@@ -44,15 +44,15 @@ function save_cursors()
f:close()
end
-function win_close(win)
+function set_cursor_pos(win)
if win.file == nil or win.file.path == nil then return end
if not file_exists(win.file.path) then return end
cursors[win.file.path] = win.selection.pos
end
-vis.events.subscribe(vis.events.INIT, load_cursors)
-vis.events.subscribe(vis.events.WIN_OPEN, set_cursor_pos)
-vis.events.subscribe(vis.events.WIN_CLOSE, win_close)
-vis.events.subscribe(vis.events.QUIT, save_cursors)
+vis.events.subscribe(vis.events.INIT, read_cursors)
+vis.events.subscribe(vis.events.WIN_OPEN, apply_cursor_pos)
+vis.events.subscribe(vis.events.WIN_CLOSE, set_cursor_pos)
+vis.events.subscribe(vis.events.QUIT, write_cursors)
return module