Commit Graph

6670 Commits

Author SHA1 Message Date
Luuk van Baal
2ded2e75f4 fix(column): avoid exceeding configured 'signcolumn' width 2023-12-21 10:57:01 +00:00
Evgeni Chasnovski
720a3518e3 refactor(runtime): rewrite 'vim' color scheme in Lua
Problem: Bundled 'vim' color scheme is written in Vimscript which
  implicitly assumes that the file is ported from Vim.
  This is not the case, at it is currently the Neovim's way of providing
  backward compatibility for color schemes.

Solution: Rewrite it in Lua to indicate that this runtime file comes
  from Neovim.
2023-12-21 11:06:39 +01:00
Christian Clason
2ed784f385 vim-patch:9.0.2179: no filetype detection for execline scripts
Problem:  no filetype detection for execline scripts
Solution: Add filetype detection for execline

as a prior to adding syntax support for execline (see
https://github.com/djpohly/vim-execline/issues/2), i went ahead and made
the filetype detection for execline scripts.

closes: vim/vim#13689

Signed-Off-By: Mazunki Hoksaas <rolferen@gmail.com>

63210c214a

Co-authored-by: Mazunki Hoksaas <rolferen@gmail.com>
2023-12-19 23:48:02 +01:00
zeertzjq
c95845f3df
vim-patch:9.0.2177: Wrong cursor position when dragging out of window (#26661)
Problem:  Wrong cursor position when dragging out of window.
Solution: Don't use ScreenCols[] when mouse is not in current window.

closes: vim/vim#13717

ec14924368
2023-12-20 05:58:48 +08:00
zeertzjq
a61d8b615c
vim-patch:9.0.2178: reg_executing() wrong for :normal with range (#26660)
Problem:  reg_executing() returns wrong result in :normal with range
          when 'showcmd' is set (after 8.2.4705).
Solution: Reset "pending_end_reg_executing" when executing a register.

closes: vim/vim#13707

615202bd0e
2023-12-20 05:27:18 +08:00
zeertzjq
49efdf8413
test: "diff" flag of 'fillchars' (#26657) 2023-12-19 22:46:38 +08:00
zeertzjq
674a20ac47
test: sign on wrapped line with signcolumn=number (#26654) 2023-12-19 21:25:33 +08:00
dundargoc
7f6b775b45 refactor: use bool to represent boolean values 2023-12-19 11:43:21 +01:00
dundargoc
693aea0e9e
docs: small fixes (#26448)
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Co-authored-by: Jordan Mandel <jordan.mandel@live.com>
2023-12-19 13:29:13 +08:00
zeertzjq
1cf51a07a6
fix(api): don't set coladd of mark (#26648) 2023-12-19 08:01:05 +08:00
Amanda Graven
428edcde70
feat(api): add forward and back mouse buttons 2023-12-18 21:24:27 +01:00
Gregory Anders
3a4aa3fc58
refactor: soft-deprecate diagnostic signs configured with :sign-define (#26618)
Diagnostic signs should now be configured with vim.diagnostic.config(),
but "legacy" sign definitions should go through the standard deprecation
process to minimize the impact from breaking changes.
2023-12-18 11:04:44 -06:00
zeertzjq
7d279a09e0
fix(lua): handle array with holes in luaeval() (#26630) 2023-12-18 12:14:37 +08:00
zeertzjq
d956bc6379
fix(options): setting 'scroll' with resized grid (#26628) 2023-12-18 10:15:23 +08:00
zeertzjq
75b8f4c8cb
test(core/job_spec): fix flakiness (#26623) 2023-12-18 07:09:32 +08:00
dundargoc
404fdb0f36 build: cmake fixes
- add EXTERNALPROJECT_OPTIONS variable to main build
- use `REQUIRED` keyword for IWYU.
- remove check_c_compiler_flag checks when `ENABLE_COMPILER_SUGGESTIONS`
  is `ON`. If we explicitly enable it then we probably want it to give
  an error if it doesn't exist, rather than silently skip it.
- Move dependency interface libraries to their find module and use them
  as a pseudo-imported target.
- Remove BUSTED_OUTPUT_TYPE. It's not used and we can reintroduce it
  again if something similar is needed.
- Use LINK_OPTIONS intead of LINK_FLAGS when generating the `--version`
  output.
2023-12-16 21:06:28 +01:00
notomo
c18f3cfcdb
fix(api): crash after nvim_win_set_config title/footer validation error (#26606) 2023-12-16 21:58:04 +08:00
Evgeni Chasnovski
574519d9d6 feat(highlight): tweak default color scheme
Problem: Updating default color scheme produced some feedback.

Solution: Address the feedback.

Outline of the changes:

- Colors `Grey1` and `Grey2` are made a little bit more extreme (dark -
  darker, light - lighter) to increase overall contrast.

- `gui` colors are treated as base with `cterm` colors falling back to
  using 0-15 colors which come from terminal emulator.

- Update highlight group definition to not include attribute definition
  if it is intended to staty uncolored.

- Tweak some specific highlight groups.

- Add a list of Neovim specific highlight groups which are now defined
  differently in a breaking way.

- Minor tweaks in several other places related to default color scheme.
2023-12-16 14:43:03 +01:00
zeertzjq
19fed6bde1
vim-patch:9.0.2168: Moving tabpages on :drop may cause an endless loop (#26605)
Problem:  Moving tabpages on :drop may cause an endless loop
Solution: Disallow moving tabpages on :drop when cleaning up the arglist
          first

Moving tabpages during drop command may cause an endless loop

When executing a :tab drop command, Vim will close all windows not in
the argument list. This triggers various autocommands. If a user has
created an 'au Tabenter * :tabmove -' autocommand, this can cause Vim to
end up in an endless loop, when trying to iterate over all tabs (which
would trigger the tabmove autocommand, which will change the tpnext
pointer, etc).

So instead of blocking all autocommands before we actually try to edit
the given file, lets simply disallow to move tabpages around. Otherwise,
we may change the expected number of events triggered during a :drop
command, which users may rely on (there is actually a test, that expects
various TabLeave/TabEnter autocommands) and would therefore be a
backwards incompatible change.

Don't make this an error, as this could trigger several times during the
drop command, but silently ignore the :tabmove command in this case (and
it should in fact finally trigger successfully when loading the given
file in a new tab). So let's just be quiet here instead.

fixes:  vim/vim#13676
closes: vim/vim#13686

df12e39b8b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-12-16 21:30:08 +08:00
mathew
e38027ef69 feat(ui): completeopt support popup like vim 2023-12-16 18:59:59 +08:00
bfredl
7e7da962de
Merge pull request #26512 from famiu/refactor/options/type_flags
refactor(options): remove option type macros
2023-12-16 11:39:30 +01:00
zeertzjq
046efa106e
vim-patch:323dda1484d9 (#26583)
runtime(termdebug): add Tbreak command

closes: vim/vim#13656

323dda1484

Co-authored-by: iam28th <artyom28th@gmail.com>
2023-12-15 06:27:49 +08:00
Famiu Haque
3c2c022e5e
refactor(options): remove option type macros
Problem: We have `P_(BOOL|NUM|STRING)` macros to represent an option's type, which is redundant because `OptValType` can already do that. The current implementation of option type flags is also too limited to allow adding multitype options in the future.

Solution: Remove `P_(BOOL|NUM|STRING)` and replace it with a new `type_flags` attribute in `vimoption_T`. Also do some groundwork for adding multitype options in the future.

Side-effects: Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer gives an error.
2023-12-14 16:46:42 +06:00
Luuk van Baal
320e9c1c21 fix(extmark): only invalidate unpaired marks on deleted rows
Problem:  Unpaired marks are invalidated if its column is deleted,
          which may just be a "placeholder" column, e.g. for signs.
Solution: Only remove unpaired marks if its entire row is deleted.
2023-12-14 08:55:00 +00:00
zeertzjq
aa05133b0e
test(nvim_open_term): don't resize after creating terminal (#26570)
This makes the screen states consistently have no EOB lines.
2023-12-14 16:41:08 +08:00
Raphael
619407eb54
feat(nvim_open_term): convert LF => CRLF (#26384)
Problem:
Unlike termopen(), nvim_open_term() PTYs do not carriage-return the
cursor on newline ("\n") input.

    nvim --clean
    :let chan_id = nvim_open_term(1, {})
    :call chansend(chan_id, ["here", "are", "some", "lines"])

Actual behavior:

    here
        are
           some
               lines

Expected behaviour:

    here
    are
    some
    lines

Solution:
Add `force_crlf` option, and enable it by default.
2023-12-14 16:08:00 +08:00
Gregory Anders
29d5ff6ac4 fix(diagnostic): check for sign namespace instead of sign group 2023-12-13 09:30:13 -06:00
Raphael
8122470f83
refactor(diagnostic): set sign by using extmark (#26193)
after sign implementation refactor by using extmark, we can use
`nvim_buf_set_extmark` to set diagnostic sign instead use `sign_define`
2023-12-13 08:19:53 -06:00
zeertzjq
d65c6a0baf
vim-patch:9.0.2159: screenpos() may crash with neg. column (#26542)
Problem:  screenpos() may crash with neg. column
Solution: validate and correct column

closes: vim/vim#13669

ec54af4e26
2023-12-13 06:17:50 +08:00
Will Hopkins
69ffbb76c2
feat(iter): add Iter.take (#26525) 2023-12-12 14:27:24 -06:00
Gregory Anders
1907abb4c2
fix(stream): do not close handle if it is already closing (#26537)
uv_close asserts that a handle is not already closing. We can guard
against this assertion failure by manually checking the handle's closing
status ourselves.
2023-12-12 13:19:46 -06:00
zeertzjq
b40170f7a3
fix(lua): memory leak when using invalid syntax with exists() (#26530) 2023-12-12 20:34:02 +08:00
Raphael
1d4a5cd185
feat(eval): exists() function supports checking v:lua functions (#26485)
Problem:  Vimscript function exists() can't check v:lua functions.
Solution: Add support for v:lua functions to exists().
2023-12-12 19:06:22 +08:00
bfredl
e69834744b
Merge pull request #26486 from glepnir/fix_linebyte
fix(eval): use no_ff instead of ffdos as condition
2023-12-12 11:57:56 +01:00
glepnir
d95e3a4c9c fix: use no_ff instead of ffdos as condition
Problem: line2byte behavior is changed after commit b051b13. It no
longer return `-1` on empty buffer.

Solution: use `nof_ff` instead of `!ff_dos` as condition. Then
compatible behavior of line2byte() is restored.
2023-12-12 13:49:04 +08:00
zeertzjq
a9fbba81d5
test(treesitter/fold_spec): fix flakiness (#26524) 2023-12-12 10:44:17 +08:00
zeertzjq
b76cc974b9
fix(tui): don't forget to update cursor visibility (#26523) 2023-12-12 09:44:46 +08:00
Lewis Russell
8097b4a725
Merge pull request #26506 from tomtomjhj/tsfold
fix(treesitter): improve vim.treesitter.foldexpr
2023-12-11 19:30:53 +00:00
Jaehwang Jung
b88d1fb15f test(treesitter): more foldexpr tests 2023-12-12 02:29:59 +09:00
dundargoc
529498685b
Merge pull request #26458 from famiu/refactor/options/optionindex 2023-12-10 16:26:08 +01:00
zeertzjq
096211a87b
test: make text-only snapshots work (#26494) 2023-12-10 07:06:48 +08:00
zeertzjq
1037ce2e46 test: avoid repeated screen lines in expected states
This is the command invoked repeatedly to make the changes:

    :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
2023-12-09 22:15:02 +08:00
zeertzjq
5e43630a26 test: allow avoiding repeated screen lines in expected states
Allow a "*count" suffix in a screen line to repeat the screen line for
"count" times.

The change is made to Screen:expect() and Screen:get_snapshot() instead
of Screen:render() so that screen expectations generated using code can
still work and test failures can still be readable.

A snapshot is now also printed on failure so that there is no need to
run the test again with Screen:snapshot_util().
2023-12-09 22:14:50 +08:00
Famiu Haque
6346987601
refactor(options): reduce findoption() usage
Problem: Many places in the code use `findoption()` to access an option using its name, even if the option index is available. This is very slow because it requires looping through the options array over and over.

Solution: Use option index instead of name wherever possible. Also introduce an `OptIndex` enum which contains the index for every option as enum constants, this eliminates the need to pass static option names as strings.
2023-12-09 17:54:43 +06:00
Gregory Anders
c651fb3042
refactor(tui): use synchronized updates around actual buf flush (#26478)
Rather than writing the synchronized update begin and end sequences into
the TUI's internal buffer (where it is later flushed to the TTY), write
these sequences directly to the TTY before and after the TUI's internal
buffer is itself flushed to the TTY.

This guarantees that a synchronized update is always used when we are
actually sending data to the TTY. This means we do not need to keep
track of the TUI's "dirty" state (any sequences which affect the TUI
state will be written in the TUI's internal buffer, which is now
guaranteed to only ever be written when a synchronized update is
active).
2023-12-09 10:44:16 +08:00
zeertzjq
b8e227b621
vim-patch:9.0.2154: The option[] array is not sorted (#26475)
Problem:  The options[] array is not sorted alphabetically.
Solution: Sort it alphabetically.  Add a test.  Avoid unnecessary loop
          iterations in findoption().

closes: vim/vim#13648

Cherry-pick Test_set_one_column() change from patch 8.2.0432.

f48558e10a
2023-12-09 07:18:21 +08:00
Luuk van Baal
2289ca273c perf(column): avoid counting when max signs are removed from a range 2023-12-08 15:42:18 +00:00
zeertzjq
808fbe67a8
test(tui_spec): update cursor_address test for flush start (#26464) 2023-12-08 11:42:17 +08:00
zeertzjq
3bb5d2f219
test: use termopen() instead of :terminal more (#26462) 2023-12-08 08:00:27 +08:00
Gregory Anders
5e3c1b976a
test: fix Windows tests failures (#26461) 2023-12-08 06:58:03 +08:00