diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-11-22 03:08:29 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-11-22 03:08:29 +0100 |
commit | f951416a8396a54bbbe21de1a8b16716428549f2 (patch) | |
tree | 2903bb024e534d4a4c5004beef72f4dc38583b29 /src/edit.c | |
parent | 2b84949ad8f247e5d142e2fb1371b3e37567977a (diff) |
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into accountv8.1.0542
Problem: shiftwidth() does not take 'vartabstop' into account.
Solution: Use the cursor position or a position explicitly passed.
Also make >> and << work better with 'vartabstop'. (Christian
Brabandt)
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/edit.c b/src/edit.c index 239881ee5c..6b5bc0f631 100644 --- a/src/edit.c +++ b/src/edit.c @@ -262,7 +262,6 @@ static int ins_ctrl_ey(int tc); #ifdef FEAT_SMARTINDENT static void ins_try_si(int c); #endif -static colnr_T get_nolist_virtcol(void); #if defined(FEAT_EVAL) static char_u *do_insert_char_pre(int c); #endif @@ -10681,9 +10680,14 @@ ins_try_si(int c) * Get the value that w_virtcol would have when 'list' is off. * Unless 'cpo' contains the 'L' flag. */ - static colnr_T + colnr_T get_nolist_virtcol(void) { + // check validity of cursor in current buffer + if (curwin->w_buffer == NULL + || curwin->w_buffer->b_ml.ml_mfp == NULL + || curwin->w_cursor.lnum > curwin->w_buffer->b_ml.ml_line_count) + return 0; if (curwin->w_p_list && vim_strchr(p_cpo, CPO_LISTWM) == NULL) return getvcol_nolist(&curwin->w_cursor); validate_virtcol(); |