diff options
| author | Pavel Platto <hinidu@gmail.com> | 2014-05-16 11:59:00 +0300 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2014-05-28 10:42:06 -0400 |
| commit | baaa4287851ecf478b40054efd7b786501eb70ef (patch) | |
| tree | 37a5b788a29278e8a4e27b6e9c5c9f787da41a60 | |
| parent | 2a154ef71de506e64fbbc2d8e613b5a696f8cb60 (diff) | |
| download | rneovim-baaa4287851ecf478b40054efd7b786501eb70ef.tar.gz rneovim-baaa4287851ecf478b40054efd7b786501eb70ef.tar.bz2 rneovim-baaa4287851ecf478b40054efd7b786501eb70ef.zip | |
Remove ml_ prefix from cursor.h functions
s/ml_get_curline/get_cursor_line_ptr
s/ml_get_cursor/get_cursor_pos_ptr
| -rw-r--r-- | src/nvim/cursor.c | 10 | ||||
| -rw-r--r-- | src/nvim/cursor.h | 4 | ||||
| -rw-r--r-- | src/nvim/edit.c | 96 | ||||
| -rw-r--r-- | src/nvim/eval.c | 6 | ||||
| -rw-r--r-- | src/nvim/ex_cmds.c | 4 | ||||
| -rw-r--r-- | src/nvim/ex_docmd.c | 2 | ||||
| -rw-r--r-- | src/nvim/ex_getln.c | 2 | ||||
| -rw-r--r-- | src/nvim/farsi.c | 26 | ||||
| -rw-r--r-- | src/nvim/getchar.c | 4 | ||||
| -rw-r--r-- | src/nvim/indent.c | 14 | ||||
| -rw-r--r-- | src/nvim/indent_c.c | 80 | ||||
| -rw-r--r-- | src/nvim/mbyte.c | 8 | ||||
| -rw-r--r-- | src/nvim/misc1.c | 14 | ||||
| -rw-r--r-- | src/nvim/move.c | 2 | ||||
| -rw-r--r-- | src/nvim/normal.c | 47 | ||||
| -rw-r--r-- | src/nvim/ops.c | 36 | ||||
| -rw-r--r-- | src/nvim/quickfix.c | 2 | ||||
| -rw-r--r-- | src/nvim/screen.c | 2 | ||||
| -rw-r--r-- | src/nvim/search.c | 20 | ||||
| -rw-r--r-- | src/nvim/spell.c | 10 | ||||
| -rw-r--r-- | src/nvim/window.c | 2 |
21 files changed, 197 insertions, 194 deletions
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index e90422bf6d..8427f2a0a2 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -70,7 +70,7 @@ int coladvance(colnr_T wcol) if (wcol == MAXCOL || rc == FAIL) curwin->w_valid &= ~VALID_VIRTCOL; - else if (*ml_get_cursor() != TAB) { + else if (*get_cursor_pos_ptr() != TAB) { /* Virtcol is valid when not on a TAB */ curwin->w_valid |= VALID_VIRTCOL; curwin->w_virtcol = wcol; @@ -444,8 +444,8 @@ int leftcol_changed(void) int gchar_cursor(void) { if (has_mbyte) - return (*mb_ptr2char)(ml_get_cursor()); - return (int)*ml_get_cursor(); + return (*mb_ptr2char)(get_cursor_pos_ptr()); + return (int)*get_cursor_pos_ptr(); } /* @@ -461,7 +461,7 @@ void pchar_cursor(char_u c) /* * Return pointer to cursor line. */ -char_u *ml_get_curline(void) +char_u *get_cursor_line_ptr(void) { return ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE); } @@ -469,7 +469,7 @@ char_u *ml_get_curline(void) /* * Return pointer to cursor position. */ -char_u *ml_get_cursor(void) +char_u *get_cursor_pos_ptr(void) { return ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE) + curwin->w_cursor.col; diff --git a/src/nvim/cursor.h b/src/nvim/cursor.h index 5cf28ce590..3cceb0261e 100644 --- a/src/nvim/cursor.h +++ b/src/nvim/cursor.h @@ -20,8 +20,8 @@ void adjust_cursor_col(void); int leftcol_changed(void); int gchar_cursor(void); void pchar_cursor(char_u c); -char_u *ml_get_curline(void); -char_u *ml_get_cursor(void); +char_u *get_cursor_line_ptr(void); +char_u *get_cursor_pos_ptr(void); #endif // NVIM_CURSOR_H diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 5ce73e5dc8..6ea88843ab 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -428,7 +428,7 @@ edit ( if (startln) Insstart.col = 0; } - Insstart_textlen = (colnr_T)linetabsize(ml_get_curline()); + Insstart_textlen = (colnr_T)linetabsize(get_cursor_line_ptr()); Insstart_blank_vcol = MAXCOL; if (!did_ai) ai_col = 0; @@ -521,7 +521,7 @@ edit ( update_curswant(); if (((ins_at_eol && curwin->w_cursor.lnum == o_lnum) || curwin->w_curswant > curwin->w_virtcol) - && *(ptr = ml_get_curline() + curwin->w_cursor.col) != NUL) { + && *(ptr = get_cursor_line_ptr() + curwin->w_cursor.col) != NUL) { if (ptr[1] == NUL) ++curwin->w_cursor.col; else if (has_mbyte) { @@ -1501,7 +1501,7 @@ void display_dollar(colnr_T col) char_u *p; /* If on the last byte of a multi-byte move to the first byte. */ - p = ml_get_curline(); + p = get_cursor_line_ptr(); curwin->w_cursor.col -= (*mb_head_off)(p, p + col); } curs_columns(FALSE); /* recompute w_wrow and w_wcol */ @@ -1555,7 +1555,7 @@ change_indent ( /* VREPLACE mode needs to know what the line was like before changing */ if (State & VREPLACE_FLAG) { - orig_line = vim_strsave(ml_get_curline()); /* Deal with NULL below */ + orig_line = vim_strsave(get_cursor_line_ptr()); /* Deal with NULL below */ orig_col = curwin->w_cursor.col; } @@ -1636,7 +1636,7 @@ change_indent ( */ vcol = last_vcol = 0; new_cursor_col = -1; - ptr = ml_get_curline(); + ptr = get_cursor_line_ptr(); while (vcol <= (int)curwin->w_virtcol) { last_vcol = vcol; if (has_mbyte && new_cursor_col >= 0) @@ -1727,7 +1727,7 @@ change_indent ( return; /* Save new line */ - new_line = vim_strsave(ml_get_curline()); + new_line = vim_strsave(get_cursor_line_ptr()); /* We only put back the new line up to the cursor */ new_line[curwin->w_cursor.col] = NUL; @@ -1798,13 +1798,13 @@ static int del_char_after_col(int limit_col) * composing character. */ mb_adjust_cursor(); while (curwin->w_cursor.col < (colnr_T)limit_col) { - int l = utf_ptr2len(ml_get_cursor()); + int l = utf_ptr2len(get_cursor_pos_ptr()); if (l == 0) /* end of line */ break; curwin->w_cursor.col += l; } - if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol) + if (*get_cursor_pos_ptr() == NUL || curwin->w_cursor.col == ecol) return FALSE; del_bytes((long)((int)ecol - curwin->w_cursor.col), FALSE, TRUE); } else @@ -2321,7 +2321,8 @@ void set_completion(colnr_T startcol, list_T *list) compl_col = startcol; compl_length = (int)curwin->w_cursor.col - (int)startcol; /* compl_pattern doesn't need to be set */ - compl_orig_text = vim_strnsave(ml_get_curline() + compl_col, compl_length); + compl_orig_text = vim_strnsave(get_cursor_line_ptr() + compl_col, + compl_length); if (ins_compl_add(compl_orig_text, -1, p_ic, NULL, NULL, 0, ORIGINAL_TEXT, FALSE) != OK) { return; @@ -2849,7 +2850,7 @@ static int ins_compl_bs(void) char_u *line; char_u *p; - line = ml_get_curline(); + line = get_cursor_line_ptr(); p = line + curwin->w_cursor.col; mb_ptr_back(line, p); @@ -2971,7 +2972,7 @@ static void ins_compl_addleader(int c) * break redo. */ if (!compl_opt_refresh_always) { free(compl_leader); - compl_leader = vim_strnsave(ml_get_curline() + compl_col, + compl_leader = vim_strnsave(get_cursor_line_ptr() + compl_col, (int)(curwin->w_cursor.col - compl_col)); ins_compl_new_leader(); } @@ -3220,7 +3221,7 @@ static int ins_compl_prep(int c) if (stop_arrow() == OK) insertchar(NUL, 0, -1); if (prev_col > 0 - && ml_get_curline()[curwin->w_cursor.col] != NUL) + && get_cursor_line_ptr()[curwin->w_cursor.col] != NUL) inc_cursor(); } @@ -4921,7 +4922,8 @@ insert_special ( # define WHITECHAR(cc) (vim_iswhite(cc) && \ (!enc_utf8 || \ - !utf_iscomposing(utf_ptr2char(ml_get_cursor() + 1)))) + !utf_iscomposing( \ + utf_ptr2char(get_cursor_pos_ptr() + 1)))) /* * "flags": INSCHAR_FORMAT - force formatting @@ -4967,7 +4969,7 @@ insertchar ( || (!vim_iswhite(c) && !((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG) - && *ml_get_cursor() != NUL) + && *get_cursor_pos_ptr() != NUL) && (curwin->w_cursor.lnum != Insstart.lnum || ((!has_format_option(FO_INS_LONG) || Insstart_textlen <= (colnr_T)textwidth) @@ -5002,7 +5004,7 @@ insertchar ( * Need to remove existing (middle) comment leader and insert end * comment leader. First, check what comment leader we can find. */ - i = get_leader_len(line = ml_get_curline(), &p, FALSE, TRUE); + i = get_leader_len(line = get_cursor_line_ptr(), &p, FALSE, TRUE); if (i > 0 && vim_strchr(p, COM_MIDDLE) != NULL) { /* Just checking */ /* Skip middle-comment string */ while (*p && p[-1] != ':') /* find end of middle flags */ @@ -5198,7 +5200,7 @@ internal_format ( /* Don't break until after the comment leader */ if (do_comments) - leader_len = get_leader_len(ml_get_curline(), NULL, FALSE, TRUE); + leader_len = get_leader_len(get_cursor_line_ptr(), NULL, FALSE, TRUE); else leader_len = 0; @@ -5350,7 +5352,7 @@ internal_format ( * In VREPLACE mode, we will backspace over the text to be * wrapped, so save a copy now to put on the next line. */ - saved_text = vim_strsave(ml_get_cursor()); + saved_text = vim_strsave(get_cursor_pos_ptr()); curwin->w_cursor.col = orig_col; if (saved_text == NULL) break; /* Can't do it, out of memory */ @@ -5428,7 +5430,7 @@ internal_format ( * may have added or removed indent. */ curwin->w_cursor.col += startcol; - len = (colnr_T)STRLEN(ml_get_curline()); + len = (colnr_T)STRLEN(get_cursor_line_ptr()); if (curwin->w_cursor.col > len) curwin->w_cursor.col = len; } @@ -5476,7 +5478,7 @@ auto_format ( return; pos = curwin->w_cursor; - old = ml_get_curline(); + old = get_cursor_line_ptr(); /* may remove added space */ check_auto_format(FALSE); @@ -5539,7 +5541,7 @@ auto_format ( * need to add a space when 'w' is in 'formatoptions' to keep a paragraph * formatted. */ if (!wasatend && has_format_option(FO_WHITE_PAR)) { - new = ml_get_curline(); + new = get_cursor_line_ptr(); len = (colnr_T)STRLEN(new); if (curwin->w_cursor.col == len) { pnew = vim_strnsave(new, len + 2); @@ -5702,7 +5704,7 @@ int stop_arrow(void) ins_need_undo = FALSE; } Insstart = curwin->w_cursor; /* new insertion starts here */ - Insstart_textlen = (colnr_T)linetabsize(ml_get_curline()); + Insstart_textlen = (colnr_T)linetabsize(get_cursor_line_ptr()); ai_col = 0; if (State & VREPLACE_FLAG) { orig_line_count = curbuf->b_ml.ml_line_count; @@ -5820,7 +5822,7 @@ stop_insert ( /* <C-S-Right> may have started Visual mode, adjust the position for * deleted characters. */ if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum) { - int len = (int)STRLEN(ml_get_curline()); + int len = (int)STRLEN(get_cursor_line_ptr()); if (VIsual.col > len) { VIsual.col = len; @@ -5917,7 +5919,7 @@ void beginline(int flags) if (flags & (BL_WHITE | BL_SOL)) { char_u *ptr; - for (ptr = ml_get_curline(); vim_iswhite(*ptr) + for (ptr = get_cursor_line_ptr(); vim_iswhite(*ptr) && !((flags & BL_FIX) && ptr[1] == NUL); ++ptr) ++curwin->w_cursor.col; } @@ -5942,7 +5944,7 @@ int oneright(void) pos_T prevpos = curwin->w_cursor; /* Adjust for multi-wide char (excluding TAB) */ - ptr = ml_get_cursor(); + ptr = get_cursor_pos_ptr(); coladvance(getviscol() + ((*ptr != TAB && vim_isprintc( (*mb_ptr2char)(ptr) )) @@ -5953,7 +5955,7 @@ int oneright(void) || prevpos.coladd != curwin->w_cursor.coladd) ? OK : FAIL; } - ptr = ml_get_cursor(); + ptr = get_cursor_pos_ptr(); if (*ptr == NUL) return FAIL; /* already at the very end */ @@ -6000,7 +6002,7 @@ int oneleft(void) char_u *ptr; /* Adjust for multi-wide char (not a TAB) */ - ptr = ml_get_cursor(); + ptr = get_cursor_pos_ptr(); if (*ptr != TAB && vim_isprintc( (*mb_ptr2char)(ptr) ) && ptr2cells(ptr) > 1) @@ -6226,7 +6228,7 @@ static int echeck_abbr(int c) if (p_paste || no_abbr || arrow_used) return FALSE; - return check_abbr(c, ml_get_curline(), curwin->w_cursor.col, + return check_abbr(c, get_cursor_line_ptr(), curwin->w_cursor.col, curwin->w_cursor.lnum == Insstart.lnum ? Insstart.col : 0); } @@ -6417,23 +6419,23 @@ static void replace_do_bs(int limit_col) /* Get the number of screen cells used by the character we are * going to delete. */ getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL); - orig_vcols = chartabsize(ml_get_cursor(), start_vcol); + orig_vcols = chartabsize(get_cursor_pos_ptr(), start_vcol); } if (has_mbyte) { (void)del_char_after_col(limit_col); if (State & VREPLACE_FLAG) - orig_len = (int)STRLEN(ml_get_cursor()); + orig_len = (int)STRLEN(get_cursor_pos_ptr()); replace_push(cc); } else { pchar_cursor(cc); if (State & VREPLACE_FLAG) - orig_len = (int)STRLEN(ml_get_cursor()) - 1; + orig_len = (int)STRLEN(get_cursor_pos_ptr()) - 1; } replace_pop_ins(); if (State & VREPLACE_FLAG) { /* Get the number of screen cells used by the inserted characters */ - p = ml_get_cursor(); + p = get_cursor_pos_ptr(); ins_len = (int)STRLEN(p) - orig_len; vcol = start_vcol; for (i = 0; i < ins_len; ++i) { @@ -6576,7 +6578,7 @@ int in_cinkeys(int keytyped, int when, int line_is_empty) */ else if (*look == 'e') { if (try_match && keytyped == 'e' && curwin->w_cursor.col >= 4) { - p = ml_get_curline(); + p = get_cursor_line_ptr(); if (skipwhite(p) == p + curwin->w_cursor.col - 4 && STRNCMP(p + curwin->w_cursor.col - 4, "else", 4) == 0) return TRUE; @@ -6590,18 +6592,18 @@ int in_cinkeys(int keytyped, int when, int line_is_empty) */ else if (*look == ':') { if (try_match && keytyped == ':') { - p = ml_get_curline(); + p = get_cursor_line_ptr(); if (cin_iscase(p, FALSE) || cin_isscopedecl(p) || cin_islabel()) return TRUE; /* Need to get the line again after cin_islabel(). */ - p = ml_get_curline(); + p = get_cursor_line_ptr(); if (curwin->w_cursor.col > 2 && p[curwin->w_cursor.col - 1] == ':' && p[curwin->w_cursor.col - 2] == ':') { p[curwin->w_cursor.col - 1] = ' '; i = (cin_iscase(p, FALSE) || cin_isscopedecl(p) || cin_islabel()); - p = ml_get_curline(); + p = get_cursor_line_ptr(); p[curwin->w_cursor.col - 1] = ':'; if (i) return TRUE; @@ -6653,7 +6655,7 @@ int in_cinkeys(int keytyped, int when, int line_is_empty) /* Just completed a word, check if it starts with "look". * search back for the start of a word. */ - line = ml_get_curline(); + line = get_cursor_line_ptr(); if (has_mbyte) { char_u *n; @@ -6676,7 +6678,7 @@ int in_cinkeys(int keytyped, int when, int line_is_empty) if (keytyped == (int)p[-1] || (icase && keytyped < 256 && TOLOWER_LOC(keytyped) == TOLOWER_LOC((int)p[-1]))) { - line = ml_get_cursor(); + line = get_cursor_pos_ptr(); if ((curwin->w_cursor.col == (colnr_T)(p - look) || !vim_iswordc(line[-(p - look) - 1])) && (icase @@ -6688,7 +6690,7 @@ int in_cinkeys(int keytyped, int when, int line_is_empty) if (match && try_match_word && !try_match) { /* "0=word": Check if there are only blanks before the * word. */ - line = ml_get_curline(); + line = get_cursor_line_ptr(); if ((int)(skipwhite(line) - line) != (int)(curwin->w_cursor.col - (p - look))) match = FALSE; @@ -7229,7 +7231,7 @@ static void ins_shift(int c, int lastc) } else change_indent(c == Ctrl_D ? INDENT_DEC : INDENT_INC, 0, TRUE, 0, TRUE); - if (did_ai && *skipwhite(ml_get_curline()) != NUL) + if (did_ai && *skipwhite(get_cursor_line_ptr()) != NUL) did_ai = FALSE; did_si = FALSE; can_si = FALSE; @@ -7452,8 +7454,8 @@ static int ins_bs(int c, int mode, int *inserted_space_p) && ((p_sta && in_indent) || (get_sts_value() != 0 && curwin->w_cursor.col > 0 - && (*(ml_get_cursor() - 1) == TAB - || (*(ml_get_cursor() - 1) == ' ' + && (*(get_cursor_pos_ptr() - 1) == TAB + || (*(get_cursor_pos_ptr() - 1) == ' ' && (!*inserted_space_p || arrow_used)))))) { int ts; @@ -7478,7 +7480,7 @@ static int ins_bs(int c, int mode, int *inserted_space_p) /* delete characters until we are at or before want_vcol */ while (vcol > want_vcol - && (cc = *(ml_get_cursor() - 1), vim_iswhite(cc))) + && (cc = *(get_cursor_pos_ptr() - 1), vim_iswhite(cc))) ins_bs_one(&vcol); /* insert extra spaces until we are at want_vcol */ @@ -7530,7 +7532,7 @@ static int ins_bs(int c, int mode, int *inserted_space_p) replace_do_bs(-1); else { if (enc_utf8 && p_deco) - (void)utfc_ptr2char(ml_get_cursor(), cpc); + (void)utfc_ptr2char(get_cursor_pos_ptr(), cpc); (void)del_char(FALSE); /* * If there are combining characters and 'delcombine' is set @@ -7767,7 +7769,7 @@ static void ins_right(void) oneright(); else { if (has_mbyte) - curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor()); + curwin->w_cursor.col += (*mb_ptr2len)(get_cursor_pos_ptr()); else ++curwin->w_cursor.col; } @@ -7976,10 +7978,10 @@ static int ins_tab(void) if (State & VREPLACE_FLAG) { pos = curwin->w_cursor; cursor = &pos; - saved_line = vim_strsave(ml_get_curline()); + saved_line = vim_strsave(get_cursor_line_ptr()); ptr = saved_line + pos.col; } else { - ptr = ml_get_cursor(); + ptr = get_cursor_pos_ptr(); cursor = &curwin->w_cursor; } @@ -8120,7 +8122,7 @@ static int ins_eol(int c) /* NL in reverse insert will always start in the end of * current line. */ if (revins_on) - curwin->w_cursor.col += (colnr_T)STRLEN(ml_get_cursor()); + curwin->w_cursor.col += (colnr_T)STRLEN(get_cursor_pos_ptr()); AppendToRedobuff(NL_STR); i = open_line(FORWARD, diff --git a/src/nvim/eval.c b/src/nvim/eval.c index bf82e9373e..95fb6ed732 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8036,7 +8036,7 @@ static void f_col(typval_T *argvars, typval_T *rettv) /* col(".") when the cursor is on the NUL at the end of the line * because of "coladd" can be seen as an extra column. */ if (virtual_active() && fp == &curwin->w_cursor) { - char_u *p = ml_get_cursor(); + char_u *p = get_cursor_pos_ptr(); if (curwin->w_cursor.coladd >= (colnr_T)chartabsize(p, curwin->w_virtcol - curwin->w_cursor.coladd)) { @@ -13832,7 +13832,7 @@ static void f_spellbadword(typval_T *argvars, typval_T *rettv) /* Find the start and length of the badly spelled word. */ len = spell_move_to(curwin, FORWARD, TRUE, TRUE, &attr); if (len != 0) - word = ml_get_cursor(); + word = get_cursor_pos_ptr(); } else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL) { char_u *str = get_tv_string_chk(&argvars[0]); int capcol = -1; @@ -15393,7 +15393,7 @@ var2fpos ( pos.col = 0; } else { pos.lnum = curwin->w_cursor.lnum; - pos.col = (colnr_T)STRLEN(ml_get_curline()); + pos.col = (colnr_T)STRLEN(get_cursor_line_ptr()); } return &pos; } diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 2fc882113a..de01665286 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -91,7 +91,7 @@ void do_ascii(exarg_T *eap) int len; if (enc_utf8) - c = utfc_ptr2char(ml_get_cursor(), cc); + c = utfc_ptr2char(get_cursor_pos_ptr(), cc); else c = gchar_cursor(); if (c == NUL) { @@ -258,7 +258,7 @@ static int linelen(int *has_tab) int len; /* find the first non-blank character */ - line = ml_get_curline(); + line = get_cursor_line_ptr(); first = skipwhite(line); /* find the character after the last non-blank character */ diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index a76f09f3bb..832870cf2d 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -6120,7 +6120,7 @@ static void ex_open(exarg_T *eap) regmatch.regprog = vim_regcomp(eap->arg, p_magic ? RE_MAGIC : 0); if (regmatch.regprog != NULL) { regmatch.rm_ic = p_ic; - p = ml_get_curline(); + p = get_cursor_line_ptr(); if (vim_regexec(®match, p, (colnr_T)0)) curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - p); else diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 14687be426..57af0c20e4 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -5306,7 +5306,7 @@ static int ex_window(void) * and don't modify the cmd window. */ ccline.cmdbuff = NULL; } else - ccline.cmdbuff = vim_strsave(ml_get_curline()); + ccline.cmdbuff = vim_strsave(get_cursor_line_ptr()); if (ccline.cmdbuff == NULL) cmdwin_result = Ctrl_C; else { diff --git a/src/nvim/farsi.c b/src/nvim/farsi.c index edda8f3f23..6e532bbe0a 100644 --- a/src/nvim/farsi.c +++ b/src/nvim/farsi.c @@ -170,7 +170,7 @@ static int toF_Xor_X_(int c) tempc = _HE; if (p_ri && - (curwin->w_cursor.col + 1 < (colnr_T)STRLEN(ml_get_curline()))) { + (curwin->w_cursor.col + 1 < (colnr_T)STRLEN(get_cursor_line_ptr()))) { inc_cursor(); if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) { tempc = _HE_; @@ -178,7 +178,7 @@ static int toF_Xor_X_(int c) dec_cursor(); } - if (!p_ri && STRLEN(ml_get_curline())) { + if (!p_ri && STRLEN(get_cursor_line_ptr())) { dec_cursor(); if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) { tempc = _HE_; @@ -455,7 +455,7 @@ static void put_curr_and_l_to_X(int c) return; } - if ((curwin->w_cursor.col < (colnr_T)STRLEN(ml_get_curline()))) { + if ((curwin->w_cursor.col < (colnr_T)STRLEN(get_cursor_line_ptr()))) { if ((p_ri && curwin->w_cursor.col) || !p_ri) { if (p_ri) { dec_cursor(); @@ -699,7 +699,7 @@ static void chg_c_to_X_or_X(void) tempc = gchar_cursor(); - if (curwin->w_cursor.col + 1 < (colnr_T)STRLEN(ml_get_curline())) { + if (curwin->w_cursor.col + 1 < (colnr_T)STRLEN(get_cursor_line_ptr())) { inc_cursor(); if ((tempc == F_HE) && (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))) { tempc = _HE_; @@ -722,7 +722,7 @@ static void chg_l_to_X_orX_(void) int tempc; if ((curwin->w_cursor.col != 0) - && (curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline()))) { + && (curwin->w_cursor.col + 1 == (colnr_T)STRLEN(get_cursor_line_ptr()))) { return; } @@ -802,7 +802,7 @@ static void chg_l_toXor_X(void) int tempc; if ((curwin->w_cursor.col != 0) && - (curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline()))) { + (curwin->w_cursor.col + 1 == (colnr_T)STRLEN(get_cursor_line_ptr()))) { return; } @@ -1564,7 +1564,7 @@ int fkmap(int c) break; case 'G': - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) { + if (!curwin->w_cursor.col && STRLEN(get_cursor_line_ptr())) { if (gchar_cursor() == _LAM) { chg_c_toX_orX(); } else if (p_ri) { @@ -1600,7 +1600,7 @@ int fkmap(int c) return tempc; case 'h': - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) { + if (!curwin->w_cursor.col && STRLEN(get_cursor_line_ptr())) { if (p_ri) { chg_c_to_X_or_X(); } @@ -1643,7 +1643,7 @@ int fkmap(int c) case 'i': - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) { + if (!curwin->w_cursor.col && STRLEN(get_cursor_line_ptr())) { if (!p_ri && !F_is_TyE(tempc)) { chg_c_to_X_orX_(); } @@ -1678,7 +1678,7 @@ int fkmap(int c) case 'J': - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) { + if (!curwin->w_cursor.col && STRLEN(get_cursor_line_ptr())) { if (p_ri) { chg_c_to_X_or_X(); } @@ -1753,7 +1753,7 @@ int fkmap(int c) break; case 'u': - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) { + if (!curwin->w_cursor.col && STRLEN(get_cursor_line_ptr())) { if (!p_ri && !F_is_TyE(tempc)) { chg_c_to_X_orX_(); } @@ -1797,7 +1797,7 @@ int fkmap(int c) break; case 'y': - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) { + if (!curwin->w_cursor.col && STRLEN(get_cursor_line_ptr())) { if (!p_ri && !F_is_TyE(tempc)) { chg_c_to_X_orX_(); } @@ -1857,7 +1857,7 @@ int fkmap(int c) } if ((F_isalpha(tempc) || F_isdigit(tempc))) { - if (!curwin->w_cursor.col && STRLEN(ml_get_curline())) { + if (!curwin->w_cursor.col && STRLEN(get_cursor_line_ptr())) { if (!p_ri && !F_is_TyE(tempc)) { chg_c_to_X_orX_(); } diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 9cd12a1d52..d215bb06e7 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2172,7 +2172,7 @@ static int vgetorpeek(int advance) * character -- webb */ col = vcol = curwin->w_wcol = 0; - ptr = ml_get_curline(); + ptr = get_cursor_line_ptr(); while (col < curwin->w_cursor.col) { if (!vim_iswhite(ptr[col])) curwin->w_wcol = vcol; @@ -2200,7 +2200,7 @@ static int vgetorpeek(int advance) if (has_mbyte && col > 0 && curwin->w_wcol > 0) { /* Correct when the cursor is on the right halve * of a double-wide character. */ - ptr = ml_get_curline(); + ptr = get_cursor_line_ptr(); col -= (*mb_head_off)(ptr, ptr + col); if ((*mb_ptr2cells)(ptr + col) > 1) --curwin->w_wcol; diff --git a/src/nvim/indent.c b/src/nvim/indent.c index fc59bdb50b..fcdc71e636 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -18,7 +18,7 @@ static int lisp_match(char_u *p); // Count the size (in window cells) of the indent in the current line. int get_indent(void) { - return get_indent_str(ml_get_curline(), (int)curbuf->b_p_ts); + return get_indent_str(get_cursor_line_ptr(), (int)curbuf->b_p_ts); } @@ -88,7 +88,7 @@ int set_indent(int size, int flags) // characters needed for the indent. todo = size; ind_len = 0; - p = oldline = ml_get_curline(); + p = oldline = get_cursor_line_ptr(); // Calculate the buffer size for the new indent, and check to see if it // isn't already set. @@ -368,14 +368,14 @@ int copy_indent(int size, char_u *src) if (p == NULL) { // Allocate memory for the result: the copied indent, new indent // and the rest of the line. - line_len = (int)STRLEN(ml_get_curline()) + 1; + line_len = (int)STRLEN(get_cursor_line_ptr()) + 1; line = xmalloc(ind_len + line_len); p = line; } } // Append the original line - memmove(p, ml_get_curline(), (size_t)line_len); + memmove(p, get_cursor_line_ptr(), (size_t)line_len); // Replace the line ml_replace(curwin->w_cursor.lnum, line, false); @@ -437,7 +437,7 @@ int inindent(int extra) char_u *ptr; colnr_T col; - for (col = 0, ptr = ml_get_curline(); vim_iswhite(*ptr); ++col) { + for (col = 0, ptr = get_cursor_line_ptr(); vim_iswhite(*ptr); ++col) { ptr++; } @@ -550,7 +550,7 @@ int get_lisp_indent(void) continue; } - for (that = ml_get_curline(); *that != NUL; ++that) { + for (that = get_cursor_line_ptr(); *that != NUL; ++that) { if (*that == ';') { while (*(that + 1) != NUL) { that++; @@ -597,7 +597,7 @@ int get_lisp_indent(void) curwin->w_cursor.col = pos->col; col = pos->col; - that = ml_get_curline(); + that = get_cursor_line_ptr(); if (vi_lisp && (get_indent() == 0)) { amount = 2; diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 8db16efb80..631ef06d01 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -267,7 +267,7 @@ int cin_islabel(void) { /* XXX */ char_u *s; - s = cin_skipcomment(ml_get_curline()); + s = cin_skipcomment(get_cursor_line_ptr()); /* * Exclude "default" from labels, since it should be indented @@ -298,7 +298,7 @@ int cin_islabel(void) if ((trypos = ind_find_start_comment()) != NULL) /* XXX */ curwin->w_cursor = *trypos; - line = ml_get_curline(); + line = get_cursor_line_ptr(); if (cin_ispreproc(line)) /* ignore #defines, #if, etc. */ continue; if (*(line = cin_skipcomment(line)) == NUL) @@ -328,7 +328,7 @@ static int cin_isinit(void) char_u *s; static char *skip[] = {"static", "public", "protected", "private"}; - s = cin_skipcomment(ml_get_curline()); + s = cin_skipcomment(get_cursor_line_ptr()); if (cin_starts_with(s, "typedef")) s = cin_skipcomment(s + 7); @@ -522,16 +522,16 @@ static int skip_label(linenr_T lnum, char_u **pp) cursor_save = curwin->w_cursor; curwin->w_cursor.lnum = lnum; - l = ml_get_curline(); + l = get_cursor_line_ptr(); /* XXX */ if (cin_iscase(l, FALSE) || cin_isscopedecl(l) || cin_islabel()) { amount = get_indent_nolabel(lnum); - l = after_label(ml_get_curline()); + l = after_label(get_cursor_line_ptr()); if (l == NULL) /* just in case */ - l = ml_get_curline(); + l = get_cursor_line_ptr(); } else { amount = get_indent(); - l = ml_get_curline(); + l = get_cursor_line_ptr(); } *pp = l; @@ -553,7 +553,7 @@ static int cin_first_id_amount(void) pos_T fp; colnr_T col; - line = ml_get_curline(); + line = get_cursor_line_ptr(); p = skipwhite(line); len = (int)(skiptowhite(p) - p); if (len == 6 && STRNCMP(p, "static", 6) == 0) { @@ -869,7 +869,7 @@ cin_iswhileofdo ( /* XXX */ cursor_save = curwin->w_cursor; curwin->w_cursor.lnum = lnum; curwin->w_cursor.col = 0; - p = ml_get_curline(); + p = get_cursor_line_ptr(); while (*p && *p != 'w') { /* skip any '}', until the 'w' of the "while" */ ++p; ++curwin->w_cursor.col; @@ -942,7 +942,7 @@ static int cin_is |