Patch 8.2.4955
Problem: Text property in wrong position after auto-indent.
Solution: Adjust text property columns. (closes #10422, closes #7719)
Files: src/change.c, src/testdir/test_textprop.vim
*** ../vim-8.2.4954/src/change.c 2022-05-14 11:52:19.205341190 +0100
--- src/change.c 2022-05-14 18:46:44.431675757 +0100
***************
*** 1372,1378 ****
char_u *next_line = NULL; // copy of the next line
char_u *p_extra = NULL; // what goes to next line
int less_cols = 0; // less columns for mark in new
line
! int less_cols_off = 0; // columns to skip for mark
adjust
pos_T old_cursor; // old cursor position
int newcol = 0; // new cursor column
int newindent = 0; // auto-indent of the new line
--- 1372,1379 ----
char_u *next_line = NULL; // copy of the next line
char_u *p_extra = NULL; // what goes to next line
int less_cols = 0; // less columns for mark in new
line
! int less_cols_off = 0; // columns to skip for mark and
! // textprop adjustment
pos_T old_cursor; // old cursor position
int newcol = 0; // new cursor column
int newindent = 0; // auto-indent of the new line
***************
*** 2151,2159 ****
did_append = TRUE;
#ifdef FEAT_PROP_POPUP
if ((State & MODE_INSERT) && (State & VREPLACE_FLAG) == 0)
! // properties after the split move to the next line
adjust_props_for_split(curwin->w_cursor.lnum, curwin->w_cursor.lnum,
! curwin->w_cursor.col + 1, 0);
#endif
}
else
--- 2152,2160 ----
did_append = TRUE;
#ifdef FEAT_PROP_POPUP
if ((State & MODE_INSERT) && (State & VREPLACE_FLAG) == 0)
! // Properties after the split move to the next line.
adjust_props_for_split(curwin->w_cursor.lnum, curwin->w_cursor.lnum,
! curwin->w_cursor.col + 1, 0);
#endif
}
else
***************
*** 2248,2253 ****
--- 2249,2260 ----
mark_col_adjust(curwin->w_cursor.lnum,
curwin->w_cursor.col + less_cols_off,
1L, (long)-less_cols, 0);
+ #ifdef FEAT_PROP_POPUP
+ // Keep into account the deleted blanks on the new line.
+ if (curbuf->b_has_textprop && less_cols_off != 0)
+ adjust_prop_columns(curwin->w_cursor.lnum + 1, 0,
+ -less_cols_off, 0);
+ #endif
}
else
changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
*** ../vim-8.2.4954/src/testdir/test_textprop.vim 2022-05-14
18:10:12.166454734 +0100
--- src/testdir/test_textprop.vim 2022-05-14 18:28:53.313689331 +0100
***************
*** 635,640 ****
--- 635,652 ----
call assert_equal(expected, prop_list(2))
call DeletePropTypes()
+ " split at the space character with 'ai' active, the leading space is
removed
+ " in the second line and the prop is shifted accordingly.
+ let expected = SetupOneLine() " 'xonex xtwoxx'
+ set ai
+ exe "normal 6|i\<CR>\<Esc>"
+ call assert_equal('xonex', getline(1))
+ call assert_equal('xtwoxx', getline(2))
+ let expected[1].col -= 6
+ call assert_equal(expected, prop_list(1) + prop_list(2))
+ set ai&
+ call DeletePropTypes()
+
bwipe!
set bs&
endfunc
*** ../vim-8.2.4954/src/version.c 2022-05-14 18:10:12.170454730 +0100
--- src/version.c 2022-05-14 18:44:45.644421122 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4955,
/**/
--
Some of the well known MS-Windows errors:
ETIME Wrong time, wait a little while
ECRASH Try again...
EDETECT Unable to detect errors
EOVER You lost! Play another game?
ENOCLUE Eh, what did you want?
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220514174847.AC9461C076D%40moolenaar.net.