diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-10-29 02:13:12 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-10-29 02:13:12 +0200 |
commit | 7b0ceb3726e6d331625d5754be534e28a7f6092a (patch) | |
tree | 2edc27166a5034c1fe4d670769dac2076c30cf7e /src/nvim/eval.c | |
parent | 122f52bf897abd1cda4fa467157657fee6bcfe94 (diff) | |
parent | 1a93f5883105c304d496d6c2e841626ebb7d44c1 (diff) | |
download | rneovim-7b0ceb3726e6d331625d5754be534e28a7f6092a.tar.gz rneovim-7b0ceb3726e6d331625d5754be534e28a7f6092a.tar.bz2 rneovim-7b0ceb3726e6d331625d5754be534e28a7f6092a.zip |
Merge #7173 'api/ui: externalize cmdline'
closes #6162
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index ef2f671f36..c7cb51ac29 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -11147,17 +11147,18 @@ void get_user_input(const typval_T *const argvars, cmd_silent = false; // Want to see the prompt. // Only the part of the message after the last NL is considered as - // prompt for the command line. - const char *p = strrchr(prompt, '\n'); - if (p == NULL) { - p = prompt; - } else { - p++; - msg_start(); - msg_clr_eos(); - msg_puts_attr_len(prompt, p - prompt, echo_attr); - msg_didout = false; - msg_starthere(); + // prompt for the command line, unlsess cmdline is externalized + const char *p = prompt; + if (!ui_is_external(kUICmdline)) { + const char *lastnl = strrchr(prompt, '\n'); + if (lastnl != NULL) { + p = lastnl+1; + msg_start(); + msg_clr_eos(); + msg_puts_attr_len(prompt, p - prompt, echo_attr); + msg_didout = false; + msg_starthere(); + } } cmdline_row = msg_row; @@ -19643,6 +19644,7 @@ void ex_function(exarg_T *eap) int todo; hashitem_T *hi; int sourcing_lnum_off; + bool show_block = false; /* * ":function" without argument: list functions. @@ -19816,6 +19818,11 @@ void ex_function(exarg_T *eap) goto errret_2; } + if (KeyTyped && ui_is_external(kUICmdline)) { + show_block = true; + ui_ext_cmdline_block_append(0, (const char *)eap->cmd); + } + // find extra arguments "range", "dict", "abort" and "closure" for (;; ) { p = skipwhite(p); @@ -19868,7 +19875,9 @@ void ex_function(exarg_T *eap) if (!eap->skip && did_emsg) goto erret; - msg_putchar('\n'); /* don't overwrite the function name */ + if (!ui_is_external(kUICmdline)) { + msg_putchar('\n'); // don't overwrite the function name + } cmdline_row = msg_row; } @@ -19902,6 +19911,9 @@ void ex_function(exarg_T *eap) EMSG(_("E126: Missing :endfunction")); goto erret; } + if (show_block) { + ui_ext_cmdline_block_append(indent, (const char *)theline); + } /* Detect line continuation: sourcing_lnum increased more than one. */ if (sourcing_lnum > sourcing_lnum_off + 1) @@ -20194,6 +20206,9 @@ ret_free: xfree(name); did_emsg |= saved_did_emsg; need_wait_return |= saved_wait_return; + if (show_block) { + ui_ext_cmdline_block_leave(); + } } /// Get a function name, translating "<SID>" and "<SNR>". |