diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2022-06-28 11:31:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-28 02:31:54 -0700 |
commit | 014a88799a1d175ad121c520c9cc5bd0bb2d8813 (patch) | |
tree | db5d1acdc8ea6fe58f78b1aabc62b3ee5fc7875a /src/nvim/edit.c | |
parent | 7e1cf6b7642f0ab14656d853d44f4409b2987b9c (diff) | |
download | rneovim-014a88799a1d175ad121c520c9cc5bd0bb2d8813.tar.gz rneovim-014a88799a1d175ad121c520c9cc5bd0bb2d8813.tar.bz2 rneovim-014a88799a1d175ad121c520c9cc5bd0bb2d8813.zip |
refactor: replace char_u #18429
Work on https://github.com/neovim/neovim/issues/459
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 47d07e457f..1223d98fbf 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -4223,7 +4223,7 @@ static int ins_compl_get_exp(pos_T *ini) msg_hist_off = true; // reset in msg_trunc_attr() vim_snprintf((char *)IObuff, IOSIZE, _("Scanning: %s"), ins_buf->b_fname == NULL - ? buf_spname(ins_buf) + ? (char_u *)buf_spname(ins_buf) : ins_buf->b_sfname == NULL ? (char_u *)ins_buf->b_fname : ins_buf->b_sfname); @@ -4831,15 +4831,15 @@ static int ins_compl_next(int allow_get_expansion, int count, int insert_match, */ if (compl_shown_match->cp_fname != NULL) { char *lead = _("match in file"); - int space = sc_col - vim_strsize((char_u *)lead) - 2; - char_u *s; - char_u *e; + int space = sc_col - vim_strsize(lead) - 2; + char *s; + char *e; if (space > 0) { // We need the tail that fits. With double-byte encoding going // back from the end is very slow, thus go from the start and keep // the text that fits in "space" between "s" and "e". - for (s = e = compl_shown_match->cp_fname; *e != NUL; MB_PTR_ADV(e)) { + for (s = e = (char *)compl_shown_match->cp_fname; *e != NUL; MB_PTR_ADV(e)) { space -= ptr2cells(e); while (space < 0) { space += ptr2cells(s); @@ -4848,7 +4848,7 @@ static int ins_compl_next(int allow_get_expansion, int count, int insert_match, } msg_hist_off = true; vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead, - s > compl_shown_match->cp_fname ? "<" : "", s); + (char_u *)s > compl_shown_match->cp_fname ? "<" : "", s); msg((char *)IObuff); msg_hist_off = false; redraw_cmdline = false; // don't overwrite! @@ -6807,15 +6807,15 @@ void beginline(int flags) int oneright(void) { - char_u *ptr; + char *ptr; int l; if (virtual_active()) { pos_T prevpos = curwin->w_cursor; // Adjust for multi-wide char (excluding TAB) - ptr = get_cursor_pos_ptr(); - coladvance(getviscol() + ((*ptr != TAB && vim_isprintc(utf_ptr2char((char *)ptr))) ? + ptr = (char *)get_cursor_pos_ptr(); + coladvance(getviscol() + ((*ptr != TAB && vim_isprintc(utf_ptr2char(ptr))) ? ptr2cells(ptr) : 1)); curwin->w_set_curswant = true; // Return OK if the cursor moved, FAIL otherwise (at window edge). @@ -6823,12 +6823,12 @@ int oneright(void) || prevpos.coladd != curwin->w_cursor.coladd) ? OK : FAIL; } - ptr = get_cursor_pos_ptr(); + ptr = (char *)get_cursor_pos_ptr(); if (*ptr == NUL) { return FAIL; // already at the very end } - l = utfc_ptr2len((char *)ptr); + l = utfc_ptr2len(ptr); // move "l" bytes right, but don't end up on the NUL, unless 'virtualedit' // contains "onemore". @@ -6865,12 +6865,9 @@ int oneleft(void) } if (curwin->w_cursor.coladd == 1) { - char_u *ptr; - // Adjust for multi-wide char (not a TAB) - ptr = get_cursor_pos_ptr(); - if (*ptr != TAB && vim_isprintc(utf_ptr2char((char *)ptr)) - && ptr2cells(ptr) > 1) { + char *ptr = (char *)get_cursor_pos_ptr(); + if (*ptr != TAB && vim_isprintc(utf_ptr2char(ptr)) && ptr2cells(ptr) > 1) { curwin->w_cursor.coladd = 0; } } |