Loading ...
Sorry, an error occurred while loading the content.
 

Bug: Command-line not always erased by ":echo"

Expand Messages
  • Tony Mechelynck
    :echo apparently erases only part of the command-line in some circumstances. After defining the following function function TestForX() let @+ = let x =
    Message 1 of 2 , Apr 1, 2009
      ":echo" apparently erases only part of the command-line in some
      circumstances.

      After defining the following function

      function TestForX()
      let @+ = " "
      let x = @+
      let @+ = '--' . x
      redir @"
      silent reg
      redir END
      let @+ = x
      return (@" =~ '\n"+ ')
      endfunction

      (which actually tests, not for X but for clipboard usability),

      :echo TestForX()

      returns either ":echo TestF0" or ":echo TestF1". This problem is
      apparently only cosmetic, since

      :if TestForX()|echo 'yes'|else|echo 'no'|endif

      returns ":if TestForyes" or ":if TestForno", not always the same string.

      So, for some reason, if that function was used, ":echo" does not erase
      the first 11 characters on the command-line.

      If it makes any difference, my 'cmdheight' is set to 2 and I tested this
      using a Huge Vim 7.2.148 for GTK2/Gnome2 in console mode on Linux, both
      in konsole (where it takes the "true" branch of the above ":if") and in
      the Linux console (where it takes the "else" branch)...


      Best regards,
      Tony.
      --
      ARTHUR: ... and I am your king ....
      OLD WOMAN: Ooooh! I didn't know we had a king. I thought we were an
      autonomous collective ...
      "Monty Python and the Holy Grail" PYTHON (MONTY)
      PICTURES LTD

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Bram Moolenaar
      ... I see the problem. When redirecting silently the message column is still advanced and it s never reset. Not avancing the column causes trouble for some
      Message 2 of 2 , Apr 4, 2009
        Tony Mechelynck wrote:

        > ":echo" apparently erases only part of the command-line in some
        > circumstances.
        >
        > After defining the following function
        >
        > function TestForX()
        > let @+ = " "
        > let x = @+
        > let @+ = '--' . x
        > redir @"
        > silent reg
        > redir END
        > let @+ = x
        > return (@" =~ '\n"+ ')
        > endfunction
        >
        > (which actually tests, not for X but for clipboard usability),
        >
        > :echo TestForX()
        >
        > returns either ":echo TestF0" or ":echo TestF1". This problem is
        > apparently only cosmetic, since
        >
        > :if TestForX()|echo 'yes'|else|echo 'no'|endif
        >
        > returns ":if TestForyes" or ":if TestForno", not always the same string.
        >
        > So, for some reason, if that function was used, ":echo" does not erase
        > the first 11 characters on the command-line.
        >
        > If it makes any difference, my 'cmdheight' is set to 2 and I tested this
        > using a Huge Vim 7.2.148 for GTK2/Gnome2 in console mode on Linux, both
        > in konsole (where it takes the "true" branch of the above ":if") and in
        > the Linux console (where it takes the "else" branch)...

        I see the problem. When redirecting silently the message column is
        still advanced and it's never reset. Not avancing the column causes
        trouble for some lists, so the solution will be to reset the column
        after the command is done.

        --
        GALAHAD turns back. We see from his POV the lovely ZOOT standing by him
        smiling enchantingly and a number of equally delectable GIRLIES draped
        around in the seductively poulticed room. They look at him smilingly and
        wave.
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.