mirror of
https://github.com/neovim/neovim.git
synced 2026-07-17 14:41:33 +00:00
fix(ui2): remove obsolete usages of sc_col
Like `v:echospace`, `sc_col` was used in many places to avoid disruptive "Press ENTER" prompts. Since those are no longer a problem with ui2, the complexity of keeping these variables up-to-date and maintaining bespoke truncation code at the message producers is no longer justified. Unfortunately, some messages still need to be kept under 1 line to avoid glitches. `ru_wid`, `ru_col`, and `sc_col` are now no longer used when ui2 is enabled, except `ru_col` in the C implementation of the default ruler, which will be replaced by a default expression.
This commit is contained in:
@@ -5241,7 +5241,13 @@ void ins_compl_insert(bool move_cursor, bool insert_prefix)
|
||||
static void ins_compl_show_filename(void)
|
||||
{
|
||||
char *const lead = _("match in file");
|
||||
int space = sc_col - vim_strsize(lead) - 2;
|
||||
|
||||
// In the case of ext_messages, `sc_col` is obsolete. Fortunately, long messages are no longer
|
||||
// disruptive, so truncation could be skipped. But in this particular case, with default
|
||||
// configuration `showmode cmdheight=1`, a multi-line message is shown partially, and a message
|
||||
// that fits into one line is not shown at all. It's better to be consistent: it should not depend
|
||||
// on the exact length of the message whether it is displayed at all.
|
||||
int space = (ui_has(kUIMessages) ? Columns : sc_col) - vim_strsize(lead) - 2;
|
||||
if (space <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,12 @@ char *msg_strtrunc(const char *s, int force)
|
||||
room = (Rows - msg_row) * Columns - 1;
|
||||
} else {
|
||||
// Use up to 'showcmd' column.
|
||||
room = (Rows - msg_row - 1) * Columns + sc_col - 1;
|
||||
// In the case of ui2, we no longer need to avoid the "Press ENTER" prompt, but the message is
|
||||
// still kept under 1 line to avoid glitches. For example, when a long search term is
|
||||
// displayed that expands the cmdline, it will be immediately collapsed again when the search
|
||||
// count is displayed, which leads to flickering on each hit.
|
||||
int last_row = ui_has(kUIMessages) ? Columns : sc_col - 1;
|
||||
room = (Rows - msg_row - 1) * Columns + last_row;
|
||||
}
|
||||
if (len > room && room > 0) {
|
||||
// may have up to 18 bytes per cell (6 per char, up to two
|
||||
|
||||
Reference in New Issue
Block a user