mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 03:16:31 +00:00
Merge #10645 from janlazo/vim-8.1.0999
vim-patch:8.1.{1005,1041,1049,1052,1053,1086,1394}
This commit is contained in:
@@ -5171,18 +5171,21 @@ chk_modeline(
|
|||||||
|
|
||||||
// Return true if "buf" is a help buffer.
|
// Return true if "buf" is a help buffer.
|
||||||
bool bt_help(const buf_T *const buf)
|
bool bt_help(const buf_T *const buf)
|
||||||
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
return buf != NULL && buf->b_help;
|
return buf != NULL && buf->b_help;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if "buf" is the quickfix buffer.
|
// Return true if "buf" is the quickfix buffer.
|
||||||
bool bt_quickfix(const buf_T *const buf)
|
bool bt_quickfix(const buf_T *const buf)
|
||||||
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
return buf != NULL && buf->b_p_bt[0] == 'q';
|
return buf != NULL && buf->b_p_bt[0] == 'q';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if "buf" is a terminal buffer.
|
// Return true if "buf" is a terminal buffer.
|
||||||
bool bt_terminal(const buf_T *const buf)
|
bool bt_terminal(const buf_T *const buf)
|
||||||
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
return buf != NULL && buf->b_p_bt[0] == 't';
|
return buf != NULL && buf->b_p_bt[0] == 't';
|
||||||
}
|
}
|
||||||
@@ -5190,6 +5193,7 @@ bool bt_terminal(const buf_T *const buf)
|
|||||||
// Return true if "buf" is a "nofile", "acwrite" or "terminal" buffer.
|
// Return true if "buf" is a "nofile", "acwrite" or "terminal" buffer.
|
||||||
// This means the buffer name is not a file name.
|
// This means the buffer name is not a file name.
|
||||||
bool bt_nofile(const buf_T *const buf)
|
bool bt_nofile(const buf_T *const buf)
|
||||||
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
|
return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
|
||||||
|| buf->b_p_bt[0] == 'a' || buf->terminal);
|
|| buf->b_p_bt[0] == 'a' || buf->terminal);
|
||||||
@@ -5197,11 +5201,13 @@ bool bt_nofile(const buf_T *const buf)
|
|||||||
|
|
||||||
// Return true if "buf" is a "nowrite", "nofile" or "terminal" buffer.
|
// Return true if "buf" is a "nowrite", "nofile" or "terminal" buffer.
|
||||||
bool bt_dontwrite(const buf_T *const buf)
|
bool bt_dontwrite(const buf_T *const buf)
|
||||||
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
return buf != NULL && (buf->b_p_bt[0] == 'n' || buf->terminal);
|
return buf != NULL && (buf->b_p_bt[0] == 'n' || buf->terminal);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bt_dontwrite_msg(const buf_T *const buf)
|
bool bt_dontwrite_msg(const buf_T *const buf)
|
||||||
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
if (bt_dontwrite(buf)) {
|
if (bt_dontwrite(buf)) {
|
||||||
EMSG(_("E382: Cannot write, 'buftype' option is set"));
|
EMSG(_("E382: Cannot write, 'buftype' option is set"));
|
||||||
|
@@ -6761,8 +6761,9 @@ void ex_splitview(exarg_T *eap)
|
|||||||
if (*eap->arg != NUL
|
if (*eap->arg != NUL
|
||||||
) {
|
) {
|
||||||
RESET_BINDING(curwin);
|
RESET_BINDING(curwin);
|
||||||
} else
|
} else {
|
||||||
do_check_scrollbind(FALSE);
|
do_check_scrollbind(false);
|
||||||
|
}
|
||||||
do_exedit(eap, old_curwin);
|
do_exedit(eap, old_curwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -127,7 +127,11 @@
|
|||||||
# define MB_CHAR2LEN(c) mb_char2len(c)
|
# define MB_CHAR2LEN(c) mb_char2len(c)
|
||||||
# define PTR2CHAR(p) utf_ptr2char(p)
|
# define PTR2CHAR(p) utf_ptr2char(p)
|
||||||
|
|
||||||
# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
|
# define RESET_BINDING(wp) \
|
||||||
|
do { \
|
||||||
|
(wp)->w_p_scb = false; \
|
||||||
|
(wp)->w_p_crb = false; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/// Calculate the length of a C array
|
/// Calculate the length of a C array
|
||||||
///
|
///
|
||||||
|
@@ -1245,12 +1245,12 @@ static void botline_forw(lineoff_T *lp)
|
|||||||
} else {
|
} else {
|
||||||
++lp->lnum;
|
++lp->lnum;
|
||||||
lp->fill = 0;
|
lp->fill = 0;
|
||||||
if (lp->lnum > curbuf->b_ml.ml_line_count)
|
if (lp->lnum > curbuf->b_ml.ml_line_count) {
|
||||||
lp->height = MAXCOL;
|
lp->height = MAXCOL;
|
||||||
else if (hasFolding(lp->lnum, NULL, &lp->lnum))
|
} else if (hasFolding(lp->lnum, NULL, &lp->lnum)) {
|
||||||
/* Add a closed fold */
|
// Add a closed fold
|
||||||
lp->height = 1;
|
lp->height = 1;
|
||||||
else {
|
} else {
|
||||||
lp->height = plines_nofill(lp->lnum);
|
lp->height = plines_nofill(lp->lnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7467,8 +7467,12 @@ static void nv_esc(cmdarg_T *cap)
|
|||||||
&& cmdwin_type == 0
|
&& cmdwin_type == 0
|
||||||
&& !VIsual_active
|
&& !VIsual_active
|
||||||
&& no_reason) {
|
&& no_reason) {
|
||||||
|
if (anyBufIsChanged()) {
|
||||||
MSG(_("Type :qa! and press <Enter> to abandon all changes"
|
MSG(_("Type :qa! and press <Enter> to abandon all changes"
|
||||||
" and exit Nvim"));
|
" and exit Nvim"));
|
||||||
|
} else {
|
||||||
|
MSG(_("Type :qa and press <Enter> to exit Nvim"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't reset "restart_edit" when 'insertmode' is set, it won't be
|
/* Don't reset "restart_edit" when 'insertmode' is set, it won't be
|
||||||
|
@@ -2519,9 +2519,9 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
|
|||||||
endcol = (colnr_T)STRLEN(p);
|
endcol = (colnr_T)STRLEN(p);
|
||||||
if (startcol > endcol
|
if (startcol > endcol
|
||||||
|| is_oneChar
|
|| is_oneChar
|
||||||
)
|
) {
|
||||||
bd.textlen = 0;
|
bd.textlen = 0;
|
||||||
else {
|
} else {
|
||||||
bd.textlen = endcol - startcol + oap->inclusive;
|
bd.textlen = endcol - startcol + oap->inclusive;
|
||||||
}
|
}
|
||||||
bd.textstart = p + startcol;
|
bd.textstart = p + startcol;
|
||||||
|
@@ -524,54 +524,6 @@ func Test_shape_final()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_shape_final_to_medial()
|
|
||||||
new
|
|
||||||
set arabicshape
|
|
||||||
|
|
||||||
" Shaping arabic {testchar} arabic Tests chg_c_f2m().
|
|
||||||
" This does not test much...
|
|
||||||
" pair[0] = testchar, pair[1] = current-result
|
|
||||||
for pair in [[s:a_f_YEH_HAMZA, s:a_f_BEH],
|
|
||||||
\[s:a_f_WAW_HAMZA, s:a_s_BEH],
|
|
||||||
\[s:a_f_ALEF, s:a_s_BEH],
|
|
||||||
\[s:a_f_TEH_MARBUTA, s:a_s_BEH],
|
|
||||||
\[s:a_f_DAL, s:a_s_BEH],
|
|
||||||
\[s:a_f_THAL, s:a_s_BEH],
|
|
||||||
\[s:a_f_REH, s:a_s_BEH],
|
|
||||||
\[s:a_f_ZAIN, s:a_s_BEH],
|
|
||||||
\[s:a_f_WAW, s:a_s_BEH],
|
|
||||||
\[s:a_f_ALEF_MAKSURA, s:a_s_BEH],
|
|
||||||
\[s:a_f_BEH, s:a_f_BEH],
|
|
||||||
\[s:a_f_TEH, s:a_f_BEH],
|
|
||||||
\[s:a_f_THEH, s:a_f_BEH],
|
|
||||||
\[s:a_f_JEEM, s:a_f_BEH],
|
|
||||||
\[s:a_f_HAH, s:a_f_BEH],
|
|
||||||
\[s:a_f_KHAH, s:a_f_BEH],
|
|
||||||
\[s:a_f_SEEN, s:a_f_BEH],
|
|
||||||
\[s:a_f_SHEEN, s:a_f_BEH],
|
|
||||||
\[s:a_f_SAD, s:a_f_BEH],
|
|
||||||
\[s:a_f_DAD, s:a_f_BEH],
|
|
||||||
\[s:a_f_TAH, s:a_f_BEH],
|
|
||||||
\[s:a_f_ZAH, s:a_f_BEH],
|
|
||||||
\[s:a_f_AIN, s:a_f_BEH],
|
|
||||||
\[s:a_f_GHAIN, s:a_f_BEH],
|
|
||||||
\[s:a_f_FEH, s:a_f_BEH],
|
|
||||||
\[s:a_f_QAF, s:a_f_BEH],
|
|
||||||
\[s:a_f_KAF, s:a_f_BEH],
|
|
||||||
\[s:a_f_LAM, s:a_f_BEH],
|
|
||||||
\[s:a_f_MEEM, s:a_f_BEH],
|
|
||||||
\[s:a_f_NOON, s:a_f_BEH],
|
|
||||||
\[s:a_f_HEH, s:a_f_BEH],
|
|
||||||
\[s:a_f_YEH, s:a_f_BEH],
|
|
||||||
\ ]
|
|
||||||
call setline(1, ' ' . s:a_BEH . pair[0])
|
|
||||||
call assert_equal([' ' . pair[1] . pair[0]], ScreenLines(1, 3))
|
|
||||||
endfor
|
|
||||||
|
|
||||||
set arabicshape&
|
|
||||||
bwipe!
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_shape_combination_final()
|
func Test_shape_combination_final()
|
||||||
new
|
new
|
||||||
set arabicshape
|
set arabicshape
|
||||||
|
@@ -2552,6 +2552,21 @@ func Test_delete_until_paragraph()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_message_when_using_ctrl_c()
|
||||||
|
" Make sure no buffers are changed.
|
||||||
|
%bwipe!
|
||||||
|
|
||||||
|
exe "normal \<C-C>"
|
||||||
|
call assert_match("Type :qa and press <Enter> to exit Nvim", Screenline(&lines))
|
||||||
|
|
||||||
|
new
|
||||||
|
cal setline(1, 'hi!')
|
||||||
|
exe "normal \<C-C>"
|
||||||
|
call assert_match("Type :qa! and press <Enter> to abandon all changes and exit Nvim", Screenline(&lines))
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test for '[m', ']m', '[M' and ']M'
|
" Test for '[m', ']m', '[M' and ']M'
|
||||||
" Jumping to beginning and end of methods in Java-like languages
|
" Jumping to beginning and end of methods in Java-like languages
|
||||||
func Test_java_motion()
|
func Test_java_motion()
|
||||||
|
@@ -68,12 +68,17 @@ endfunc
|
|||||||
" characters as an escape sequence.
|
" characters as an escape sequence.
|
||||||
func Test_recording_esc_sequence()
|
func Test_recording_esc_sequence()
|
||||||
new
|
new
|
||||||
|
try
|
||||||
let save_F2 = &t_F2
|
let save_F2 = &t_F2
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
let t_F2 = "\<Esc>OQ"
|
let t_F2 = "\<Esc>OQ"
|
||||||
call feedkeys("qqiTest\<Esc>", "xt")
|
call feedkeys("qqiTest\<Esc>", "xt")
|
||||||
call feedkeys("OQuirk\<Esc>q", "xt")
|
call feedkeys("OQuirk\<Esc>q", "xt")
|
||||||
call feedkeys("Go\<Esc>@q", "xt")
|
call feedkeys("Go\<Esc>@q", "xt")
|
||||||
call assert_equal(['Quirk', 'Test', 'Quirk', 'Test'], getline(1, 4))
|
call assert_equal(['Quirk', 'Test', 'Quirk', 'Test'], getline(1, 4))
|
||||||
bwipe!
|
bwipe!
|
||||||
let t_F2 = save_F2
|
if exists('save_F2')
|
||||||
|
let &t_F2 = save_F2
|
||||||
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -2961,10 +2961,23 @@ static char_u *u_save_line(linenr_T lnum)
|
|||||||
///
|
///
|
||||||
/// @return true if the buffer has changed
|
/// @return true if the buffer has changed
|
||||||
bool bufIsChanged(buf_T *buf)
|
bool bufIsChanged(buf_T *buf)
|
||||||
|
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
return !bt_dontwrite(buf) && (buf->b_changed || file_ff_differs(buf, true));
|
return !bt_dontwrite(buf) && (buf->b_changed || file_ff_differs(buf, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return true if any buffer has changes. Also buffers that are not written.
|
||||||
|
bool anyBufIsChanged(void)
|
||||||
|
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
|
{
|
||||||
|
FOR_ALL_BUFFERS(buf) {
|
||||||
|
if (bufIsChanged(buf)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// Check if the 'modified' flag is set, or 'ff' has changed (only need to
|
/// Check if the 'modified' flag is set, or 'ff' has changed (only need to
|
||||||
/// check the first character, because it can only be "dos", "unix" or "mac").
|
/// check the first character, because it can only be "dos", "unix" or "mac").
|
||||||
/// "nofile" and "scratch" type buffers are considered to always be unchanged.
|
/// "nofile" and "scratch" type buffers are considered to always be unchanged.
|
||||||
|
@@ -275,7 +275,7 @@ describe('system()', function()
|
|||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
Type :qa! and press <E...all changes and exit Nvim |
|
Type :qa and press <Enter> to exit Nvim |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
@@ -481,7 +481,7 @@ describe('systemlist()', function()
|
|||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
Type :qa! and press <E...all changes and exit Nvim |
|
Type :qa and press <Enter> to exit Nvim |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@@ -494,7 +494,7 @@ describe('Command-line coloring', function()
|
|||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
Type :qa! and pr...nges and exit Nvim |
|
Type :qa and pre...nter> to exit Nvim |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
it('works fine with NUL, NL, CR', function()
|
it('works fine with NUL, NL, CR', function()
|
||||||
|
@@ -631,7 +631,7 @@ describe('ui/ext_messages', function()
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
]], messages={{
|
]], messages={{
|
||||||
content = {{ "Type :qa! and press <Enter> to abandon all changes and exit Nvim" }},
|
content = {{ "Type :qa and press <Enter> to exit Nvim" }},
|
||||||
kind = ""}
|
kind = ""}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
@@ -678,7 +678,7 @@ describe('ui/ext_messages', function()
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
]], messages={
|
]], messages={
|
||||||
{kind="echomsg", content={{"howdy"}}},
|
{kind="echomsg", content={{"howdy"}}},
|
||||||
{kind="", content={{"Type :qa! and press <Enter> to abandon all changes and exit Nvim"}}},
|
{kind="", content={{"Type :qa and press <Enter> to exit Nvim"}}},
|
||||||
{kind="echoerr", content={{"bork", 2}}},
|
{kind="echoerr", content={{"bork", 2}}},
|
||||||
{kind="emsg", content={{"E117: Unknown function: nosuchfunction", 2}}}
|
{kind="emsg", content={{"E117: Unknown function: nosuchfunction", 2}}}
|
||||||
}}
|
}}
|
||||||
|
Reference in New Issue
Block a user