Patch 7.4.1735
Problem:    It is not possible to only see part of the message history.  It is
            not possible to clear messages.
Solution:   Add a count to ":messages" and a clear argument. (Yasuhiro
            Matsumoto)
Files:      runtime/doc/message.txt, src/ex_cmds.h, src/message.c,
            src/testdir/test_messages.vim, src/testdir/test_alot.vim


*** ../vim-7.4.1734/runtime/doc/message.txt     2013-08-10 13:24:56.000000000 
+0200
--- runtime/doc/message.txt     2016-04-14 17:11:45.802321570 +0200
***************
*** 19,24 ****
--- 19,33 ----
  is especially useful when messages have been overwritten or truncated.  This
  depends on the 'shortmess' option.
  
+       :messages               Show all messages.
+ 
+       :{count}messages        Show the {count} most recent messages.
+ 
+       :messages clear         Clear all messages.
+ 
+       :{count}messages clear  Clear messages, keeping only the {count} most
+                               recent ones.
+ 
  The number of remembered messages is fixed at 20 for the tiny version and 200
  for other versions.
  
***************
*** 58,65 ****
  When an error message is displayed, but it is removed before you could read
  it, you can see it again with: >
    :echo errmsg
! or view a list of recent messages with: >
    :messages
  
  
  LIST OF MESSAGES
--- 67,75 ----
  When an error message is displayed, but it is removed before you could read
  it, you can see it again with: >
    :echo errmsg
! Or view a list of recent messages with: >
    :messages
+ See `:messages` above.
  
  
  LIST OF MESSAGES
***************
*** 476,483 ****
    helps for a change that affects all lines.
  - 'undoreload' Set to zero to disable.
  
- Also see |msdos-limitations|.
- 
                                                        *E339*  >
    Pattern too long
  
--- 486,491 ----
*** ../vim-7.4.1734/src/ex_cmds.h       2016-03-12 20:34:22.820382141 +0100
--- src/ex_cmds.h       2016-04-14 17:02:24.400093889 +0200
***************
*** 886,892 ****
                        EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
                        ADDR_LINES),
  EX(CMD_messages,      "messages",     ex_messages,
!                       TRLBAR|CMDWIN,
                        ADDR_LINES),
  EX(CMD_mkexrc,                "mkexrc",       ex_mkrc,
                        BANG|FILE1|TRLBAR|CMDWIN,
--- 886,892 ----
                        EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
                        ADDR_LINES),
  EX(CMD_messages,      "messages",     ex_messages,
!                       EXTRA|TRLBAR|RANGE|CMDWIN,
                        ADDR_LINES),
  EX(CMD_mkexrc,                "mkexrc",       ex_mkrc,
                        BANG|FILE1|TRLBAR|CMDWIN,
*** ../vim-7.4.1734/src/message.c       2016-03-19 17:05:16.757964115 +0100
--- src/message.c       2016-04-14 17:14:33.060599343 +0200
***************
*** 770,775 ****
--- 770,791 ----
  {
      struct msg_hist *p;
      char_u        *s;
+     int                   c = 0;
+ 
+     if (STRCMP(eap->arg, "clear") == 0)
+     {
+       int keep = eap->addr_count == 0 ? 0 : eap->line2;
+ 
+       while (msg_hist_len > keep)
+           (void)delete_first_msg();
+       return;
+     }
+ 
+     if (*eap->arg != NUL)
+     {
+       EMSG(_(e_invarg));
+       return;
+     }
  
      msg_hist_off = TRUE;
  
***************
*** 779,785 ****
                _("Messages maintainer: Bram Moolenaar <[email protected]>"),
                hl_attr(HLF_T));
  
!     for (p = first_msg_hist; p != NULL && !got_int; p = p->next)
        if (p->msg != NULL)
            msg_attr(p->msg, p->attr);
  
--- 795,817 ----
                _("Messages maintainer: Bram Moolenaar <[email protected]>"),
                hl_attr(HLF_T));
  
!     p = first_msg_hist;
! 
!     if (eap->addr_count != 0)
!     {
!       /* Count total messages */
!       for (; p != NULL && !got_int; p = p->next)
!           c++;
! 
!       c -= eap->line2;
! 
!       /* Skip without number of messages specified */
!       for (p = first_msg_hist; p != NULL && !got_int && c > 0;
!                                                   p = p->next, c--);
!     }
! 
!     /* Display what was not skipped. */
!     for (; p != NULL && !got_int; p = p->next)
        if (p->msg != NULL)
            msg_attr(p->msg, p->attr);
  
*** ../vim-7.4.1734/src/testdir/test_messages.vim       2016-04-14 
17:12:23.369934837 +0200
--- src/testdir/test_messages.vim       2016-04-14 17:07:12.221136184 +0200
***************
*** 0 ****
--- 1,42 ----
+ " Tests for :messages
+ 
+ function Test_messages()
+   let oldmore = &more
+   try
+     set nomore
+ 
+     let arr = map(range(10), '"hello" . v:val')
+     for s in arr
+       echomsg s | redraw
+     endfor
+     let result = ''
+ 
+     redir => result
+     2messages | redraw
+     redir END
+ 
+     " get last two messages
+     let msg = split(result, "\n")[1:][-2:]
+     call assert_equal(["hello8", "hello9"], msg)
+ 
+     " clear messages without last one
+     1messages clear
+     redir => result
+     redraw | 1messages
+     redir END
+     " get last last message
+     let msg = split(result, "\n")[1:][-1:]
+     call assert_equal(['hello9'], msg)
+ 
+     " clear all messages
+     messages clear
+     redir => result
+     redraw | 1messages
+     redir END
+     " get last last message
+     let msg = split(result, "\n")[1:][-1:]
+     call assert_equal([], msg)
+   finally
+     let &more = oldmore
+   endtry
+ endfunction
*** ../vim-7.4.1734/src/testdir/test_alot.vim   2016-04-11 21:54:58.497878752 
+0200
--- src/testdir/test_alot.vim   2016-04-14 17:03:36.163356776 +0200
***************
*** 17,22 ****
--- 17,23 ----
  source test_lispwords.vim
  source test_matchstrpos.vim
  source test_menu.vim
+ source test_messages.vim
  source test_partial.vim
  source test_reltime.vim
  source test_searchpos.vim
*** ../vim-7.4.1734/src/version.c       2016-04-14 16:56:57.115452561 +0200
--- src/version.c       2016-04-14 17:01:55.920386353 +0200
***************
*** 750,751 ****
--- 750,753 ----
  {   /* Add new patch number below this line */
+ /**/
+     1735,
  /**/

-- 
Error:015 - Unable to exit Windows.  Try the door.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui