Problem: Not restoring Insert mode if leaving a prompt buffer by using a
mouse click.
Solution: Set b_prompt_insert appropriately. Also correct cursor position
when moving cursor to last line.
891e1fd894
Problem: BS in prompt buffer starts new line.
Solution: Do not allows BS over the prompt. Make term_sendkeys() handle
special keys. Add a test.
6b810d92a9
Sloppy code inherited from Vim caused user scripts to be able
to observe the cursor line in an invalid intermediary state,
due to Neovim change callbacks being unbuffered unlike Vim listeners.
Manifested in Vimscript executed from the callback possibly erroring
when `:call`:ing any function,
due to the implicit range `curwin->w_cursor.lnum,curwin->w_cursor.lnum`
failing validation.
Fixed by deferring the call to `changed_lines()` until after
`curwin->w_cursor.lnum` gets its correct value.
Problem: When session-restore creates a terminal buffer with command
like `:edit term://.//16450:/bin/bash`, the buffer gets
a different name (depends on PID). Thus the later call to
`bufexists('term://.//16450:/bin/bash)` will return false.
Solution: Force the buffer name with :file. This as least ensures
the same buffer will show in multiple windows correctly, as
expected when saving the session. But it still has problems:
1. the PID in the buffer name is bogus
2. redundant :terminal buffers still hang around
fix#5250
This makes it possible to restore the working directory of :terminal
buffers when reading those buffers from a session file.
Fixes#11288
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
It worked for MINGW builds at one point
but it keeps failing now because of perl dependencies
or nvim session issues for tests (named pipes as sockets on Windows?).
Add new "splice" interface for tracking buffer changes at the byte
level. This will later be reused for byte-resolution buffer updates.
(Implementation has been started, but using undocumented "_on_bytes"
option now as interface hasn't been finalized).
Use this interface to improve many edge cases of extmark adjustment.
Changed tests indicate previously incorrect behavior. Adding tests for
more edge cases will be follow-up work (overlaps on_bytes tests)
Don't consider creation/deletion of marks an undoable event by itself.
This behavior was never documented, and imposes complexity for little gain.
Add nvim__buf_add_decoration temporary API for direct access to the new
implementation. This should be refactored into a proper API for
decorations, probably involving a huge dict.
fixes#11598
After PR #8226 an unmapped META key in insert mode behaves like
ESC-<key> (:help i_META).
The behaviour does not fully match, since if <Esc>-<key> is pressed
manually then since it were pressed manually `gotchars` would be called
on the second <key> after insert-mode had already been left.
This would mean that `may_sync_undo` (called from `gotchars`) would
call `u_sync(FALSE)` on the second key (since we would be in normal
mode).
This overall means that <Meta-[something]> behaves differently with
respect to undo than <Esc>[something] when the [something] makes a
change.
As an example, under `nvim -u NONE`:
ihello<M-.>u
leaves the buffer empty, while
ihello<Esc>.u
leaves the buffer with one instance of `hello`.
- Fix by calling u_sync() manually in the new clause under
`normalchar:` in `insert_handle_key`.
- Update test in tui_spec.lua that accidentally relied on the old behaviour.
After cbc8d72fde when editing
the command in the command editing window (q:, q/, q?) it was possible
to switch to the previous tab. Doing so put Nvim in a bad state.
Moreover, switching tabs via the other available mechanisms (gt, gT,
<C-W>gt, <C-W>gT) is not possible when in the command editing window.
Here, the behavior is prevented. It is no longer possible to switch to
the previous tab when editing the command in the command editing window.
The solution is to share code between gt, gT, and g<Tab>. Specifically,
goto_tabpage_lastused now calls through goto_tabpage rather than
directly calling goto_tabpage_tp. Doing so works well because all the
validation enjoyed by gt and gT is present in goto_tabpage.
Problem: When Normal highlight group defines ctermfg/bg, but other
highlight group lacks ctermfg/bg, nvim_get_hl_by_id(hl_id,
v:false) returns -1 for the missing ctermfg/bg instead of just
omitting it.
Solution: checking for -1 in hlattrs2dict()
fix#11680
Problem: The Normal highlight is not defined when compiled with GUI.
Solution: Always define Normal. (Christian Brabandt, closesvim/vim#4072)
f90b6e03a9
In a multi-window scenario, it is possible to return focus to the last
accessed window via n_CTRL-W_p. However, in the case of a multi-tab
scenario, there was previously no way to return focus to the last
accessed *tab*. Here, that ability is added via n_g<tab>.
Additionally, the index of the previous tab is exposed via
tabpagenr('#'), mirroring the existing functionality of winnr('#').
Reduce API surface. We don't need so many variations of functions. Too
many functions means verbose, largely redundant documentation, tests,
and cognitive burden.