• R/O
  • SSH

vim: コミット

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


コミットメタ情報

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

ログメッセージ

patch 8.2.4954: inserting line breaks text property spanning two lines

Commit: https://github.com/vim/vim/commit/698cb4c8fa16a4dbe4830648532c09d7e5c89095
Author: LemonBoy <thatlemon@gmail.com>
Date: Sat May 14 18:10:15 2022 +0100

patch 8.2.4954: inserting line breaks text property spanning two lines
Problem: Inserting line breaks text property spanning more then one line.
Solution: Check TP_FLAG_CONT_PREV and TP_FLAG_CONT_NEXT. (closes https://github.com/vim/vim/issues/10423)

変更サマリ

差分

diff -r 82244cfc4694 -r 92736a673e3c src/testdir/test_textprop.vim
--- a/src/testdir/test_textprop.vim Sat May 14 14:45:04 2022 +0200
+++ b/src/testdir/test_textprop.vim Sat May 14 19:15:03 2022 +0200
@@ -1958,4 +1958,37 @@
19581958 bwipe!
19591959 endfunc
19601960
1961+func Test_prop_insert_multiline()
1962+ new
1963+ call AddPropTypes()
1964+
1965+ call setline(1, ['foobar', 'barbaz'])
1966+ call prop_add(1, 4, #{end_lnum: 2, end_col: 4, type: 'one'})
1967+
1968+ call feedkeys("1Goquxqux\<Esc>", 'nxt')
1969+ call feedkeys("2GOquxqux\<Esc>", 'nxt')
1970+
1971+ let lines =<< trim END
1972+ foobar
1973+ quxqux
1974+ quxqux
1975+ barbaz
1976+ END
1977+ call assert_equal(lines, getline(1, '$'))
1978+ let expected = [
1979+ \ {'lnum': 1, 'id': 0, 'col': 4, 'type_bufnr': 0, 'end': 0, 'type': 'one',
1980+ \ 'length': 4 ,'start': 1},
1981+ \ {'lnum': 2, 'id': 0, 'col': 1, 'type_bufnr': 0, 'end': 0, 'type': 'one',
1982+ \ 'length': 7, 'start': 0},
1983+ \ {'lnum': 3, 'id': 0, 'col': 1, 'type_bufnr': 0, 'end': 0, 'type': 'one',
1984+ \ 'length': 7, 'start': 0},
1985+ \ {'lnum': 4, 'id': 0, 'col': 1, 'type_bufnr': 0, 'end': 1, 'type': 'one',
1986+ \ 'length': 3, 'start': 0}
1987+ \ ]
1988+ call assert_equal(expected, prop_list(1, #{end_lnum: 10}))
1989+
1990+ call DeletePropTypes()
1991+ bwipe!
1992+endfunc
1993+
19611994 " vim: shiftwidth=2 sts=2 expandtab
diff -r 82244cfc4694 -r 92736a673e3c src/textprop.c
--- a/src/textprop.c Sat May 14 14:45:04 2022 +0200
+++ b/src/textprop.c Sat May 14 19:15:03 2022 +0200
@@ -1650,11 +1650,12 @@
16501650 proptype_T *pt = text_prop_type_by_id(curbuf, prop->tp_type);
16511651 int start_incl = (pt != NULL
16521652 && (pt->pt_flags & PT_FLAG_INS_START_INCL))
1653- || (flags & APC_SUBSTITUTE);
1653+ || (flags & APC_SUBSTITUTE)
1654+ || (prop->tp_flags & TP_FLAG_CONT_PREV);
16541655 int end_incl = (pt != NULL
1655- && (pt->pt_flags & PT_FLAG_INS_END_INCL));
1656- // Do not drop zero-width props if they later can increase in
1657- // size.
1656+ && (pt->pt_flags & PT_FLAG_INS_END_INCL))
1657+ || (prop->tp_flags & TP_FLAG_CONT_NEXT);
1658+ // Do not drop zero-width props if they later can increase in size.
16581659 int droppable = !(start_incl || end_incl);
16591660 adjustres_T res = {TRUE, FALSE};
16601661
diff -r 82244cfc4694 -r 92736a673e3c src/version.c
--- a/src/version.c Sat May 14 14:45:04 2022 +0200
+++ b/src/version.c Sat May 14 19:15:03 2022 +0200
@@ -747,6 +747,8 @@
747747 static int included_patches[] =
748748 { /* Add new patch number below this line */
749749 /**/
750+ 4954,
751+/**/
750752 4953,
751753 /**/
752754 4952,
旧リポジトリブラウザで表示