diff --git a/fnl/leap/highlight.fnl b/fnl/leap/highlight.fnl index c093522..e8c506f 100644 --- a/fnl/leap/highlight.fnl +++ b/fnl/leap/highlight.fnl @@ -44,8 +44,8 @@ [(dec wininfo.topline) 0] [(dec wininfo.botline) -1] {:priority self.priority.backdrop})) - (let [[curline curcol] (map dec [(vim.fn.line ".") (vim.fn.col ".")]) - [win-top win-bot] [(dec (vim.fn.line "w0")) (dec (vim.fn.line "w$"))] + (let [[curline curcol] (map dec (get-cursor-pos)) + [win-top win-bot] (map dec [(vim.fn.line "w0") (vim.fn.line "w$")]) [start finish] (if backward? [[win-top 0] [curline curcol]] [[curline (inc curcol)] [win-bot -1]])] @@ -59,7 +59,7 @@ so we set a temporary highlight on it to see where we are." (let [[line col] (get-cursor-pos) line-str (vim.fn.getline line) - ch-at-curpos (case (vim.fn.strpart line-str (- col 1) 1 true) + ch-at-curpos (case (vim.fn.strpart line-str (dec col) 1 true) "" " " ; on an emtpy line ch ch) id (api.nvim_buf_set_extmark 0 self.ns (dec line) (dec col) diff --git a/lua/leap/highlight.lua b/lua/leap/highlight.lua index 8e7ae48..581bf4a 100644 --- a/lua/leap/highlight.lua +++ b/lua/leap/highlight.lua @@ -32,10 +32,10 @@ M["apply-backdrop"] = function(self, backward_3f, _3ftarget_windows) end return nil else - local _let_5_ = map(dec, {vim.fn.line("."), vim.fn.col(".")}) + local _let_5_ = map(dec, get_cursor_pos()) local curline = _let_5_[1] local curcol = _let_5_[2] - local _let_6_ = {dec(vim.fn.line("w0")), dec(vim.fn.line("w$"))} + local _let_6_ = map(dec, {vim.fn.line("w0"), vim.fn.line("w$")}) local win_top = _let_6_[1] local win_bot = _let_6_[2] local function _8_() @@ -61,7 +61,7 @@ M["highlight-cursor"] = function(self) local line_str = vim.fn.getline(line) local ch_at_curpos do - local _12_ = vim.fn.strpart(line_str, (col - 1), 1, true) + local _12_ = vim.fn.strpart(line_str, dec(col), 1, true) if (_12_ == "") then ch_at_curpos = " " elseif (nil ~= _12_) then