Commit Graph

26 Commits

Author SHA1 Message Date
Gregory Anders
0dd933265f
feat(terminal)!: cursor shape and blink (#31562)
When a terminal application running inside the terminal emulator sets
the cursor shape or blink status of the cursor, update the cursor in the
parent terminal to match.

This removes the "virtual cursor" that has been in use by the terminal
emulator since the beginning. The original rationale for using the
virtual cursor was to avoid having to support additional UI methods to
change the cursor color for other (non-TUI) UIs, instead relying on the
TermCursor and TermCursorNC highlight groups.

The TermCursor highlight group is now used in the default 'guicursor'
value, which has a new entry for Terminal mode. However, the
TermCursorNC highlight group is no longer supported: since terminal
windows now use the real cursor, when the window is not focused there is
no cursor displayed in the window at all, so there is nothing to
highlight. Users can still use the StatusLineTermNC highlight group to
differentiate non-focused terminal windows.

BREAKING CHANGE: The TermCursorNC highlight group is no longer supported.
2024-12-17 07:11:41 -06:00
bfredl
e61228a214 fix(tests): needing two calls to setup a screen is cringe
Before calling "attach" a screen object is just a dummy container for
(row, col) values whose purpose is to be sent as part of the "attach"
function call anyway.

Just create the screen in an attached state directly. Keep the complete
(row, col, options) config together. It is still completely valid to
later detach and re-attach as needed, including to another session.
2024-11-14 12:40:57 +01:00
Luuk van Baal
5cfa7a72f8 refactor(message): propagate highlight id instead of attrs
Problem:  Highlight group id is not propagated to the end of the message call
          stack, where ext_messages are emitted.
Solution: Refactor message functions to pass along highlight group id
          instead of attr id.
2024-11-08 13:21:35 +01:00
Justin M. Keyes
5792546777
refactor(tests): rename terminal/testutil.lua => testterm.lua #30372
This module is generally used by any tests that need the full Nvim TUI
instead of `screen.lua`. Thus it should live in `functional/` instead of
in `functional/terminal/`.
2024-09-15 03:28:14 -07:00
dundargoc
052498ed42 test: improve test conventions
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
2024-04-23 18:17:04 +02:00
Lewis Russell
81fc27124b refactor(test): inject after_each differently 2024-04-10 15:53:50 +01:00
dundargoc
7035125b2b test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-08 22:51:00 +02:00
Fred Sundvik
cbb7632aa0 test: add more hlstate tests 2024-02-05 16:24:21 +02:00
Lewis Russell
795f896a57 test: rename (meths, funcs) -> (api, fn) 2024-01-12 18:59:14 +00:00
Lewis Russell
c30f2e3182 test: typing for helpers.meths 2024-01-12 13:01:06 +00:00
Justin M. Keyes
04f2f864e2 refactor: format test/* 2024-01-03 02:09:29 +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
Evgeni Chasnovski
64a14026d7
feat(highlight): update default color scheme
Problem: Default color scheme is suboptimal.

Solution: Start using new color scheme. Introduce new `vim` color scheme
for opt-in backward compatibility.

------
Main design ideas
- Be "Neovim branded".
- Be minimal for 256 colors with a bit more shades for true colors.
- Be accessible through high enough contrast ratios.
- Be suitable for dark and light backgrounds via exchange of dark and
  light palettes.

------
Palettes

- Have dark and light variants. Implemented through exporeted
  `NvimDark*` and `NvimLight*` hex colors.

- Palettes have 4 shades of grey for UI elements and 6 colors (red,
  yellow, green, cyan, blue, magenta).

- Actual values are computed procedurally in Oklch color space based on
  a handful of hyperparameters.

- Each color has a 256 colors variant with perceptually closest color.

------
Highlight groups

Use:

- Grey shades for general UI according to their design.

- Bold text for keywords (`Statement` highlight group). This is an
  important choice to increase accessibility for people with color
  deficiencies, as it doesn't rely on actual color.

- Green for strings, `DiffAdd` (as background), `DiagnosticOk`, and some
  minor text UI elements.

- Cyan as main syntax color, i.e. for function usage (`Function`
  highlight group), `DiffText`, `DiagnosticInfo`, and some minor text UI
  elements.

- Red to generally mean high user attention, i.e. errors; in particular
  for `ErrorMsg`, `DiffDelete`, `DiagnosticError`.

- Yellow very sparingly only with true colors to mean mild user
  attention, i.e. warnings. That is, `DiagnosticWarn` and `WarningMsg`.

- Blue very sparingly only with true colors as `DiagnosticHint` and some
  additional important syntax group (like `Identifier`).

- Magenta very carefully (if at all).

------
Notes

- To make tests work without relatively larege updates, each one is
  prepended with an equivalent of the call `:colorscheme vim`.

  Plus some tests which spawn new Neovim instances also now use 'vim'
  color scheme.

  In some cases tests are updated to fit new default color scheme.
2023-12-02 18:53:19 +02:00
dundargoc
5eb5f49488
test: simplify platform detection (#21020)
Extend the capabilities of is_os to detect more platforms such as
freebsd and openbsd. Also remove `iswin()` helper function as it can be
replaced by `is_os("win")`.
2022-11-22 08:13:30 +08:00
dundargoc
736c36c02f
test: introduce skip() #21010
This is essentially a convenience wrapper around the `pending()`
function, similar to `skip_fragile()` but more general-purpose.

Also remove `pending_win32` function as it can be replaced by
`skip(iswin())`.
2022-11-13 05:52:19 -08: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
Justin M. Keyes
f977f9445f refactor(tests): introduce testprg()
Also:
- Add a describe('shell :!') section to system_spec.
- Make the test for #16271 work on systems without powershell.
2022-06-25 08:27:17 -07: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
bfredl
3c7e937a89
Merge pull request #17266 from famiu/feat/ui/global-statusline
feat(statusline): add global statusline
2022-03-17 20:16:39 +01:00
Famiu Haque
5ab1229174 feat: add support for global statusline
Ref: #9342

Adds the option to have a single global statusline for the current window at the bottom of the screen instead of a statusline at the bottom of every window. Enabled by setting `laststatus = 3`.

Due to the fact that statuslines at the bottom of windows are removed when global statusline is enabled, horizontal separators are used instead to separate horizontal splits. The horizontal separator character is configurable through the`horiz` item in `'fillchars'`. Separator connector characters are also used to connect the horizontal and vertical separators together, which are also configurable through the `horizup`, `horizdown`, `vertleft`, `vertright` and `verthoriz` items in `fillchars`.

The window separators are highlighted using the `WinSeparator` highlight group, which supersedes `VertSplit` and is linked to `VertSplit` by default in order to maintain backwards compatibility.
2022-03-18 00:21:41 +06:00
Dundar Göc
82c5a02050 ci: skip tests that fail on windows 2022-02-20 10:22:39 +01:00
Björn Linse
f707a7ef68 terminal: add tests for palette color forwarding 2019-11-03 10:14:58 +01:00
Björn Linse
5a85699425 tests/ui: make screen.lua use "linegrid" representation internally
PR #8221 took a short-cut when implementing the tests: screen.lua would
translate the linegrid highlight ids back into the old per-cell
attribute description.

Apart from cleaning up technical debt, this enables to check both rgb
and cterm colors in the same expect(), which previously was needlessly
restricted to ext_hlstate tests only.
2019-10-13 22:10:42 +02:00
Björn Linse
e04b9e7c78 test/ui: update tests for new msg_grid implementation 2019-09-01 15:55:10 +02: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
Björn Linse
6b8cd827a9 ui: add tests for hlstate extension 2018-07-21 13:21:59 +02:00