aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-06-02 05:47:47 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-06-02 06:06:34 +0800
commit0e49c3ad1a599376d0a5c229f304a06d48c56163 (patch)
treea1910bf0e0137f85e7bad889745582ad4affee65 /src/nvim/edit.c
parent6f87779857f1b7a86da9e53c117b5b678a2a3236 (diff)
downloadrneovim-0e49c3ad1a599376d0a5c229f304a06d48c56163.tar.gz
rneovim-0e49c3ad1a599376d0a5c229f304a06d48c56163.tar.bz2
rneovim-0e49c3ad1a599376d0a5c229f304a06d48c56163.zip
vim-patch:9.1.0456: Left shift is incorrect with vartabstop and shiftwidth=0
Problem: Left shift is incorrect with vartabstop and shiftwidth=0 Solution: make tabstop_at() function aware of shift direction (Gary Johnson) The problem was that with 'vartabstop' set and 'shiftwidth' equal 0, left shifts using << were shifting the line to the wrong column. The tabstop to the right of the first character in the line was being used as the shift amount instead of the tabstop to the left of that first character. The reason was that the tabstop_at() function always returned the value of the tabstop to the right of the given column and was not accounting for the direction of the shift. The solution was to make tabstop_at() aware of the direction of the shift and to choose the tabtop accordingly. A test was added to check this behavior and make sure it doesn't regress. While at it, also fix a few indentation/alignment issues. fixes: vim/vim#14864 closes: vim/vim#14887 https://github.com/vim/vim/commit/88d4f255b7b7a19bb4f6489e0ad0956e47d51fed Co-authored-by: Gary Johnson <garyjohn@spocom.com>
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 146e95df87..595b4da589 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -474,7 +474,8 @@ static int insert_check(VimState *state)
if (curwin->w_wcol < s->mincol - tabstop_at(get_nolist_virtcol(),
curbuf->b_p_ts,
- curbuf->b_p_vts_array)
+ curbuf->b_p_vts_array,
+ false)
&& curwin->w_wrow == curwin->w_height_inner - 1 - get_scrolloff_value(curwin)
&& (curwin->w_cursor.lnum != curwin->w_topline
|| curwin->w_topfill > 0)) {