mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
feat(prompt): multiline prompt input #33371
Problem: Cannot enter multiline prompts in a buftype=prompt buffer. Solution: - Support shift+enter (`<s-enter>`) to start a new line in the prompt. - Pasting multiline text via OS paste, clipboard, "xp, etc. - A/I in editable region works as usual. - i/a/A/I outside of editable region moves cursor to end of current prompt. - Support undo/redo in prompt buffer. - Support o/O in prompt buffer. - Expose prompt location as `':` mark.
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "nvim/indent_c.h"
|
||||
#include "nvim/insexpand.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/mbyte.h"
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/memory.h"
|
||||
@@ -695,6 +696,11 @@ const char *did_set_buftype(optset_T *args)
|
||||
|| opt_strings_flags(buf->b_p_bt, opt_bt_values, NULL, false) != OK) {
|
||||
return e_invarg;
|
||||
}
|
||||
// buftype=prompt: set the prompt start position to lastline.
|
||||
if (buf->b_p_bt[0] == 'p') {
|
||||
pos_T next_prompt = { .lnum = buf->b_ml.ml_line_count, .col = 1, .coladd = 0 };
|
||||
RESET_FMARK(&buf->b_prompt_start, next_prompt, 0, ((fmarkv_T)INIT_FMARKV));
|
||||
}
|
||||
if (win->w_status_height || global_stl_height()) {
|
||||
win->w_redr_status = true;
|
||||
redraw_later(win, UPD_VALID);
|
||||
|
Reference in New Issue
Block a user