• R/O
  • SSH

vim: コミット

Mirror of the Vim source from https://github.com/vim/vim


コミットメタ情報

リビジョンa04815de0bd3177d053781c2eb6d6c2cdf4c728e (tree)
日時2022-05-15 03:00:05
作者Bram Moolenaar <Bram@vim....>
コミッターBram Moolenaar

ログメッセージ

patch 8.2.4955: text property in wrong position after auto-indent

Commit: https://github.com/vim/vim/commit/788c06a2492b546dd0824b119251cd8ea7da9cb5
Author: LemonBoy <thatlemon@gmail.com>
Date: Sat May 14 18:48:05 2022 +0100

patch 8.2.4955: text property in wrong position after auto-indent
Problem: Text property in wrong position after auto-indent.
Solution: Adjust text property columns. (closes https://github.com/vim/vim/issues/10422, closes https://github.com/vim/vim/issues/7719)

変更サマリ

差分

diff -r 1df04dc2fa27 -r a04815de0bd3 src/change.c
--- a/src/change.c Sat May 14 19:15:03 2022 +0200
+++ b/src/change.c Sat May 14 20:00:05 2022 +0200
@@ -1372,7 +1372,8 @@
13721372 char_u *next_line = NULL; // copy of the next line
13731373 char_u *p_extra = NULL; // what goes to next line
13741374 int less_cols = 0; // less columns for mark in new line
1375- int less_cols_off = 0; // columns to skip for mark adjust
1375+ int less_cols_off = 0; // columns to skip for mark and
1376+ // textprop adjustment
13761377 pos_T old_cursor; // old cursor position
13771378 int newcol = 0; // new cursor column
13781379 int newindent = 0; // auto-indent of the new line
@@ -2151,9 +2152,9 @@
21512152 did_append = TRUE;
21522153 #ifdef FEAT_PROP_POPUP
21532154 if ((State & MODE_INSERT) && (State & VREPLACE_FLAG) == 0)
2154- // properties after the split move to the next line
2155+ // Properties after the split move to the next line.
21552156 adjust_props_for_split(curwin->w_cursor.lnum, curwin->w_cursor.lnum,
2156- curwin->w_cursor.col + 1, 0);
2157+ curwin->w_cursor.col + 1, 0);
21572158 #endif
21582159 }
21592160 else
@@ -2248,6 +2249,12 @@
22482249 mark_col_adjust(curwin->w_cursor.lnum,
22492250 curwin->w_cursor.col + less_cols_off,
22502251 1L, (long)-less_cols, 0);
2252+#ifdef FEAT_PROP_POPUP
2253+ // Keep into account the deleted blanks on the new line.
2254+ if (curbuf->b_has_textprop && less_cols_off != 0)
2255+ adjust_prop_columns(curwin->w_cursor.lnum + 1, 0,
2256+ -less_cols_off, 0);
2257+#endif
22512258 }
22522259 else
22532260 changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
diff -r 1df04dc2fa27 -r a04815de0bd3 src/testdir/test_textprop.vim
--- a/src/testdir/test_textprop.vim Sat May 14 19:15:03 2022 +0200
+++ b/src/testdir/test_textprop.vim Sat May 14 20:00:05 2022 +0200
@@ -635,6 +635,18 @@
635635 call assert_equal(expected, prop_list(2))
636636 call DeletePropTypes()
637637
638+ " split at the space character with 'ai' active, the leading space is removed
639+ " in the second line and the prop is shifted accordingly.
640+ let expected = SetupOneLine() " 'xonex xtwoxx'
641+ set ai
642+ exe "normal 6|i\<CR>\<Esc>"
643+ call assert_equal('xonex', getline(1))
644+ call assert_equal('xtwoxx', getline(2))
645+ let expected[1].col -= 6
646+ call assert_equal(expected, prop_list(1) + prop_list(2))
647+ set ai&
648+ call DeletePropTypes()
649+
638650 bwipe!
639651 set bs&
640652 endfunc
diff -r 1df04dc2fa27 -r a04815de0bd3 src/version.c
--- a/src/version.c Sat May 14 19:15:03 2022 +0200
+++ b/src/version.c Sat May 14 20:00:05 2022 +0200
@@ -747,6 +747,8 @@
747747 static int included_patches[] =
748748 { /* Add new patch number below this line */
749749 /**/
750+ 4955,
751+/**/
750752 4954,
751753 /**/
752754 4953,
旧リポジトリブラウザで表示