Commit Graph

99 Commits

Author SHA1 Message Date
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
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
glepnir
d4872377fe fix(highlight): attr set all when normal attr changed 2023-10-04 18:42:13 +08:00
glepnir
ab92575753 fix(highlight): winhl receive wrong argument 2023-09-19 18:05:59 +08:00
zeertzjq
f29acc5073
test(extmarks): add tests for #14201 #20004 #20885 (#23794) 2023-05-28 16:28:10 +08:00
bfredl
455bca1ba8 fix(drawline): combine extmark highligh with area hl correctly
fixes #23734

Get rid of the weird attr_pri dance which always seemed like a kludge:

    if (!attr_pri) {
      wlv.char_attr = hl_combine_attr(wlv.char_attr, extmark_attr);
    } else {
      wlv.char_attr = hl_combine_attr(extmark_attr, wlv.char_attr);
    }

Instead combine extmark attrs with (old-skool) syntax attrs in a consistent way and then combine that with attr_pri and the rest in an _unified_ code path

fixes #23722

Co-authored-by: luukvbaal <luukvbaal@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-05-25 18:40:26 +02:00
zeertzjq
dcaf207336
fix(highlight): combine ColorColumn with low-priority CursorLine (#23017) 2023-04-11 16:51:31 +08:00
bfredl
0f42aa1f2a fix(highlight): use winhl=Foo:Bar even when Bar is empty
fixes #22906
2023-04-06 17:15:16 +02:00
zeertzjq
8bdcc91dc8
test(highlight_spec): fix warning in Visual highlight test (#22719)
Problem:    Warning in Visual highlight test.
Solution:   Don't move cursor back and forth.
2023-03-18 16:50:22 +08:00
zeertzjq
314f20a44f
test: use a wider screen in the rightleft winhl test (#22641)
With a wide screen this actually previously caused an overflow.
2023-03-12 15:41:39 +08:00
zeertzjq
172227a446
fix(screen): correctly draw background and eob with 'rightleft' (#22640) 2023-03-12 12:10:27 +08:00
zeertzjq
30f606fc60
fix(options): restore exists() behavior for options (#21510)
Duplicating get_option_value() logic for an obscure future refactor
isn't really worthwhile, and findoption() isn't used anywhere else
outside the options code.
2022-12-23 13:56:32 +08:00
bfredl
942f26279d fix(tests): only get the color map once, even for multiple test files
Problem: test/functional/ui/screen.lua would be reloaded for each
*_spec.lua file, which causes an extra nvim session to be started
to get the color map each time.

solution: Mark screen.lua as a preloaded file, but defer the
loading of the color map to the first time Screen object is initialised.
2022-11-27 11:51:10 +01:00
bfredl
d7e7578ada fix(ui): fix some cases of stale highlight definitions
fixes #20695
2022-11-13 10:20:28 +01:00
zeertzjq
2425fe2dc5
vim-patch:8.2.2207: illegal memory access if popup menu items are changed (#21028)
Problem:    Illegal memory access if popup menu items are changed while the
            menu is visible. (Tomáš Janoušek)
Solution:   Make a copy of the text. (closes vim/vim#7537)

38455a9213

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-11-12 09:57:29 +08:00
bfredl
6ae144a921 feat(messages)!: graduate the 'msgsep' feature
The old behaviour (e.g. via `set display-=msgsep`) will not be available.
Assuming that messages always are being drawn on msg_grid
(or not drawn at all, and forwarded to `ext_messages` enabled UI)
will allows some simplifcations and enhancements moving forward.
2022-10-05 20:12:59 +02:00
bfredl
6ab2bf6819 fix(highlight): set the window namespace when redrawing statusline 2022-08-30 10:28:11 +02:00
bfredl
700a6fb9d4
Merge pull request #19822 from bfredl/hldef
fix(api): make nvim_set_hl(ns=0, ...) redraw screen properly
2022-08-18 12:16:27 +02:00
bfredl
e29156356b fix(api): make nvim_set_hl(ns=0, ...) redraw screen properly
fixes #18160
2022-08-18 10:57:46 +02:00
bfredl
21b2906c9c fix(winhl): do not crash when unsetting winhl in just opened window
fixes #19823
2022-08-18 09:43:07 +02:00
bfredl
068a998e60 fix(tests): remove irrelevant usage of display-=msgsep
These were just added to avoid churn when changing the default
of 'display'. To simplify message handling logic, we might want
to remove support for printing messages in default_grid later on.
This would allow things like printing error messages safely in the
middle of redraw, or a future graduation of the 'multigrid' feature.
2022-08-17 23:44:49 +02:00
bfredl
d879331b0d feat(ui): allow to set the highlight namespace per window
- reimplement 'winhl' in terms of highlight namespaces
- check for EOF in screen tests (to indicate a likely crash)
2022-08-17 16:20:39 +02:00
zeertzjq
8730643326 fix(winbar): make setting WinBar and WinBarNC in 'winhighlight' work 2022-07-15 09:22:57 +08:00
Famiu Haque
bbf58e6bbc refactor(ui)!: link VertSplit to Normal by default
Avoids using `gui=reverse` on `VertSplit` and makes window separators
look much nicer by default.
2022-05-15 22:37:35 +06:00
zeertzjq
1edca3872e
vim-patch:8.2.4707: redrawing could be a bit more efficient (#18022)
Problem:    Redrawing could be a bit more efficient.
Solution:   Optimize redrawing. (closes vim/vim#10105)
8c97960850
2022-04-07 23:26:03 +08:00
zeertzjq
139828cc7e vim-patch:8.2.4660: cursorcolumn is sometimes not correct
Problem:    Cursorcolumn is sometimes not correct.
Solution:   Recompute the cursor column when entering Insert mode and the
            cursor is on a character wider than a screen cell.
782c6744b4
2022-04-01 19:53:40 +08:00
zeertzjq
ab02b28b4e vim-patch:8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Problem:    'cursorline' not always updated with 'cursorlineopt' is
            "screenline".
Solution:   Call check_redraw_cursorline() more often. (closes vim/vim#10013)
bf269ed0b0

Code was reverted in patch 8.2.4638, so this just ports the test.
2022-03-28 06:15:26 +08:00
zeertzjq
4baeb96c1b vim-patch:8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Problem:    Superfluous check if a redraw is needed for 'cursorline'.
Solution:   Remove check_redraw_cursorline(). (closes vim/vim#10030, closes vim/vim#10029)
3e559cd884

redraw_after_callback() is N/A.
Omits changes that just revert code from patch 8.2.4630.
2022-03-28 06:15:26 +08:00
zeertzjq
3e9b4e917d vim-patch:8.2.4591: cursor line not updated when a callback moves the cursor
Problem:    Cursor line not updated when a callback moves the cursor.
Solution:   Check if the cursor moved. (closes vim/vim#9970)
e7a74d5375

redraw_after_callback() is N/A. Nvim handles timers on the main loop.
2022-03-24 16:08:59 +08:00
zeertzjq
2adc24b18b test: add a Lua screen test for CursorLineNr in diff mode
Remove a useless test added in #14190
2022-03-08 10:11:20 +08:00
zeertzjq
4ca522fd02 test: convert some colorcolumn tests to Lua screen tests 2022-02-12 06:36:17 +08:00
zeertzjq
23dcef9269 fix(highlight): always update window highlight if highlight changed 2021-12-07 20:48:39 +08:00
zeertzjq
32024787b6
vim-patch:8.1.2229: color number column above/below cursor #15409
Problem:    Cannot color number column above/below cursor differently.
Solution:   Add LineNrAbove and LineNrBelow. (Shaun Brady, closes vim/vim#624)
efae76ab1a
2021-08-27 05:50:37 -07:00
zeertzjq
e9dd640897
vim-patch:8.2.3295: 'cursorline' should not apply to 'breakindent' #15281
Problem:    'cursorline' should not apply to 'breakindent'.
Solution:   Make 'cursorline' apply to 'breakindent' and 'showbreak'
            consistently. (closes vim/vim#8684)
4f33bc20d7
2021-08-16 00:27:04 -07:00
Gregory Anders
cab90f2ef1 fixup! fix(highlight): remove syncolor.vim 2021-07-28 09:11:07 -06:00
Andy K. Massimino
79575cfe8a Fix a failing test (highlight_spec.lua) 2021-03-20 15:56:52 -04:00
shade-of-noon
2d5dd85eef
screen.c: Allow showbreak to override cursorline. (#13372)
I also added relevant tests.

Close #13369
2020-11-25 16:47:03 +01:00
Björn Linse
bfe84adb5a options: winhighlight: fix incorrect string equality test 2020-01-28 19:10:41 +01:00
Björn Linse
4987311fb5 tests/ui: remove unnecessary screen:detach()
It is perfectly fine and expected to detach from the screen just by
the UI disconnecting from nvim or exiting nvim. Just keep detach() in
screen_basic_spec, to get some coverage of the detach method itself.

This avoids hang on failure in many situations (though one could argue
that detach() should be "fast", or at least "as fast as resize",
which works in press-return already).

Never use detach() just to change the size of the screen, try_resize()
method exists for that specifically.
2019-10-13 22:10:42 +02:00
Daniel Hahler
cb25207171 vim-patch:8.0.0914: highlight attributes are always combined (#10256)
Problem:    Highlight attributes are always combined.
Solution:   Add the 'nocombine' value to replace attributes instead of
            combining them. (scauligi, closes vim/vim#1963)
0cd2a94a40

Closes https://github.com/neovim/neovim/pull/10256.
2019-09-26 00:50:54 +02:00
Zach Wegner
18e5869f56 Fix "precedes" listchar behavior in wrap mode
Previously, the "precedes" character would be rendered on every row
when w_skipcol > 0 (i.e., when viewing a single line longer than the
entire screen), instead of just on the first row. Make sure to only
render it on the first row in this case.

Add a test for this behavior.

Fix documentation for the "precedes" character, which erroneously
stated that it was only active when wrap mode was off.
2019-09-21 22:09:52 -07:00
Jaskaran Singh
3afb397407 syntax, TUI: support "strikethrough"
fix #3436

Includes:
vim-patch:8.0.1038: strike-through text not supported
2019-09-13 14:46:19 -07:00
Björn Linse
e04b9e7c78 test/ui: update tests for new msg_grid implementation 2019-09-01 15:55:10 +02:00
Björn Linse
857b29bdd8 highlight: expose builtin highlight groups using hl_group_set event 2019-07-14 13:26:40 +02:00
Marco Hinz
d9de4c0efb
vim-patch:8.1.1072: extending sign and foldcolumn below the text is confusing (#9816)
Problem:    Extending sign and foldcolumn below the text is confusing.
Solution:   Let the sign and foldcolumn stop at the last text line, just like
            the line number column.  Also stop the command line window leader.
            (Christian Brabandt)

8ee4c01b8c

Closes https://github.com/neovim/neovim/issues/9613
2019-04-03 10:48:47 +02:00
Justin M. Keyes
6f7b81bd6d
vim-patch:8.1.{0849,1001}: 'cursorline' highlight #9757
- Lua test correctly fails when 8.1.0849 is reverted.
- 8.1.1001 bug does not manifest in Neovim.

vim-patch:8.1.0849: cursorline highlight is not always updated
Problem:    Cursorline highlight is not always updated.
Solution:   Set w_last_cursorline when redrawing.  Fix resetting cursor flags
            when using the popup menu.
c07ff5c60a

vim-patch:8.1.1001: Visual area not correct when using 'cursorline'
Problem:    Visual area not correct when using 'cursorline'.
Solution:   Update w_last_cursorline also in Visual mode. (Hirohito Higashi,
            closes vim/vim#4086)
8156ed3755
2019-03-19 12:24:41 +01:00
Justin M. Keyes
3cb89cafe3
vim-patch:8.1.0994: fix relative cursor position #9676
Problem:    Relative cursor position is not calculated correctly.
Solution:   Always set topline, also when window is one line only.
            (Robert Webb) Add more info to getwininfo() for testing.
8fcb60f961
2019-03-09 23:12:33 +01:00
Justin M. Keyes
37a499148f Visual: highlight char-at-cursor
Decide whether to highlight the visual-selected character under the
cursor, depending on 'guicursor' style:

- Highlight if cursor is blinking or non-block (vertical, horiz).
- Do NOT highlight if cursor is non-blinking block.

Traditionally Vim's visual selection does "reverse mode", which perhaps
conflicts with the non-blinking block cursor. But 'guicursor' defaults
to a vertical bar for selection=exclusive, and this confuses users who
expect to see the text highlighted.

closes #8983
2019-01-04 01:28:44 +01:00
Justin M. Keyes
32a30d90b4
highlight: Fix missing .rgb_sp_color in initializers (#9287)
terminal_get_line_attributes() had this bug for a long time, though it
likely had no effect visible to users.

ref #9028
ref 60f845ca55
2018-11-30 21:13:01 +01:00
Justin M. Keyes
cf631aaed0
diff/highlight: Fix GUI highlight for low-priority CursorLine (#9281)
ref #9028
ref 0653ed63a5
2018-11-28 03:23:10 +01:00