Commit Graph

26873 Commits

Author SHA1 Message Date
Lewis Russell
d3d7d763f3 feat(builtin): improve types 2023-08-27 13:07:04 +01:00
zeertzjq
1f49c98036
vim-patch:9.0.1792: problem with gj/gk/gM and virtual text (#24898)
Problem:  Normal mode "gM", "gj", "gk" commands behave incorrectly with
          virtual text.
Solution: Use linetabsize() instead of linetabsize_str().

closes: vim/vim#12909

d809c0a903
2023-08-27 20:04:44 +08:00
bfredl
4c69279f97
Merge pull request #24889 from bfredl/topline
fix(api): fix issues with nvim_buf_set_lines refactor
2023-08-27 13:56:20 +02:00
bfredl
840749d6c9 fix(undo): fix crash caused by checking undolevels in wrong buffer
fixes #24894
2023-08-27 12:08:11 +02:00
bfredl
9b9030ff2c fix(api): fix inconsistent behavior of topline touched in recent refactor
The change in #24824 0081549 was not a regression, however it was an
incomplete change. Unfortunately some common plugins come to depend on
this exising self-inconsistent behavior. These plugins are going to need
to update for 0.10

nvim_buf_set_lines used to NOT adjust the topline correctly if a buffer
was displayed in just one window. However, if displayed in multiple
windows, it was correctly adjusted for any window not deemed the
current window for the buffer (which could be an arbitrary choice if the
buffer was not already current, as noted in the last rafactor)

This fixes so that all windows have their topline adjusted. The added
tests show this behavior, which should be the reasonable one.
2023-08-27 12:07:46 +02:00
Maria José Solano
b7d5b55f74
fix(types): add some return/parameter type annotations (#24867)
* fix(types): add some return/parameter type annotations

* fix(types): narrow stdpath parameter further
2023-08-27 09:41:32 +01:00
Maria José Solano
2bf3e82676 fix(treesitter): validate window before updating preview highlights 2023-08-27 09:40:26 +01:00
Anatolii Sakhnik
fec51229c4
feat(l10n): update Ukrainian translations (#24882)
* optwin
* synchronize with Vim
2023-08-27 13:29:12 +08:00
Sanchayan Maity
874b8172a6 build(deps): bump tree-sitter-python to v0.20.4 2023-08-27 10:03:24 +09:00
zhaozg
c4728a5c46 build(deps): bump luv to HEAD dcd1a1c 2023-08-27 10:02:43 +09:00
julio-b
e8dd3fa280
refactor(buf_init_chartab): remove redundant loop (#24891) 2023-08-27 07:15:33 +08:00
bfredl
a6d0535c15
Merge pull request #24739 from echasnovski/win-footer
feature: add floating window footer text
2023-08-26 19:41:52 +02:00
Evgeni Chasnovski
986bf7e78d
feat(highlight): add FloatFooter highlight group
Problem: No clear separation of floating title and footer highlighting.

Solution: Add new `FloatFooter` highlight group.
2023-08-26 19:37:43 +03:00
Evgeni Chasnovski
35570e4a11
feat(float): implement footer
Problem: Now way to show text at the bottom part of floating window
  border (a.k.a. "footer").

Solution: Allows `footer` and `footer_pos` config fields similar to
  `title` and `title_pos`.
2023-08-26 19:37:43 +03:00
Evgeni Chasnovski
617fd5bdc6
refactor(float): extract "title" and "title_pos" handling 2023-08-26 19:37:18 +03:00
luukvbaal
afd0c648a8
fix(statuscolumn): force full redraw when signcolumn is invalid (#24859)
Fix #24655
2023-08-26 21:10:04 +08:00
bfredl
965ed579fe
Merge pull request #24399 from lambdalisue/fix-messagepack-rpc
feat(msgpack_rpc): add a new `msgpack-rpc` client type to fix behavior with MessagePack-RPC compliant clients
2023-08-26 13:39:31 +02:00
Ibby
362df0f793
fix(extmarks): wrong display when changing text with virt_lines (#24879) 2023-08-26 19:39:05 +08:00
bfredl
1bdcb9aaf1
Merge pull request #24824 from bfredl/nocurbuf
refactor(change): do API changes to buffer without curbuf switch
2023-08-26 12:35:22 +02:00
Alisue
b641fc3874
docs(megpack_rpc): add news entry for msgpack-rpc client type 2023-08-26 19:15:36 +09:00
Alisue
b46e93c5fd
docs(msgpack_rpc): add "msgpack-rpc" client type 2023-08-26 19:14:07 +09:00
Alisue
01fe6b9e6a
feat(msgpack_rpc): support out-of-order responses on msgpack-rpc
Added to support MessagePack-RPC fully compliant clients that do
not return responses in request order.

Although it is currently not an efficient implementation for full
compliance and full compliance cannot be guaranteed, the addition
of the new client type `msgpack-rpc` creates a situation where "if
the client type is `msgpack-rpc`, then backward compatibility is
ignored and full compliance with MessagePack- RPC compliance is
justified even if backward compatibility is ignored if the client
type is `msgpack-rpc`.
2023-08-26 19:14:06 +09:00
Alisue
deb6fd6704
feat(msgpack-rpc): show actual request id in error message 2023-08-26 19:14:05 +09:00
bfredl
0081549547 refactor(change): do API changes to buffer without curbuf switch
Most of the messy things when changing a non-current buffer is
not about the buffer, it is about windows. In particular, it is about
`curwin`.

When editing a non-current buffer which is displayed in some other
window in the current tabpage, one such window will be "borrowed" as the
curwin. But this means if two or more non-current windows displayed the buffers,
one of them will be treated differenty. this is not desirable.

In particular, with nvim_buf_set_text, cursor _column_ position was only
corrected for one single window. Two new tests are added: the test
with just one non-current window passes, but the one with two didn't.

Two corresponding such tests were also added for nvim_buf_set_lines.
This already worked correctly on master, but make sure this is
well-tested for future refactors.

Also, nvim_create_buf no longer invokes autocmds just because you happened
to use `scratch=true`. No option value was changed, therefore OptionSet
must not be fired.
2023-08-26 12:02:05 +02:00
zeertzjq
5bb17958c5
build: fix "make iwyu" not working (#24873) 2023-08-26 17:20:40 +08:00
zeertzjq
1635c9e75e
refactor: move some structs out of buffer_defs.h (#24878) 2023-08-26 11:13:20 +08:00
zeertzjq
b1cfb299df
docs: various clarifications (#24876) 2023-08-26 08:35:05 +08:00
Maria José Solano
5d8ab32f38
feat(treesitter): add a query editor (#24703) 2023-08-25 13:17:36 -05:00
zeertzjq
ecd99e7dd7
Merge pull request #24872 from zeertzjq/plines
some plines.c refactors
2023-08-25 20:55:13 +08:00
zeertzjq
ff67bb3d05 refactor(plines.c): deduplicate code for virtual text cursor offset 2023-08-25 20:20:42 +08:00
zeertzjq
93af6d9ed0 refactor: move virtcol functions to plines.c
Problem: Functions for virtcol and chartabsize are similar (both compute
horizontal size), but appear in two different source files.
Solution: Move virtcol functions to plines.c.
2023-08-25 20:17:26 +08:00
zeertzjq
f08648182b refactor(plines.c): move vertical size functions to the bottom
Problem: It may be unclear what "below" in first comment refers to.
Solution: Move vertical size functions to the bottom so that it can be
changed to "above".
2023-08-25 20:17:23 +08:00
Sean Dewar
d4dc52a835
Merge pull request #24821 from seandewar/vim-9f2962141514
vim-patch:9f2962141514,f6fb52b667ee,19968fc4ec2c,a76f3221cdcf,2ae7ffe0bc3c,3d3a9152fa6d - Termdebug stuff
2023-08-25 11:59:51 +01:00
Sean Dewar
0bd82b540e
refactor(termdebug): reindent some things
Mostly to make it more consistent and to match Vim more where applicable.
2023-08-25 11:24:52 +01:00
Sean Dewar
e3b385bed5
vim-patch:3d3a9152fa6d
runtime(termdebug): more termdebug fixes and improvements (vim/vim#12892)

- Fix and attempt to simplify :Frame/:Up/:Down documentation.

- Accept a count instead for :Up/:Down/+/-.

- Update the "Last Change" dates.

- Fix a missing :let (caused an error if gdb fails to start).

- Wipe the prompt buffer when ending prompt mode (if it exists and wasn't wiped
  by the user first). Avoids issues with stale prompt buffers (such as E95 when
  starting a new prompt mode session).

- Kill the gdb job if the prompt buffer is unloaded (similar to what's done for
  a terminal buffer). Fixes not being able to start a new termdebug session if
  the buffer was wiped by the user, for example.

3d3a9152fa
2023-08-25 11:05:18 +01:00
Sean Dewar
92ef2b2bcd
vim-patch:2ae7ffe0bc3c
runtime(termdebug): add frame related commands (vim/vim#12511)

implementing `:Frame`, `:Up` and `:Down'

2ae7ffe0bc

Use maparg() for saving K as it's since been ported (and supports Lua callbacks
and the other API fields).

Use the 3 argument variant of mapset(), as the single argument one isn't ported
yet (v8.2.4861).

Co-authored-by: Simon Sobisch <simonsobisch@web.de>
2023-08-25 11:05:18 +01:00
Sean Dewar
8aad4b8425
fix(termdebug): send SIGINT when interrupting prompt mode
Unlike Vim's job_stop(), Nvim's jobstop() does not take a signal argument, and
always sends SIGTERM/KILL.

:Stop and Ctrl-C in prompt mode is supposed to interrupt the program like in
terminal mode, not kill GDB.

Also, maybe libuv's kill() works on Windows? If so, the logic above could be
removed, but I don't have a Windows machine available to test that.

Also "set nomodified" when ending prompt mode, like Vim (avoids E37).
2023-08-25 11:04:41 +01:00
Sean Dewar
21477bdb27
vim-patch:a76f3221cdcf
runtime(termdebug): Fix various Termdebug issues (vim/vim#12875)

* Fix some Termdebug issues after vim/vim#12403
* Fix :Asm in Termdebug prompt mode
* Fix Termdebug s:DecodeMessage escaping logic

a76f3221cd

Adjust disassembly message forwarding for Nvim, as its callback can receive
many lines at once.

Currently, just forward each disassembly line individually to s:CommOutput();
it's possible to do this in batch instead, but this is simpler.

I suggested moving to a GDB MI-based approach for the disassemble stuff
upstream, which should simplify the logic a lot if implemented (and possibly
allow for getting rid of the `&"disassemble ...` special-casing).

Also, correct "(gdb)" to include a trailing space; the stray GDB prompts were
being ignored by s:CommOutput() anyway, so this had caused no ill effects.
2023-08-25 11:01:09 +01:00
Sean Dewar
c413b42c45
fix(termdebug): prompt mode breaks with &splitbelow set
Unlike Vim, termopen() doesn't split, so you can't use the modifier like that.
Remove the fragile :wincmd shenanigans.
2023-08-25 10:59:57 +01:00
Sean Dewar
af78060b18
fix(termdebug): trim suffixed "\r" in CommOutput
Vim splits lines on "\r", then trims any prefixed "\n".

But in Nvim, job output lines are split on "\n" (like readfile() in binary
mode), so trim any suffixed "\r" instead.

This gets rid of the trailing "^M" character in messages parsed from the jobs.
2023-08-25 10:59:56 +01:00
Sean Dewar
ec97128826
vim-patch:19968fc4ec2c
runtime(termdebug): re-indent lines (vim/vim#12857)

19968fc4ec

Co-authored-by: Shane-XB-Qian <shane.qian@foxmail.com>
2023-08-25 10:59:56 +01:00
Sean Dewar
464472b4f7
vim-patch:f6fb52b667ee
runtime(termdebug): refactor error printing (vim/vim#12856)

// vs not act like exception from vim or termdebug

f6fb52b667

Co-authored-by: Shane-XB-Qian <shane.qian@foxmail.com>
2023-08-25 10:59:56 +01:00
Sean Dewar
949dd14d8b
vim-patch:9f2962141514
Runtime(termdebug): Add support to view local and argument variables

closes: 12403

9f29621415

Rename the existing "s:running" (#16790) to "s:gdb_running" to not clash with
the "s:running" introduced in this patch (which instead relates to whether the
debugged program is currently running in gdb).

Keep the file `:retab`bed as before.

Co-authored-by: laburnumT <flo.striker@gmail.com>
2023-08-25 10:59:55 +01:00
Gregory Anders
0b0d912763
Merge pull request #24864 from gpanders/filetype-on-detect-order 2023-08-24 21:39:57 -05:00
bfredl
5b4f1f56c3
Merge pull request #24862 from bfredl/ml_get_buf
refactor(memline): distinguish mutating uses of ml_get_buf()
2023-08-24 23:12:26 +02:00
bfredl
cefd774fac refactor(memline): distinguish mutating uses of ml_get_buf()
ml_get_buf() takes a third parameters to indicate whether the
caller wants to mutate the memline data in place. However
the vast majority of the call sites is using this function
just to specify a buffer but without any mutation. This makes
it harder to grep for the places which actually perform mutation.

Solution: Remove the bool param from ml_get_buf(). it now works
like ml_get() except for a non-current buffer. Add a new
ml_get_buf_mut() function for the mutating use-case, which can
be grepped along with the other ml_replace() etc functions which
can modify the memline.
2023-08-24 22:40:56 +02:00
Gregory Anders
af38b46a25 fix(filetype): return on_detect function when matching by file contents 2023-08-24 13:04:04 -05:00
Gregory Anders
020d1f626a fix(filetype): call on_detect before setting buffer filetype
The on_detect functions returned by filetype.lua set buffer local
variables which are often used by filetype plugins. For example, the
on_detect function for shell buffers sets variables such as b:is_bash or
b:is_sh, which are used by the sh ftplugin.

When called after setting the buffer's filetype, these variables cannot
be used by the ftplugin (because they are not yet defined). Instead,
call on_detect before setting the buffer filetype so that any buffer
variables set by on_detect can be used in the ftplugin.
2023-08-24 12:48:21 -05:00
Sean Dewar
daf7abbc42
docs(builtin): small fixes (#24861)
Also make gen_eval_files.lua render vimdoc helpExamples properly if the line
begins with the `>` marker.
2023-08-24 13:29:40 +01:00
Sean Dewar
53170579ce
Merge pull request #24702 from seandewar/vim-1688938dd5ac
vim-patch:1688938dd5ac,96d6c4aabed1,e8d6f03f6a61
2023-08-24 09:27:17 +01:00