Skip to content

Commit

Permalink
fix: add i flag to feedkeys calls
Browse files Browse the repository at this point in the history
Closes #7
  • Loading branch information
ggandor committed Jun 26, 2021
1 parent 90d1dbe commit 1a213ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions fnl/lightspeed.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ interrupted change-operation."
(local (ok? in2) (pcall get-char)) ; pcall for handling <C-c>
(set self.instant-repeat?
(and ok? (string.match (vim.fn.maparg in2) "<Plug>Lightspeed_[fFtT]")))
(vim.fn.feedkeys (if ok? in2 (replace-vim-keycodes "<esc>"))))
(vim.fn.feedkeys (if ok? in2 (replace-vim-keycodes "<esc>")) :i))
(hl:cleanup)))))))

; }}}
Expand Down Expand Up @@ -654,7 +654,7 @@ with `ch1` in separate ordered lists, keyed by the succeeding char."
timeout-secs (/ opts.jump_on_partial_input_safety_timeout 1000)
(ok? input) (pcall get-char)]
(when-not (and (= input char-to-ignore) (< (os.clock) (+ start timeout-secs)))
(when ok? (vim.fn.feedkeys input)))))
(when ok? (vim.fn.feedkeys input :i)))))


; State for 2-character search that is persisted between invocations.
Expand Down Expand Up @@ -882,7 +882,7 @@ with `ch1` in separate ordered lists, keyed by the succeeding char."
(. positions-to-label)) ; ...currently in use?
; When "autojump" is on, fall through with any other key,
; so that we can continue editing right away.
(exit-with (when jump-to-first? (vim.fn.feedkeys in3))))
(exit-with (when jump-to-first? (vim.fn.feedkeys in3 :i))))
; Succesful exit, option #4: selecting a valid label.
pos (do (set-dot-repeat-if-applies)
(jump-to! pos full-incl?)))))))))))))))))))
Expand Down
17 changes: 8 additions & 9 deletions lua/lightspeed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -653,14 +653,13 @@ ft.to = function(self, reverse_3f, t_like_3f, dot_repeat_3f)
vim.cmd("redraw")
local ok_3f, in2 = pcall(get_char)
self["instant-repeat?"] = (ok_3f and string.match(vim.fn.maparg(in2), "<Plug>Lightspeed_[fFtT]"))
local function _20_()
if ok_3f then
return in2
else
return replace_vim_keycodes("<esc>")
end
local _20_
if ok_3f then
_20_ = in2
else
_20_ = replace_vim_keycodes("<esc>")
end
vim.fn.feedkeys(_20_())
vim.fn.feedkeys(_20_, "i")
end
return hl:cleanup()
end
Expand Down Expand Up @@ -950,7 +949,7 @@ local function ignore_char_until_timeout(char_to_ignore)
local ok_3f, input = pcall(get_char)
if not ((input == char_to_ignore) and (os.clock() < (start + timeout_secs))) then
if ok_3f then
return vim.fn.feedkeys(input)
return vim.fn.feedkeys(input, "i")
end
end
end
Expand Down Expand Up @@ -1310,7 +1309,7 @@ s.to = function(self, reverse_3f, dot_repeat_3f)
end
do
if jump_to_first_3f then
vim.fn.feedkeys(in3)
vim.fn.feedkeys(in3, "i")
end
end
return nil
Expand Down

0 comments on commit 1a213ae

Please sign in to comment.