mirror of
https://github.com/neovim/neovim.git
synced 2025-12-19 21:05:37 +00:00
fix(messages): recognize cmdline one_key/number prompt State (#34206)
Problem: Since48e2a736, prompt messages are handled by an actual active cmdline, resulting in `State` no longer being equal to `MODE_CONFIRM` which is used in some places. E.g. to specify the current `mode()` or to re-emit a confirm message. Solution: Replace `MODE_CONFIRM` with a new `MODE_CMDLINE` sub-mode when `ccline.one_key/mouse_used` is set. Use it to avoid clearing mouse_used prompt messages, and to re-emit one_key messages (when ext_messages is inactive, for which this is unnecessary). (cherry picked from commite876a739ee)
This commit is contained in:
committed by
github-actions[bot]
parent
adf31505d8
commit
89959ab9dc
@@ -268,12 +268,19 @@ void screenclear(void)
|
||||
}
|
||||
}
|
||||
|
||||
/// Unlike cmdline "one_key" prompts, the message part of the prompt is not stored
|
||||
/// to be re-emitted: avoid clearing the prompt from the message grid.
|
||||
static bool cmdline_number_prompt(void)
|
||||
{
|
||||
return !ui_has(kUIMessages) && State == MODE_CMDLINE && get_cmdline_info()->mouse_used != NULL;
|
||||
}
|
||||
|
||||
/// Set dimensions of the Nvim application "screen".
|
||||
void screen_resize(int width, int height)
|
||||
{
|
||||
// Avoid recursiveness, can happen when setting the window size causes
|
||||
// another window-changed signal.
|
||||
if (updating_screen || resizing_screen) {
|
||||
if (updating_screen || resizing_screen || cmdline_number_prompt()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -350,7 +357,7 @@ void screen_resize(int width, int height)
|
||||
resizing_autocmd = false;
|
||||
redraw_all_later(UPD_CLEAR);
|
||||
|
||||
if (State != MODE_ASKMORE && State != MODE_EXTERNCMD && State != MODE_CONFIRM) {
|
||||
if (State != MODE_ASKMORE && State != MODE_EXTERNCMD) {
|
||||
screenclear();
|
||||
}
|
||||
|
||||
@@ -366,8 +373,11 @@ void screen_resize(int width, int height)
|
||||
// - While editing the command line, only redraw that. TODO: lies
|
||||
// - in Ex mode, don't redraw anything.
|
||||
// - Otherwise, redraw right now, and position the cursor.
|
||||
if (State == MODE_ASKMORE || State == MODE_EXTERNCMD || State == MODE_CONFIRM
|
||||
|| exmode_active) {
|
||||
if (State == MODE_ASKMORE || State == MODE_EXTERNCMD || exmode_active
|
||||
|| (State == MODE_CMDLINE && get_cmdline_info()->one_key)) {
|
||||
if (State == MODE_CMDLINE) {
|
||||
update_screen();
|
||||
}
|
||||
if (msg_grid.chars) {
|
||||
msg_grid_validate();
|
||||
}
|
||||
@@ -453,7 +463,7 @@ int update_screen(void)
|
||||
|
||||
// Postpone the redrawing when it's not needed and when being called
|
||||
// recursively.
|
||||
if (!redrawing() || updating_screen) {
|
||||
if (!redrawing() || updating_screen || cmdline_number_prompt()) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -492,7 +502,7 @@ int update_screen(void)
|
||||
}
|
||||
|
||||
// if the screen was scrolled up when displaying a message, scroll it down
|
||||
if (msg_scrolled || msg_grid_invalid) {
|
||||
if ((msg_scrolled || msg_grid_invalid) && !cmdline_number_prompt()) {
|
||||
clear_cmdline = true;
|
||||
int valid = MAX(Rows - msg_scrollsize(), 0);
|
||||
if (msg_grid.chars) {
|
||||
@@ -699,6 +709,7 @@ int update_screen(void)
|
||||
if (still_may_intro) {
|
||||
intro_message(false);
|
||||
}
|
||||
repeat_message();
|
||||
|
||||
decor_providers_invoke_end();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user