aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 4af7794317..041140211e 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -55,6 +55,7 @@
#include "nvim/option.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
+#include "nvim/plines.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
@@ -103,7 +104,7 @@ typedef struct {
// the preview window
typedef struct {
kvec_t(SubResult) subresults;
- linenr_T lines_needed; // lines neede in the preview window
+ linenr_T lines_needed; // lines needed in the preview window
} PreviewLines;
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -828,7 +829,7 @@ void ex_retab(exarg_T *eap)
}
if (ptr[col] == NUL)
break;
- vcol += chartabsize(ptr + col, (colnr_T)vcol);
+ vcol += win_chartabsize(curwin, ptr + col, (colnr_T)vcol);
col += utfc_ptr2len(ptr + col);
}
if (new_line == NULL) /* out of memory */
@@ -1635,14 +1636,14 @@ void print_line(linenr_T lnum, int use_number, int list)
msg_start();
silent_mode = FALSE;
- info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
+ info_message = true; // use mch_msg(), not mch_errmsg()
print_line_no_prefix(lnum, use_number, list);
if (save_silent) {
msg_putchar('\n');
ui_flush();
silent_mode = save_silent;
}
- info_message = FALSE;
+ info_message = false;
}
int rename_buffer(char_u *new_fname)
@@ -1892,7 +1893,7 @@ int do_write(exarg_T *eap)
if (eap->cmdidx == CMD_saveas) {
if (retval == OK) {
curbuf->b_p_ro = FALSE;
- redraw_tabline = TRUE;
+ redraw_tabline = true;
}
}
@@ -2607,7 +2608,7 @@ int do_ecmd(
&& (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur)) {
// Sync first so that this is a separate undo-able action.
u_sync(false);
- if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, true)
+ if (u_savecommon(curbuf, 0, curbuf->b_ml.ml_line_count + 1, 0, true)
== FAIL) {
xfree(new_name);
goto theend;
@@ -2812,8 +2813,9 @@ int do_ecmd(
redraw_curbuf_later(NOT_VALID); // redraw this buffer later
}
- if (p_im)
- need_start_insertmode = TRUE;
+ if (p_im) {
+ need_start_insertmode = true;
+ }
/* Change directories when the 'acd' option is set. */
do_autochdir();
@@ -2879,7 +2881,7 @@ void ex_append(exarg_T *eap)
for (;; ) {
msg_scroll = TRUE;
- need_wait_return = FALSE;
+ need_wait_return = false;
if (curbuf->b_p_ai) {
if (append_indent >= 0) {
indent = append_indent;
@@ -2887,7 +2889,6 @@ void ex_append(exarg_T *eap)
} else if (lnum > 0)
indent = get_indent_lnum(lnum);
}
- ex_keep_indent = FALSE;
if (eap->getline == NULL) {
/* No getline() function, use the lines that follow. This ends
* when there is no more. */
@@ -2915,10 +2916,6 @@ void ex_append(exarg_T *eap)
if (theline == NULL)
break;
- /* Using ^ CTRL-D in getexmodeline() makes us repeat the indent. */
- if (ex_keep_indent)
- append_indent = indent;
-
/* Look for the "." after automatic indent. */
vcol = 0;
for (p = theline; indent > vcol; ++p) {
@@ -2972,8 +2969,8 @@ void ex_append(exarg_T *eap)
check_cursor_lnum();
beginline(BL_SOL | BL_FIX);
- need_wait_return = FALSE; /* don't use wait_return() now */
- ex_no_reprint = TRUE;
+ need_wait_return = false; // don't use wait_return() now
+ ex_no_reprint = true;
}
/*
@@ -3751,6 +3748,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
*/
while (subflags.do_ask) {
if (exmode_active) {
+ char *prompt;
char_u *resp;
colnr_T sc, ec;
@@ -3767,13 +3765,14 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
sc += numw;
ec += numw;
}
- msg_start();
- for (i = 0; i < (long)sc; ++i)
- msg_putchar(' ');
- for (; i <= (long)ec; ++i)
- msg_putchar('^');
- resp = getexmodeline('?', NULL, 0, true);
+ prompt = xmallocz(ec + 1);
+ memset(prompt, ' ', sc);
+ memset(prompt + sc, '^', ec - sc + 1);
+ resp = (char_u *)getcmdline_prompt(NUL, prompt, 0, EXPAND_NOTHING,
+ NULL, CALLBACK_NONE);
+ msg_putchar('\n');
+ xfree(prompt);
if (resp != NULL) {
typed = *resp;
xfree(resp);
@@ -3823,8 +3822,9 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
redraw_later(curwin, SOME_VALID);
curwin->w_p_fen = save_p_fen;
- if (msg_row == Rows - 1)
- msg_didout = FALSE; /* avoid a scroll-up */
+ if (msg_row == Rows - 1) {
+ msg_didout = false; // avoid a scroll-up
+ }
msg_starthere();
i = msg_scroll;
msg_scroll = 0; /* truncate msg when
@@ -3843,8 +3843,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
typed = plain_vgetc();
no_mapping--;
- /* clear the question */
- msg_didout = FALSE; /* don't scroll up */
+ // clear the question
+ msg_didout = false; // don't scroll up
msg_col = 0;
gotocmdline(true);
p_lz = save_p_lz;
@@ -4819,7 +4819,7 @@ char_u *check_help_lang(char_u *arg)
* Return a heuristic indicating how well the given string matches. The
* smaller the number, the better the match. This is the order of priorities,
* from best match to worst match:
- * - Match with least alpha-numeric characters is better.
+ * - Match with least alphanumeric characters is better.
* - Match with least total characters is better.
* - Match towards the start is better.
* - Match starting with "+" is worse (feature instead of command)
@@ -5159,9 +5159,9 @@ void fix_help_buffer(void)
// Set filetype to "help".
if (STRCMP(curbuf->b_p_ft, "help") != 0) {
- curbuf_lock++;
+ curbuf->b_ro_locked++;
set_option_value("ft", 0L, "help", OPT_LOCAL);
- curbuf_lock--;
+ curbuf->b_ro_locked--;
}
if (!syntax_present(curwin)) {