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

Superfluous blank lines inserted with :a, :i and :c

Expand Messages
  • Haakon Riiser
    (This is a slightly modified version of a mail I sent directly to Bram -- in hindsight, I realized that I should probably have posted this to the mailing list
    Message 1 of 2 , Dec 3, 2003
    • 0 Attachment
      (This is a slightly modified version of a mail I sent directly
      to Bram -- in hindsight, I realized that I should probably have
      posted this to the mailing list instead, so here goes.)

      The following has been verified on Vim 6.2.154, running on
      Slackware 9.1 w/Linux 2.4.23, glibc 2.3.2.

      I'm not 100 percent sure that the :append/:insert behavior is
      a bug, but I'll describe it nonetheless: When :append'ing or
      :insert'ing a line in an empty buffer, a blank line is always
      added before (when using :append) or after (when using :insert).
      For example,

      $ vim -u NONE
      :append
      hello world
      .

      results in the following buffer:

      -----BEGIN-----

      hello world
      -----END-----

      Unless an empty buffer is supposed to be equivalent to a buffer
      containing only a \n, this is a bug, right?

      The :change behavior, on the other hand, seems more likely to be a
      bug:

      When either the buffer is empty, or contains only one line, the
      change command always inserts a blank line after the text that was
      supposed to be inserted. E.g.,

      $ cat testfile
      foo
      $ vim -u NONE testfile
      :change
      bar
      .

      Results in the following buffer:

      -----BEGIN-----
      bar

      -----END-----

      I did not expect the blank line after "bar". If two or more lines
      had been present in "testfile", the current line would be replaced
      with "bar" and no blank line would be inserted. Bug?

      --
      Haakon
    • Haakon Riiser
      There s definitely something wrong with the :change command. Again, ... hello world . Now it actually looks like the buffer only contains _one_ line, that is:
      Message 2 of 2 , Dec 4, 2003
      • 0 Attachment
        There's definitely something wrong with the :change command. Again,
        here's the example I provided in my first mail:

        > $ cat testfile
        > foo
        > $ vim -u NONE testfile
        > :change
        > bar
        > .
        >
        > Results in the following buffer:
        >
        > -----BEGIN-----
        > bar
        >
        > -----END-----

        After doing the above, continue as follows:

        :2d
        :change
        hello world
        .

        Now it actually looks like the buffer only contains _one_ line,
        that is:

        hello world

        because the line after it contains only '~', and is highlighted
        as NonText. However, there _is_ a blank line there (although
        invisible), because you can move the cursor to the '~' line, and
        when the buffer is saved, Vim reports that the buffer contains
        two lines.

        --
        Haakon
      Your message has been successfully submitted and would be delivered to recipients shortly.