aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/api.txt6
-rw-r--r--runtime/doc/builtin.txt12
-rw-r--r--runtime/doc/diagnostic.txt12
-rw-r--r--runtime/doc/options.txt18
-rw-r--r--runtime/doc/usr_06.txt1
-rw-r--r--runtime/lua/vim/diagnostic.lua8
-rw-r--r--src/nvim/api/options.c8
-rw-r--r--src/nvim/eval/funcs.c13
-rw-r--r--src/nvim/ex_cmds.c2
-rw-r--r--src/nvim/ex_getln.c19
-rw-r--r--src/nvim/fileio.c1
-rw-r--r--src/nvim/globals.h3
-rw-r--r--src/nvim/highlight.c4
-rw-r--r--src/nvim/lua/executor.c4
-rw-r--r--src/nvim/message.c5
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/ops.c18
-rw-r--r--src/nvim/screen.c15
-rw-r--r--src/nvim/testdir/test_ins_complete.vim2
-rw-r--r--src/nvim/testdir/test_messages.vim56
-rw-r--r--src/nvim/testdir/test_syn_attr.vim30
-rw-r--r--src/nvim/testdir/test_window_cmd.vim4
-rw-r--r--src/nvim/ui.c6
-rw-r--r--src/nvim/window.c10
-rw-r--r--test/functional/api/highlight_spec.lua11
-rw-r--r--test/functional/legacy/syn_attr_spec.lua60
-rw-r--r--test/functional/ui/cmdline_spec.lua2
27 files changed, 256 insertions, 76 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 9758959f4e..1426404da9 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -1968,7 +1968,7 @@ nvim_buf_get_option({buffer}, {name}) *nvim_buf_get_option()*
Option value
nvim_buf_set_option({buffer}, {name}, {value}) *nvim_buf_set_option()*
- Sets a buffer option value. Passing 'nil' as value deletes the
+ Sets a buffer option value. Passing `nil` as value deletes the
option (only works if there's a global fallback)
Parameters: ~
@@ -2075,8 +2075,8 @@ nvim_win_get_option({window}, {name}) *nvim_win_get_option()*
Option value
nvim_win_set_option({window}, {name}, {value}) *nvim_win_set_option()*
- Sets a window option value. Passing 'nil' as value deletes the
- option(only works if there's a global fallback)
+ Sets a window option value. Passing `nil` as value deletes the
+ option (only works if there's a global fallback)
Parameters: ~
{window} Window handle, or 0 for current window
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 9d33c442c2..f844ae5aaf 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -6674,7 +6674,6 @@ setbufline({buf}, {lnum}, {text}) *setbufline()*
|bufload()| if needed.
To insert lines use |appendbufline()|.
- Any text properties in {lnum} are cleared.
{text} can be a string to set one line, or a list of strings
to set multiple lines. If the list extends below the last
@@ -8012,10 +8011,10 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
The result is a String, which is the {what} attribute of
syntax ID {synID}. This can be used to obtain information
about a syntax item.
- {mode} can be "gui", "cterm" or "term", to get the attributes
+ {mode} can be "gui" or "cterm", to get the attributes
for that mode. When {mode} is omitted, or an invalid value is
used, the attributes for the currently active highlighting are
- used (GUI, cterm or term).
+ used (GUI or cterm).
Use synIDtrans() to follow linked highlight groups.
{what} result
"name" the name of the syntax item
@@ -8040,14 +8039,15 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
"underdouble" "1" if double underlined
"underdotted" "1" if dotted underlined
"underdashed" "1" if dashed underlined
- "strikethrough" "1" if struckthrough
+ "strikethrough" "1" if struckthrough
+ "nocombine" "1" if nocombine
+
+ Returns an empty string on error.
Example (echoes the color of the syntax item under the
cursor): >
:echo synIDattr(synIDtrans(synID(line("."), col("."), 1)), "fg")
<
- Returns an empty string on error.
-
Can also be used as a |method|: >
:echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg")
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index 2446506dec..7fb10f2a66 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -74,7 +74,7 @@ Functions that take a severity as an optional parameter (e.g.
2. A table with a "min" or "max" key (or both): >
- vim.diagnostic.get(0, { severity = {min=vim.diagnostic.severity.WARN} })
+ vim.diagnostic.get(0, { severity = { min = vim.diagnostic.severity.WARN } })
The latter form allows users to specify a range of severities.
@@ -298,7 +298,7 @@ EVENTS *diagnostic-events*
DiagnosticChanged After diagnostics have changed.
Example: >
- autocmd DiagnosticChanged * lua vim.diagnostic.setqflist({open = false })
+ autocmd DiagnosticChanged * lua vim.diagnostic.setqflist({ open = false })
<
==============================================================================
Lua module: vim.diagnostic *diagnostic-api*
@@ -315,12 +315,12 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
For example, if a user enables virtual text globally with >
- vim.diagnostic.config({virtual_text = true})
+ vim.diagnostic.config({ virtual_text = true })
<
and a diagnostic producer sets diagnostics with >
- vim.diagnostic.set(ns, 0, diagnostics, {virtual_text = false})
+ vim.diagnostic.set(ns, 0, diagnostics, { virtual_text = false })
<
then virtual text will not be enabled for those diagnostics.
@@ -570,8 +570,8 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults})
local s = "WARNING filename:27:3: Variable 'foo' does not exist"
local pattern = "^(%w+) %w+:(%d+):(%d+): (.+)$"
- local groups = {"severity", "lnum", "col", "message"}
- vim.diagnostic.match(s, pattern, groups, {WARNING = vim.diagnostic.WARN})
+ local groups = { "severity", "lnum", "col", "message" }
+ vim.diagnostic.match(s, pattern, groups, { WARNING = vim.diagnostic.WARN })
<
Parameters: ~
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 68723e4889..04ba9539c5 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1314,14 +1314,14 @@ A jump table for the options with a short description can be found at |Q_op|.
*'cmdheight'* *'ch'*
'cmdheight' 'ch' number (default 1)
- global
+ global or local to tab page
Number of screen lines to use for the command-line. Helps avoiding
|hit-enter| prompts.
The value of this option is stored with the tab page, so that each tab
page can have a different value.
- When 'cmdheight' is zero, it disables echo area and all outputs need
- |hit-enter| prompt.
+ When 'cmdheight' is zero, there is no command-line unless it is being
+ used. Any messages will cause the |hit-enter| prompt.
*'cmdwinheight'* *'cwh'*
'cmdwinheight' 'cwh' number (default 7)
@@ -3571,7 +3571,7 @@ A jump table for the options with a short description can be found at |Q_op|.
help. (Note that previously setting the global option to the empty
value did this, which is now deprecated.)
When the first character is ":", the command is invoked as a Vim
- Ex command with [count] added as an argument if it is not zero.
+ Ex command prefixed with [count].
When "man" or "man -s" is used, Vim will automatically translate
a [count] for the "K" command to a section number.
See |option-backslash| about including spaces and backslashes.
@@ -4210,14 +4210,14 @@ A jump table for the options with a short description can be found at |Q_op|.
The 'mousemodel' option is set by the |:behave| command.
- *mousescroll*
+ *'mousescroll'*
'mousescroll' string (default "ver:3,hor:6")
global
This option controls the number of lines / columns to scroll by when
scrolling with a mouse. The option is a comma separated list of parts.
Each part consists of a direction and a count as follows:
direction:count,direction:count
- Direction is one of either "hor" or "ver", "hor" controls horizontal
+ Direction is one of either "hor" or "ver". "hor" controls horizontal
scrolling and "ver" controls vertical scrolling. Count sets the amount
to scroll by for the given direction, it should be a non negative
integer. Each direction should be set at most once. If a direction
@@ -4850,7 +4850,7 @@ A jump table for the options with a short description can be found at |Q_op|.
If 'rulerformat' is set, it will determine the contents of the ruler.
Each window has its own ruler. If a window has a status line, the
ruler is shown there. If a window doesn't have a status line and
- 'cmdheight' is 0, the ruler is not shown. Otherwise it is shown in
+ 'cmdheight' is zero, the ruler is not shown. Otherwise it is shown in
the last line of the screen. If the statusline is given by
'statusline' (i.e. not empty), this option takes precedence over
'ruler' and 'rulerformat'.
@@ -5559,7 +5559,7 @@ A jump table for the options with a short description can be found at |Q_op|.
global
Show (partial) command in the last line of the screen. Set this
option off if your terminal is slow.
- The option is disabled if 'cmdheight' is 0.
+ The option has no effect when 'cmdheight' is zero.
In Visual mode the size of the selected area is shown:
- When selecting characters within a line, the number of characters.
If the number of bytes is different it is also displayed: "2-6"
@@ -5606,7 +5606,7 @@ A jump table for the options with a short description can be found at |Q_op|.
global
If in Insert, Replace or Visual mode put a message on the last line.
The |hl-ModeMsg| highlight group determines the highlighting.
- The option is disabled if 'cmdheight' is 0.
+ The option has no effect when 'cmdheight' is zero.
*'showtabline'* *'stal'*
'showtabline' 'stal' number (default 1)
diff --git a/runtime/doc/usr_06.txt b/runtime/doc/usr_06.txt
index b99e0fb482..8eda33b4f0 100644
--- a/runtime/doc/usr_06.txt
+++ b/runtime/doc/usr_06.txt
@@ -135,7 +135,6 @@ You could also write your own color scheme. This is how you do it:
2. Edit the color scheme file. These entries are useful:
- term attributes in a B&W terminal
cterm attributes in a color terminal
ctermfg foreground color in a color terminal
ctermbg background color in a color terminal
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index ae20b5c517..3f71d4f70d 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -586,12 +586,12 @@ end
---
--- For example, if a user enables virtual text globally with
--- <pre>
---- vim.diagnostic.config({virtual_text = true})
+--- vim.diagnostic.config({ virtual_text = true })
--- </pre>
---
--- and a diagnostic producer sets diagnostics with
--- <pre>
---- vim.diagnostic.set(ns, 0, diagnostics, {virtual_text = false})
+--- vim.diagnostic.set(ns, 0, diagnostics, { virtual_text = false })
--- </pre>
---
--- then virtual text will not be enabled for those diagnostics.
@@ -1525,8 +1525,8 @@ end
--- <pre>
--- local s = "WARNING filename:27:3: Variable 'foo' does not exist"
--- local pattern = "^(%w+) %w+:(%d+):(%d+): (.+)$"
---- local groups = {"severity", "lnum", "col", "message"}
---- vim.diagnostic.match(s, pattern, groups, {WARNING = vim.diagnostic.WARN})
+--- local groups = { "severity", "lnum", "col", "message" }
+--- vim.diagnostic.match(s, pattern, groups, { WARNING = vim.diagnostic.WARN })
--- </pre>
---
---@param str string String to parse diagnostics from.
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c
index 5c9eba163b..867584dd71 100644
--- a/src/nvim/api/options.c
+++ b/src/nvim/api/options.c
@@ -280,7 +280,7 @@ Object nvim_buf_get_option(Buffer buffer, String name, Error *err)
return get_option_from(buf, SREQ_BUF, name, err);
}
-/// Sets a buffer option value. Passing 'nil' as value deletes the option (only
+/// Sets a buffer option value. Passing `nil` as value deletes the option (only
/// works if there's a global fallback)
///
/// @param channel_id
@@ -318,7 +318,7 @@ Object nvim_win_get_option(Window window, String name, Error *err)
return get_option_from(win, SREQ_WIN, name, err);
}
-/// Sets a window option value. Passing 'nil' as value deletes the option(only
+/// Sets a window option value. Passing `nil` as value deletes the option (only
/// works if there's a global fallback)
///
/// @param channel_id
@@ -338,7 +338,7 @@ void nvim_win_set_option(uint64_t channel_id, Window window, String name, Object
set_option_to(channel_id, win, SREQ_WIN, name, value, err);
}
-/// Gets the value of a global or local(buffer, window) option.
+/// Gets the value of a global or local (buffer, window) option.
///
/// @param from If `type` is `SREQ_WIN` or `SREQ_BUF`, this must be a pointer
/// to the window or buffer.
@@ -393,7 +393,7 @@ Object get_option_from(void *from, int type, String name, Error *err)
return rv;
}
-/// Sets the value of a global or local(buffer, window) option.
+/// Sets the value of a global or local (buffer, window) option.
///
/// @param to If `type` is `SREQ_WIN` or `SREQ_BUF`, this must be a pointer
/// to the window or buffer.
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 2c62f56d5f..b3cfec8709 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -2899,6 +2899,11 @@ static void getchar_common(typval_T *argvars, typval_T *rettv)
no_mapping--;
allow_keys--;
+ if (!ui_has_messages()) {
+ // redraw the screen after getchar()
+ update_screen(CLEAR);
+ }
+
set_vim_var_nr(VV_MOUSE_WIN, 0);
set_vim_var_nr(VV_MOUSE_WINID, 0);
set_vim_var_nr(VV_MOUSE_LNUM, 0);
@@ -9498,8 +9503,12 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
p = highlight_has_attr(id, HL_ITALIC, modec);
}
break;
- case 'n': // name
- p = get_highlight_name_ext(NULL, id - 1, false);
+ case 'n':
+ if (TOLOWER_ASC(what[1]) == 'o') { // nocombine
+ p = highlight_has_attr(id, HL_NOCOMBINE, modec);
+ } else { // name
+ p = get_highlight_name_ext(NULL, id - 1, false);
+ }
break;
case 'r': // reverse
p = highlight_has_attr(id, HL_INVERSE, modec);
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 585694a138..c765b1652d 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3669,7 +3669,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
}
}
- bool cmdheight0 = p_ch < 1 && !ui_has(kUIMessages);
+ const bool cmdheight0 = !ui_has_messages();
if (cmdheight0) {
// If cmdheight is 0, cmdheight must be set to 1 when we enter command line.
set_option_value("ch", 1L, NULL, 0);
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 2349de299b..6240ac6b37 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -689,12 +689,22 @@ static void finish_incsearch_highlighting(int gotesc, incsearch_state_T *s, bool
/// @param init_ccline clear ccline first
static uint8_t *command_line_enter(int firstc, long count, int indent, bool init_ccline)
{
- bool cmdheight0 = p_ch < 1 && !ui_has(kUIMessages);
+ const bool cmdheight0 = !ui_has_messages();
if (cmdheight0) {
- // If cmdheight is 0, cmdheight must be set to 1 when we enter command line.
+ const long save_so = lastwin->w_p_so;
+
+ // If cmdheight is 0, cmdheight must be set to 1 when we enter the
+ // command line. Set "made_cmdheight_nonzero" and reset 'scrolloff' to
+ // avoid scrolling the last window.
+ made_cmdheight_nonzero = true;
+
+ lastwin->w_p_so = 0;
set_option_value("ch", 1L, NULL, 0);
update_screen(VALID); // redraw the screen NOW
+
+ made_cmdheight_nonzero = false;
+ lastwin->w_p_so = save_so;
}
// can be invoked recursively, identify each level
@@ -991,11 +1001,14 @@ theend:
}
if (cmdheight0) {
+ made_cmdheight_nonzero = true;
+
// Restore cmdheight
set_option_value("ch", 0L, NULL, 0);
-
// Redraw is needed for command line completion
redraw_all_later(CLEAR);
+
+ made_cmdheight_nonzero = false;
}
return p;
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index e0c95187cc..b98984017b 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -5270,7 +5270,6 @@ void forward_slash(char_u *fname)
return;
}
for (p = fname; *p != NUL; p++) {
- // The Big5 encoding can have '\' in the trail byte.
if (*p == '\\') {
*p = '/';
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 9946085703..a41836353a 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1084,4 +1084,7 @@ EXTERN char windowsVersion[20] INIT(= { 0 });
EXTERN int exit_need_delay INIT(= 0);
+// Set when 'cmdheight' is changed from zero to one temporarily.
+EXTERN bool made_cmdheight_nonzero INIT(= false);
+
#endif // NVIM_GLOBALS_H
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index 6226130322..71c7194479 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -778,6 +778,10 @@ Dictionary hlattrs2dict(Dictionary *hl_alloc, HlAttrs ae, bool use_rgb)
PUT_C(hl, "strikethrough", BOOLEAN_OBJ(true));
}
+ if (mask & HL_NOCOMBINE) {
+ PUT_C(hl, "nocombine", BOOLEAN_OBJ(true));
+ }
+
if (use_rgb) {
if (mask & HL_FG_INDEXED) {
PUT_C(hl, "fg_indexed", BOOLEAN_OBJ(true));
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index b18770d4f1..17157ccdc2 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1686,7 +1686,7 @@ int nlua_expand_pat(expand_T *xp, char_u *pat, int *num_results, char ***results
lua_getfield(lstate, -1, "_expand_pat");
luaL_checktype(lstate, -1, LUA_TFUNCTION);
- // [ vim, vim._on_key, buf ]
+ // [ vim, vim._expand_pat, buf ]
lua_pushlstring(lstate, (const char *)pat, STRLEN(pat));
if (nlua_pcall(lstate, 1, 2) != 0) {
@@ -1839,7 +1839,7 @@ void nlua_execute_on_key(int c)
// [ vim ]
lua_getglobal(lstate, "vim");
- // [ vim, vim._on_key]
+ // [ vim, vim._on_key ]
lua_getfield(lstate, -1, "_on_key");
luaL_checktype(lstate, -1, LUA_TFUNCTION);
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 80d11c096b..621a9212df 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -493,6 +493,7 @@ int smsg(const char *s, ...)
va_start(arglist, s);
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
va_end(arglist);
+
return msg((char *)IObuff);
}
@@ -1389,7 +1390,7 @@ void msg_start(void)
need_fileinfo = false;
}
- bool no_msg_area = !ui_has(kUIMessages) && p_ch < 1;
+ const bool no_msg_area = !ui_has_messages();
if (need_clr_eos || (no_msg_area && redrawing_cmdline)) {
// Halfway an ":echo" command and getting an (error) message: clear
@@ -3112,7 +3113,7 @@ void msg_clr_eos_force(void)
msg_row = msg_grid_pos;
}
- if (p_ch > 0) {
+ if (ui_has_messages()) {
grid_fill(&msg_grid_adj, msg_row, msg_row + 1, msg_startcol, msg_endcol,
' ', ' ', HL_ATTR(HLF_MSG));
grid_fill(&msg_grid_adj, msg_row + 1, Rows, 0, Columns,
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index e3bd4de9a0..fae22ce06f 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2810,7 +2810,7 @@ void pop_showcmd(void)
static void display_showcmd(void)
{
- if (p_ch < 1 && !ui_has(kUIMessages)) {
+ if (!ui_has_messages()) {
return;
}
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 834415881e..cc67b0d0c1 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -893,6 +893,7 @@ int do_record(int c)
{
char_u *p;
static int regname;
+ static bool changed_cmdheight = false;
yankreg_T *old_y_previous;
int retval;
@@ -906,6 +907,15 @@ int do_record(int c)
showmode();
regname = c;
retval = OK;
+
+ if (!ui_has_messages()) {
+ // Enable macro indicator temporarily
+ set_option_value("ch", 1L, NULL, 0);
+ update_screen(VALID);
+
+ changed_cmdheight = true;
+ }
+
apply_autocmds(EVENT_RECORDINGENTER, NULL, NULL, false, curbuf);
}
} else { // stop recording
@@ -951,6 +961,12 @@ int do_record(int c)
y_previous = old_y_previous;
}
+
+ if (changed_cmdheight) {
+ // Restore cmdheight
+ set_option_value("ch", 0L, NULL, 0);
+ redraw_all_later(CLEAR);
+ }
}
return retval;
}
@@ -2789,7 +2805,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
xfree(reg->y_array);
}
- if (message && (p_ch > 0 || ui_has(kUIMessages))) { // Display message about yank?
+ if (message) { // Display message about yank?
if (yank_type == kMTCharWise && yanklines == 1) {
yanklines = 0;
}
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index dcc84e3e6f..80f6f75fea 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -6142,10 +6142,6 @@ void unshowmode(bool force)
// Clear the mode message.
void clearmode(void)
{
- if (p_ch <= 0 && !ui_has(kUIMessages)) {
- return;
- }
-
const int save_msg_row = msg_row;
const int save_msg_col = msg_col;
@@ -6163,10 +6159,6 @@ void clearmode(void)
static void recording_mode(int attr)
{
- if (p_ch <= 0 && !ui_has(kUIMessages)) {
- return;
- }
-
msg_puts_attr(_("recording"), attr);
if (!shortmess(SHM_RECORDING)) {
char s[4];
@@ -6471,8 +6463,7 @@ int redrawing(void)
*/
int messaging(void)
{
- return !(p_lz && char_avail() && !KeyTyped)
- && (p_ch > 0 || ui_has(kUIMessages));
+ return !(p_lz && char_avail() && !KeyTyped) && ui_has_messages();
}
/// Show current status info in ruler and various other places
@@ -6509,7 +6500,7 @@ static void win_redr_ruler(win_T *wp, bool always)
bool is_stl_global = global_stl_height() > 0;
static bool did_show_ext_ruler = false;
- // If 'ruler' off or redrawing disabled, don't do anything
+ // If 'ruler' off, don't do anything
if (!p_ru) {
return;
}
@@ -6586,7 +6577,7 @@ static void win_redr_ruler(win_T *wp, bool always)
off = 0;
}
- if (!part_of_status && p_ch < 1 && !ui_has(kUIMessages)) {
+ if (!part_of_status && !ui_has_messages()) {
return;
}
diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim
index 362c58aa31..179218e48a 100644
--- a/src/nvim/testdir/test_ins_complete.vim
+++ b/src/nvim/testdir/test_ins_complete.vim
@@ -346,7 +346,7 @@ func Test_CompleteDone_modify()
\ 'user_data': '',
\ }
let v:completed_item = value
- call assert_equal(v:completed_item, value)
+ call assert_equal(value, v:completed_item)
endfunc
func CompleteTest(findstart, query)
diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim
index 2f9c562771..a02d23b409 100644
--- a/src/nvim/testdir/test_messages.vim
+++ b/src/nvim/testdir/test_messages.vim
@@ -316,4 +316,60 @@ func Test_fileinfo_after_echo()
call delete('b.txt')
endfunc
+func Test_cmdheight_zero()
+ set cmdheight=0
+ set showcmd
+ redraw!
+
+ echo 'test echo'
+ call assert_equal(116, screenchar(&lines, 1))
+ redraw!
+
+ echomsg 'test echomsg'
+ call assert_equal(116, screenchar(&lines, 1))
+ redraw!
+
+ call feedkeys(":ls\<CR>", "xt")
+ call assert_equal(':ls', Screenline(&lines - 1))
+ redraw!
+
+ let char = getchar(0)
+ call assert_match(char, 0)
+
+ " Check change/restore cmdheight when macro
+ call feedkeys("qa", "xt")
+ call assert_equal(1, &cmdheight)
+ call feedkeys("q", "xt")
+ call assert_equal(0, &cmdheight)
+
+ call setline(1, 'somestring')
+ call feedkeys("y", "n")
+ %s/somestring/otherstring/gc
+ call assert_equal('otherstring', getline(1))
+
+ call feedkeys("g\<C-g>", "xt")
+ call assert_match(
+ \ 'Col 1 of 11; Line 1 of 1; Word 1 of 1',
+ \ Screenline(&lines))
+
+ " Check split behavior
+ for i in range(1, 10)
+ split
+ endfor
+ only
+ call assert_equal(0, &cmdheight)
+
+ " Check that pressing ":" should not scroll a window
+ " Check for what patch 9.0.0115 fixes
+ botright 10new
+ call setline(1, range(12))
+ 7
+ call feedkeys(":\"\<C-R>=line('w0')\<CR>\<CR>", "xt")
+ call assert_equal('"1', @:)
+ bwipe!
+
+ set cmdheight&
+ set showcmd&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_syn_attr.vim b/src/nvim/testdir/test_syn_attr.vim
index fa0b08fde5..88f9d0d84d 100644
--- a/src/nvim/testdir/test_syn_attr.vim
+++ b/src/nvim/testdir/test_syn_attr.vim
@@ -1,19 +1,39 @@
" Test syntax highlighting functions.
func Test_missing_attr()
- hi Mine cterm=italic
+ throw 'Skipped: use test/functional/legacy/syn_attr_spec.lua'
+
+ hi Mine term=bold cterm=italic
call assert_equal('Mine', synIDattr(hlID("Mine"), "name"))
+ call assert_equal('', synIDattr("Mine"->hlID(), "bg", 'term'))
+ call assert_equal('', synIDattr("Mine"->hlID(), "fg", 'term'))
+ call assert_equal('', synIDattr("Mine"->hlID(), "sp", 'term'))
+ call assert_equal('1', synIDattr(hlID("Mine"), "bold", 'term'))
call assert_equal('1', synIDattr(hlID("Mine"), "italic", 'cterm'))
- hi Mine cterm=inverse
+ hi Mine term=reverse cterm=inverse
+ call assert_equal('1', synIDattr(hlID("Mine"), "reverse", 'term'))
call assert_equal('1', synIDattr(hlID("Mine"), "inverse", 'cterm'))
- hi Mine cterm=standout gui=undercurl
+
+ hi Mine term=underline cterm=standout gui=undercurl
+ call assert_equal('1', synIDattr(hlID("Mine"), "underline", 'term'))
call assert_equal('1', synIDattr(hlID("Mine"), "standout", 'cterm'))
call assert_equal('1', synIDattr("Mine"->hlID(), "undercurl", 'gui'))
- hi Mine gui=strikethrough
+
+ hi Mine term=underdouble cterm=underdotted gui=underdashed
+ call assert_equal('1', synIDattr(hlID("Mine"), "underdouble", 'term'))
+ call assert_equal('1', synIDattr(hlID("Mine"), "underdotted", 'cterm'))
+ call assert_equal('1', synIDattr("Mine"->hlID(), "underdashed", 'gui'))
+
+ hi Mine term=nocombine gui=strikethrough
call assert_equal('1', synIDattr(hlID("Mine"), "strikethrough", 'gui'))
- hi Mine cterm=NONE gui=NONE
+ call assert_equal('1', synIDattr(hlID("Mine"), "nocombine", 'term'))
+ call assert_equal('', synIDattr(hlID("Mine"), "nocombine", 'gui'))
+ hi Mine term=NONE cterm=NONE gui=NONE
+ call assert_equal('', synIDattr(hlID("Mine"), "bold", 'term'))
call assert_equal('', synIDattr(hlID("Mine"), "italic", 'cterm'))
+ call assert_equal('', synIDattr(hlID("Mine"), "reverse", 'term'))
call assert_equal('', synIDattr(hlID("Mine"), "inverse", 'cterm'))
+ call assert_equal('', synIDattr(hlID("Mine"), "underline", 'term'))
call assert_equal('', synIDattr(hlID("Mine"), "standout", 'cterm'))
call assert_equal('', synIDattr(hlID("Mine"), "undercurl", 'gui'))
call assert_equal('', synIDattr(hlID("Mine"), "strikethrough", 'gui'))
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index 3bfff0a577..d96fc2d789 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -1390,11 +1390,9 @@ func Test_win_move_statusline()
call assert_equal(h0, winheight(0))
call assert_equal(1, &cmdheight)
endfor
- " Nvim supports cmdheight=0
+ " supports cmdheight=0
set cmdheight=0
call assert_true(win_move_statusline(0, 1))
- "call assert_equal(h0, winheight(0))
- "call assert_equal(1, &cmdheight)
call assert_equal(h0 + 1, winheight(0))
call assert_equal(0, &cmdheight)
set cmdheight&
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index e958f02e32..4fcfee1192 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -612,6 +612,12 @@ bool ui_has(UIExtension ext)
return ui_ext[ext];
}
+/// Returns true if the UI has messages area.
+bool ui_has_messages(void)
+{
+ return p_ch > 0 || ui_has(kUIMessages);
+}
+
Array ui_array(void)
{
Array all_uis = ARRAY_DICT_INIT;
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 7225cfb9c7..ff147e22df 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5555,7 +5555,6 @@ static void frame_setheight(frame_T *curfrp, int height)
}
if (curfrp->fr_parent == NULL) {
- // topframe: can only change the command line
if (height > ROWS_AVAIL) {
// If height is greater than the available space, try to create space for
// the frame by reducing 'cmdheight' if possible, while making sure
@@ -5877,7 +5876,7 @@ void win_setminheight(void)
// loop until there is a 'winminheight' that is possible
while (p_wmh > 0) {
const int room = Rows - (int)p_ch;
- const int needed = min_rows() - 1; // 1 was added for the cmdline
+ const int needed = min_rows();
if (room >= needed) {
break;
}
@@ -6307,7 +6306,8 @@ void win_set_inner_size(win_T *wp)
// There is no point in adjusting the scroll position when exiting. Some
// values might be invalid.
- if (!exiting) {
+ // Skip scroll_to_fraction() when 'cmdheight' was set to one from zero.
+ if (!exiting && !made_cmdheight_nonzero) {
scroll_to_fraction(wp, prev_height);
}
redraw_later(wp, NOT_VALID); // SOME_VALID??
@@ -6830,7 +6830,9 @@ int min_rows(void)
}
}
total += tabline_height() + global_stl_height();
- total += 1; // count the room for the command line
+ if (p_ch > 0) {
+ total += 1; // count the room for the command line
+ }
return total;
}
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index 933103046c..c4197f0b3e 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -34,6 +34,7 @@ describe('API: highlight',function()
underdotted = true,
underdashed = true,
strikethrough = true,
+ nocombine = true,
}
before_each(function()
@@ -55,7 +56,7 @@ describe('API: highlight',function()
eq('Invalid highlight id: 30000', string.match(emsg, 'Invalid.*'))
-- Test all highlight properties.
- command('hi NewHighlight gui=underline,bold,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough')
+ command('hi NewHighlight gui=underline,bold,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough,nocombine')
eq(expected_rgb2, nvim("get_hl_by_id", hl_id, true))
-- Test nil argument.
@@ -136,10 +137,10 @@ describe('API: highlight',function()
-- Test cterm & Normal values. #18024 (tail) & #18980
-- Ensure Normal, and groups that match Normal return their fg & bg cterm values
meths.set_hl(0, 'Normal', {ctermfg = 17, ctermbg = 213})
- meths.set_hl(0, 'NotNormal', {ctermfg = 17, ctermbg = 213})
+ meths.set_hl(0, 'NotNormal', {ctermfg = 17, ctermbg = 213, nocombine = true})
-- Note colors are "cterm" values, not rgb-as-ints
eq({foreground = 17, background = 213}, nvim("get_hl_by_name", 'Normal', false))
- eq({foreground = 17, background = 213}, nvim("get_hl_by_name", 'NotNormal', false))
+ eq({foreground = 17, background = 213, nocombine = true}, nvim("get_hl_by_name", 'NotNormal', false))
end)
it('nvim_get_hl_id_by_name', function()
@@ -214,6 +215,7 @@ describe("API: set highlight", function()
reverse = true,
undercurl = true,
strikethrough = true,
+ nocombine = true,
}
}
local highlight3_result_gui = {
@@ -236,6 +238,7 @@ describe("API: set highlight", function()
reverse = true,
undercurl = true,
strikethrough = true,
+ nocombine = true,
}
local function get_ns()
@@ -290,7 +293,7 @@ describe("API: set highlight", function()
exec_capture('highlight Test_hl'))
meths.set_hl(0, 'Test_hl2', highlight3_config)
- eq('Test_hl2 xxx cterm=undercurl,italic,reverse,strikethrough ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough guifg=#ff0000 guibg=#0032aa',
+ eq('Test_hl2 xxx cterm=undercurl,italic,reverse,strikethrough,nocombine ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough guifg=#ff0000 guibg=#0032aa',
exec_capture('highlight Test_hl2'))
-- Colors are stored with the name they are defined, but
diff --git a/test/functional/legacy/syn_attr_spec.lua b/test/functional/legacy/syn_attr_spec.lua
new file mode 100644
index 0000000000..06e8427e27
--- /dev/null
+++ b/test/functional/legacy/syn_attr_spec.lua
@@ -0,0 +1,60 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear = helpers.clear
+local command = helpers.command
+local eq = helpers.eq
+local eval = helpers.eval
+
+before_each(clear)
+
+-- oldtest: Test_missing_attr()
+it('synIDattr() works', function()
+ local bool_attrs = {
+ 'bold',
+ 'italic',
+ 'reverse',
+ 'standout',
+ 'underline',
+ 'undercurl',
+ 'underdouble',
+ 'underdotted',
+ 'underdashed',
+ 'strikethrough',
+ 'nocombine',
+ }
+
+ command('hi Mine cterm=NONE gui=NONE')
+ eq('Mine', eval([[synIDattr(hlID("Mine"), "name")]]))
+ for _, mode in ipairs({'cterm', 'gui'}) do
+ eq('', eval(([[synIDattr("Mine"->hlID(), "bg", '%s')]]):format(mode)))
+ eq('', eval(([[synIDattr("Mine"->hlID(), "fg", '%s')]]):format(mode)))
+ eq('', eval(([[synIDattr("Mine"->hlID(), "sp", '%s')]]):format(mode)))
+ for _, attr in ipairs(bool_attrs) do
+ eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode)))
+ eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode)))
+ eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode)))
+ end
+ eq('', eval(([[synIDattr(hlID("Mine"), "inverse", '%s')]]):format(mode)))
+ end
+
+ for i, attr1 in ipairs(bool_attrs) do
+ local attr2 = bool_attrs[i - 1] or bool_attrs[#bool_attrs]
+
+ command(('hi Mine cterm=%s gui=%s'):format(attr1, attr2))
+ eq('1', eval(([[synIDattr(hlID("Mine"), "%s", 'cterm')]]):format(attr1)))
+ eq('', eval(([[synIDattr(hlID("Mine"), "%s", 'cterm')]]):format(attr2)))
+ eq('', eval(([[synIDattr("Mine"->hlID(), "%s", 'gui')]]):format(attr1)))
+ eq('1', eval(([[synIDattr("Mine"->hlID(), "%s", 'gui')]]):format(attr2)))
+
+ command(('hi Mine cterm=%s gui=%s'):format(attr2, attr1))
+ eq('', eval(([[synIDattr("Mine"->hlID(), "%s", 'cterm')]]):format(attr1)))
+ eq('1', eval(([[synIDattr("Mine"->hlID(), "%s", 'cterm')]]):format(attr2)))
+ eq('1', eval(([[synIDattr(hlID("Mine"), "%s", 'gui')]]):format(attr1)))
+ eq('', eval(([[synIDattr(hlID("Mine"), "%s", 'gui')]]):format(attr2)))
+ end
+
+ command('hi Mine cterm=reverse gui=inverse')
+ eq('1', eval([[synIDattr(hlID("Mine"), "reverse", 'cterm')]]))
+ eq('1', eval([[synIDattr(hlID("Mine"), "inverse", 'cterm')]]))
+ eq('1', eval([[synIDattr(hlID("Mine"), "reverse", 'gui')]]))
+ eq('1', eval([[synIDattr(hlID("Mine"), "inverse", 'gui')]]))
+end)
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index f2b9173be1..db13647cc6 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -1103,7 +1103,7 @@ describe('cmdheight=0', function()
~ |
~ |
~ |
- ~ |
+ recording @q |
]], showmode={}}
feed('q')
screen:expect{grid=[[