-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TAB
has some bug at Insert mode
#79
Comments
Hi, could you try this branch? It has a potential fix: #80 |
I tried , but it doesn't work properly. |
I confirm this behaviour with tab. This is the case even on a fresh config with only lazy.nvim and autolist.nvim installed (and , and on a pure markdown file with only text. My the test init.lua I used is bootstrapping lazy.nvim, then
This produces the behaviour that @wqk151 observed. |
The problem seems to stem from line 25 in vim.cmd.normal({ "a" .. parsed_key, bang = true }) Because we append (the 'a' in the command above), the cursor will reenter insert mode one character forward. For example, if we use the text from the original image, we start like
where '|' is the cursor in insert mode. When we press tab, the above lua code runs. This enters normal mode, then simulates pressing 'a' which enters insert after the current character (append), then issues the tab key press. This means we then have
This goes away if we change 'a' to 'i', but I don't know yet what other functionality this breaks because I don't know this code base. I'm looking at fixing this right now because this bug is irksome. |
Problem: the `press()` function is used to fall back to the original functionality of `<tab>` and `<S-tab>` when not in a list context. When it does this, it appends before executing the original keypress, modifying the fall back functionality. Solution: Do not append before using the fall back functionality of `<tab>` and `<S-tab>`. This commit also refactors `handle_indent()`, - removes unused variables - removes `run_recalculate_after_delay()`, which appears to have no effect - reuses variables when possible (`cur_line`) - renames variables for brevity (`in_list` and `at_line_end`) Fixes gaoDean#79
before
tab
after
tab
my config
The text was updated successfully, but these errors were encountered: