diff options
author | VVKot <volodymyr.kot.ua@gmail.com> | 2021-01-31 17:53:52 +0000 |
---|---|---|
committer | VVKot <volodymyr.kot.ua@gmail.com> | 2021-03-28 08:37:04 +0100 |
commit | 6f23291b8d3e9880536f968621cc52d180f09ddc (patch) | |
tree | f7d9db583683688326db8da3bd58247bb1ba5561 /src/nvim/edit.c | |
parent | 18b73ea3c8380f5c99ae6ec6f915e0d448391677 (diff) | |
download | rneovim-6f23291b8d3e9880536f968621cc52d180f09ddc.tar.gz rneovim-6f23291b8d3e9880536f968621cc52d180f09ddc.tar.bz2 rneovim-6f23291b8d3e9880536f968621cc52d180f09ddc.zip |
vim-patch:8.1.0154: crash with "set smarttab shiftwidth=0 softtabstop=-1"
Problem: Crash with "set smarttab shiftwidth=0 softtabstop=-1".
Solution: Fall back to using 'tabstop'. (closes vim/vim#3155)
https://github.com/vim/vim/commit/c9fe5ab3b093803b6e8d03358ba16aca6b6f0db1
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 31bb00a746..90b5cfd8aa 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -8189,6 +8189,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p) && (*(get_cursor_pos_ptr() - 1) == TAB || (*(get_cursor_pos_ptr() - 1) == ' ' && (!*inserted_space_p || arrow_used)))))) { + int ts; colnr_T vcol; colnr_T want_vcol; colnr_T start_vcol; @@ -8203,7 +8204,8 @@ static bool ins_bs(int c, int mode, int *inserted_space_p) getvcol(curwin, &curwin->w_cursor, NULL, NULL, &want_vcol); inc_cursor(); if (p_sta && in_indent) { - want_vcol = (want_vcol / curbuf->b_p_sw) * curbuf->b_p_sw; + ts = (int)get_sw_value(curbuf); + want_vcol = (want_vcol / ts) * ts; } else { want_vcol = tabstop_start(want_vcol, get_sts_value(), @@ -8700,7 +8702,7 @@ static bool ins_tab(void) AppendToRedobuff("\t"); if (p_sta && ind) { // insert tab in indent, use 'shiftwidth' - temp = (int)curbuf->b_p_sw; + temp = (int)get_sw_value(curbuf); temp -= get_nolist_virtcol() % temp; } else if (tabstop_count(curbuf->b_p_vsts_array) > 0 || curbuf->b_p_sts != 0) { |