mirror of
https://github.com/neovim/neovim.git
synced 2025-11-04 17:54:30 +00:00
Merge #8984 from janlazo/vim-8.1.0034
This commit is contained in:
@@ -298,7 +298,7 @@ static void insert_enter(InsertState *s)
|
|||||||
|
|
||||||
// Check if the cursor line needs redrawing before changing State. If
|
// Check if the cursor line needs redrawing before changing State. If
|
||||||
// 'concealcursor' is "n" it needs to be redrawn without concealing.
|
// 'concealcursor' is "n" it needs to be redrawn without concealing.
|
||||||
conceal_check_cursur_line();
|
conceal_check_cursor_line();
|
||||||
|
|
||||||
// When doing a paste with the middle mouse button, Insstart is set to
|
// When doing a paste with the middle mouse button, Insstart is set to
|
||||||
// where the paste started.
|
// where the paste started.
|
||||||
|
|||||||
@@ -2546,12 +2546,18 @@ int do_ecmd(
|
|||||||
}
|
}
|
||||||
check_arg_idx(curwin);
|
check_arg_idx(curwin);
|
||||||
|
|
||||||
// If autocommands change the cursor position or topline, we should keep
|
// If autocommands change the cursor position or topline, we should
|
||||||
// it. Also when it moves within a line.
|
// keep it. Also when it moves within a line. But not when it moves
|
||||||
|
// to the first non-blank.
|
||||||
if (!equalpos(curwin->w_cursor, orig_pos)) {
|
if (!equalpos(curwin->w_cursor, orig_pos)) {
|
||||||
|
const char_u *text = get_cursor_line_ptr();
|
||||||
|
|
||||||
|
if (curwin->w_cursor.lnum != orig_pos.lnum
|
||||||
|
|| curwin->w_cursor.col != (int)(skipwhite(text) - text)) {
|
||||||
newlnum = curwin->w_cursor.lnum;
|
newlnum = curwin->w_cursor.lnum;
|
||||||
newcol = curwin->w_cursor.col;
|
newcol = curwin->w_cursor.col;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (curwin->w_topline == topline)
|
if (curwin->w_topline == topline)
|
||||||
topline = 0;
|
topline = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -8735,7 +8735,7 @@ static char_u *arg_all(void)
|
|||||||
#ifndef BACKSLASH_IN_FILENAME
|
#ifndef BACKSLASH_IN_FILENAME
|
||||||
|| *p == '\\'
|
|| *p == '\\'
|
||||||
#endif
|
#endif
|
||||||
) {
|
|| *p == '`') {
|
||||||
// insert a backslash
|
// insert a backslash
|
||||||
if (retval != NULL) {
|
if (retval != NULL) {
|
||||||
retval[len] = '\\';
|
retval[len] = '\\';
|
||||||
|
|||||||
@@ -6496,8 +6496,8 @@ void may_start_select(int c)
|
|||||||
*/
|
*/
|
||||||
static void n_start_visual_mode(int c)
|
static void n_start_visual_mode(int c)
|
||||||
{
|
{
|
||||||
/* Check for redraw before changing the state. */
|
// Check for redraw before changing the state.
|
||||||
conceal_check_cursur_line();
|
conceal_check_cursor_line();
|
||||||
|
|
||||||
VIsual_mode = c;
|
VIsual_mode = c;
|
||||||
VIsual_active = true;
|
VIsual_active = true;
|
||||||
@@ -6514,8 +6514,8 @@ static void n_start_visual_mode(int c)
|
|||||||
foldAdjustVisual();
|
foldAdjustVisual();
|
||||||
|
|
||||||
setmouse();
|
setmouse();
|
||||||
/* Check for redraw after changing the state. */
|
// Check for redraw after changing the state.
|
||||||
conceal_check_cursur_line();
|
conceal_check_cursor_line();
|
||||||
|
|
||||||
if (p_smd && msg_silent == 0)
|
if (p_smd && msg_silent == 0)
|
||||||
redraw_cmdline = true; /* show visual mode later */
|
redraw_cmdline = true; /* show visual mode later */
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ int conceal_cursor_line(win_T *wp)
|
|||||||
/*
|
/*
|
||||||
* Check if the cursor line needs to be redrawn because of 'concealcursor'.
|
* Check if the cursor line needs to be redrawn because of 'concealcursor'.
|
||||||
*/
|
*/
|
||||||
void conceal_check_cursur_line(void)
|
void conceal_check_cursor_line(void)
|
||||||
{
|
{
|
||||||
if (curwin->w_p_cole > 0 && conceal_cursor_line(curwin)) {
|
if (curwin->w_p_cole > 0 && conceal_cursor_line(curwin)) {
|
||||||
need_cursor_line_redraw = TRUE;
|
need_cursor_line_redraw = TRUE;
|
||||||
|
|||||||
@@ -1338,6 +1338,14 @@ func! Test_edit_rightleft()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_edit_backtick()
|
||||||
|
next a\`b c
|
||||||
|
call assert_equal('a`b', expand('%'))
|
||||||
|
next
|
||||||
|
call assert_equal('c', expand('%'))
|
||||||
|
call assert_equal('a\`b c', expand('##'))
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_edit_quit()
|
func Test_edit_quit()
|
||||||
edit foo.txt
|
edit foo.txt
|
||||||
split
|
split
|
||||||
@@ -1390,3 +1398,18 @@ func Test_edit_complete_very_long_name()
|
|||||||
endif
|
endif
|
||||||
set swapfile&
|
set swapfile&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_edit_alt()
|
||||||
|
" Keeping the cursor line didn't happen when the first line has indent.
|
||||||
|
new
|
||||||
|
call setline(1, [' one', 'two', 'three'])
|
||||||
|
w XAltFile
|
||||||
|
$
|
||||||
|
call assert_equal(3, line('.'))
|
||||||
|
e Xother
|
||||||
|
e #
|
||||||
|
call assert_equal(3, line('.'))
|
||||||
|
|
||||||
|
bwipe XAltFile
|
||||||
|
call delete('XAltFile')
|
||||||
|
endfunc
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ void ui_cursor_shape(void)
|
|||||||
mode_idx = new_mode_idx;
|
mode_idx = new_mode_idx;
|
||||||
pending_mode_update = true;
|
pending_mode_update = true;
|
||||||
}
|
}
|
||||||
conceal_check_cursur_line();
|
conceal_check_cursor_line();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if `widget` is externalized.
|
/// Returns true if `widget` is externalized.
|
||||||
|
|||||||
Reference in New Issue
Block a user