mirror of
https://github.com/vim/vim.git
synced 2026-05-06 12:26:58 -04:00
patch 9.2.0425: Cannot silence undo/redo messages
Problem: Cannot silence undo/redo messages
Solution: Add "u" flag to 'shortmess' option
(Shougo Matsushita).
fixes: #20049
closes: #20107
Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
ec8b8bd82a
commit
d25f8d1b2c
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 9.2. Last change: 2026 Apr 29
|
||||
*options.txt* For Vim version 9.2. Last change: 2026 May 01
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -8044,6 +8044,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
search count statistics. The maximum limit can be set with
|
||||
the 'maxsearchcount' option, see also |searchcount()|
|
||||
function.
|
||||
u don't give undo and redo messages like *shm-u*
|
||||
"1 line less; before #1 1 second ago", "Already at oldest
|
||||
change" or "Already at newest change"
|
||||
|
||||
This gives you the opportunity to avoid that a change between buffers
|
||||
requires you to hit <Enter>, but still gives as useful a message as
|
||||
|
||||
@@ -10331,6 +10331,7 @@ shm-q options.txt /*shm-q*
|
||||
shm-r options.txt /*shm-r*
|
||||
shm-s options.txt /*shm-s*
|
||||
shm-t options.txt /*shm-t*
|
||||
shm-u options.txt /*shm-u*
|
||||
shm-w options.txt /*shm-w*
|
||||
shm-x options.txt /*shm-x*
|
||||
short-name-changed version4.txt /*short-name-changed*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*version9.txt* For Vim version 9.2. Last change: 2026 Apr 29
|
||||
*version9.txt* For Vim version 9.2. Last change: 2026 May 01
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -52621,6 +52621,7 @@ Other ~
|
||||
- Added the "noinsert" value to the 'wildmode' option for symmetry with the
|
||||
'completeopt' option
|
||||
- Channel can handle |Blob| messages |channel-open-options|.
|
||||
- Added the "u" flag to 'shortmess' to silence undo/redo messages: |shm-u|
|
||||
|
||||
Platform specific ~
|
||||
-----------------
|
||||
|
||||
+2
-1
@@ -277,8 +277,9 @@ typedef enum {
|
||||
#define SHM_RECORDING 'q' // short recording message
|
||||
#define SHM_FILEINFO 'F' // no file info messages
|
||||
#define SHM_SEARCHCOUNT 'S' // no search stats: '[1/10]'
|
||||
#define SHM_UNDO 'u' // undo messages
|
||||
#define SHM_POSIX "AS" // POSIX value
|
||||
#define SHM_ALL "rmfixlnwaWtToOsAIcCqFS" // all possible flags for 'shm'
|
||||
#define SHM_ALL "rmfixlnwaWtToOsAIcCqFSu" // all possible flags for 'shm'
|
||||
#define SHM_LEN 30 // max length of all flags together
|
||||
// plus a NUL character
|
||||
|
||||
|
||||
@@ -837,4 +837,69 @@ func Test_fileinfo_after_last_bd()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_undo_messages()
|
||||
new
|
||||
|
||||
" Normal undo/redo messages
|
||||
redir => result
|
||||
call setline(1, 'foo')
|
||||
undo
|
||||
undo
|
||||
redo
|
||||
redo
|
||||
redir END
|
||||
let msg_list = split(result, "\n")
|
||||
call assert_match("^1 line less; before #1", msg_list[0])
|
||||
call assert_equal("Already at oldest change", msg_list[1])
|
||||
call assert_match("^1 more line; after #1", msg_list[2])
|
||||
call assert_equal("Already at newest change", msg_list[3])
|
||||
|
||||
" Ignore undo/redo messages
|
||||
redir => result
|
||||
set shortmess+=u
|
||||
call setline(1, 'foo')
|
||||
undo
|
||||
undo
|
||||
redo
|
||||
redo
|
||||
redir END
|
||||
let msg_list = split(result, "\n")
|
||||
call assert_equal([], msg_list)
|
||||
set shortmess&
|
||||
|
||||
" undo_time() path: :earlier and :later go through a separate
|
||||
" message site than u_doit(); make sure SHM_UNDO suppresses it too.
|
||||
enew!
|
||||
call setline(1, 'a')
|
||||
call setline(1, 'b')
|
||||
call setline(1, 'c')
|
||||
|
||||
redir => result
|
||||
earlier 1
|
||||
earlier 999
|
||||
earlier 999
|
||||
later 1
|
||||
later 999
|
||||
redir END
|
||||
let msg_list = split(result, "\n")
|
||||
call assert_match('^1 line less; before #', msg_list[0])
|
||||
call assert_match('^1 changes; before #', msg_list[1])
|
||||
call assert_match('^1 changes; before #', msg_list[2])
|
||||
call assert_match('^1 more line; after #', msg_list[3])
|
||||
call assert_equal('Already at newest change', msg_list[4])
|
||||
|
||||
set shortmess+=u
|
||||
redir => result
|
||||
earlier 1
|
||||
earlier 999
|
||||
later 1
|
||||
later 999
|
||||
later 999
|
||||
redir END
|
||||
call assert_equal([], split(result, "\n"))
|
||||
|
||||
set shortmess&
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
+13
-7
@@ -2262,7 +2262,8 @@ u_doit(int startcount)
|
||||
beep_flush();
|
||||
if (count == startcount - 1)
|
||||
{
|
||||
msg(_("Already at oldest change"));
|
||||
if (!shortmess(SHM_UNDO))
|
||||
msg(_("Already at oldest change"));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -2277,7 +2278,8 @@ u_doit(int startcount)
|
||||
beep_flush(); // nothing to redo
|
||||
if (count == startcount - 1)
|
||||
{
|
||||
msg(_("Already at newest change"));
|
||||
if (!shortmess(SHM_UNDO))
|
||||
msg(_("Already at newest change"));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -2530,10 +2532,13 @@ undo_time(
|
||||
|
||||
if (closest == closest_start)
|
||||
{
|
||||
if (step < 0)
|
||||
msg(_("Already at oldest change"));
|
||||
else
|
||||
msg(_("Already at newest change"));
|
||||
if (!shortmess(SHM_UNDO))
|
||||
{
|
||||
if (step < 0)
|
||||
msg(_("Already at oldest change"));
|
||||
else
|
||||
msg(_("Already at newest change"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2996,7 +3001,8 @@ u_undo_end(
|
||||
#endif
|
||||
|
||||
if (global_busy // no messages now, wait until global is finished
|
||||
|| !messaging()) // 'lazyredraw' set, don't do messages now
|
||||
|| !messaging() // 'lazyredraw' set, don't do messages now
|
||||
|| shortmess(SHM_UNDO))
|
||||
return;
|
||||
|
||||
if (curbuf->b_ml.ml_flags & ML_EMPTY)
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
425,
|
||||
/**/
|
||||
424,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user