diff options
author | Erlend Lind Madsen <erlendf80@gmail.com> | 2021-11-16 15:46:52 +0100 |
---|---|---|
committer | Erlend Lind Madsen <erlendf80@gmail.com> | 2021-11-16 15:46:52 +0100 |
commit | 6afa75777fe31e191ac580ba6cfa1baf9e9aa88c (patch) | |
tree | d1630a0e523d4f7cef41479bb54800963a64659d | |
parent | 6f5f0ca432d79249482e92e1405fdb68ddc8d0b3 (diff) | |
download | vis-cursors-6afa75777fe31e191ac580ba6cfa1baf9e9aa88c.tar.gz |
revert compress cursors
-rw-r--r-- | init.lua | 28 |
1 files changed, 3 insertions, 25 deletions
@@ -27,23 +27,10 @@ local read_cursors = function() if f == nil then return end - -- read cursor positions per file path - local prev_dir + -- read positions per file path for line in f:lines() do for path, pos in string.gmatch(line, '(.+)[,%s](%d+)') do - -- uncompress prev dir if '@' - local repeat_dir = string.match(path, '^%@') - if repeat_dir then - local filename = string.match(path, '^.*/(.*)') - path = prev_dir .. filename - else - local dir = string.match(path, '(.*/)') - prev_dir = dir - end - -- only set cursor paths not already set in the current process - if not cursors[path] then - cursors[path] = pos - end + cursors[path] = pos end end f:close() @@ -68,17 +55,8 @@ local write_cursors = function() -- buffer cursors string local t = {} - local prev_dir for i, path in ipairs(paths) do - local dir = string.match(path, '(.*/)') - -- compress dir to just '@' if same as prev dir - if dir == prev_dir then - local filename = string.match(path, '^.*/(.*)') - table.insert(t, string.format('@/%s,%d', filename, cursors[path])) - else - prev_dir = dir - table.insert(t, string.format('%s,%d', path, cursors[path])) - end + table.insert(t, string.format('%s,%d', path, cursors[path])) end local s = table.concat(t, '\n') f:write(s) |