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

Re: :set cuc has a side effect of setting the current column

Expand Messages
  • Ben Fritz
    ... No, this is wrong. Try it without the :set cuc and you ll see that the cursor moves back to the end of the word line where it started. With the :set
    Message 1 of 10 , Mar 18, 2013
    • 0 Attachment
      On Monday, March 18, 2013 2:18:57 PM UTC-5, Charles Campbell wrote:
      > Next: $hj moved the cursor to the "." in the second line.
      > Next: set cuc<enter> k
      >
      > This ended up with the cursor on "a". Again, this is what I'd expect --
      > because the cursor got onto the "." via a vertical move, not a "$".
      >

      No, this is wrong. Try it without the ":set cuc" and you'll see that the cursor moves back to the end of the word "line" where it started. With the ":set cuc" the cursor moves to the "a" above the end of the second line. Vim seems to be forgetting where it's desired cursor column is.

      --
      --
      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 vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Christian Brabandt
      Hi Ben! ... That is because certain options reset curwin- w_set_curswant (all options that have the redraw flags P_RSTAT, P_RWIN, P_RBUF, P_RALL, P_RCLR). My
      Message 2 of 10 , Mar 18, 2013
      • 0 Attachment
        Hi Ben!

        On Mo, 18 Mär 2013, Ben Fritz wrote:

        > On Monday, March 18, 2013 2:18:57 PM UTC-5, Charles Campbell wrote:
        > > Next: $hj moved the cursor to the "." in the second line.
        > > Next: set cuc<enter> k
        > >
        > > This ended up with the cursor on "a". Again, this is what I'd expect --
        > > because the cursor got onto the "." via a vertical move, not a "$".
        > >
        >
        > No, this is wrong. Try it without the ":set cuc" and you'll see that the cursor moves back to the end of the word "line" where it started. With the ":set cuc" the cursor moves to the "a" above the end of the second line. Vim seems to be forgetting where it's desired cursor column is.

        That is because certain options reset curwin->w_set_curswant (all
        options that have the redraw flags P_RSTAT, P_RWIN, P_RBUF, P_RALL,
        P_RCLR). My guess is, that this is some vi-compatible thing.

        This also happens for e.g. :set nu

        Mit freundlichen Grüßen
        Christian
        --
        Es ist lange her, daß sich die menschliche Phantasie die Hölle
        ausgemalt hat, aber erst durch ihre jüngst erworbenen Fertigkeiten ist
        sie in die Lage versetzt worden, ihre einstigen Vorstellungen zu
        verwirklichen.
        -- Bertrand A. W. Russell

        --
        --
        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 vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Charles Campbell
        ... However, the OP did say to do the :set cuc , unless that s not what he meant to say. ... norm! $j set cuc norm! k set nocuc norm! $hj set cuc norm !k ...
        Message 3 of 10 , Mar 18, 2013
        • 0 Attachment
          Ben Fritz wrote:
          > On Monday, March 18, 2013 2:18:57 PM UTC-5, Charles Campbell wrote:
          >> Next: $hj moved the cursor to the "." in the second line.
          >> Next: set cuc<enter> k
          >>
          >> This ended up with the cursor on "a". Again, this is what I'd expect --
          >> because the cursor got onto the "." via a vertical move, not a "$".
          >>
          > No, this is wrong. Try it without the ":set cuc" and you'll see that the cursor moves back to the end of the word "line" where it started. With the ":set cuc" the cursor moves to the "a" above the end of the second line. Vim seems to be forgetting where it's desired cursor column is.
          >
          However, the OP did say to do the ":set cuc", unless that's not what he
          meant to say.
          Here's a short command file doing what the OP specified:
          --------cmdfile.vim--------
          norm! $j
          set cuc
          norm! k
          set nocuc
          norm! $hj
          set cuc
          norm !k
          --------------------------------

          vim -u NONE -N textfile -S cmdfile.vim

          yields the cursor ending up on the "a". FWIW, commenting out the "set
          cuc" still ends up with the cursor on the "a" (vim 7.3.861).

          I suspect that what is showing up is the difference between using "$" to
          move to the end of line and simply moving to the end of line with hjkl
          (etc). The cursor moves to the same location, but there's a
          difference. You can see it with (assuming the OP's example file):

          vim -u NONE -N textfile

          ---
          norm! G$k
          ---

          versus

          ---
          norm! G$hlk
          ---

          In the first case, the cursor ends up on the "." at the end-of-line. In
          the second case, the cursor ends up on the "a" in the line above.

          Regards,
          C Campbell


          --
          --
          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 vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Christian Brabandt
          Hi ... (and also in nvi) regards, Christian -- Die Streichung des §218 ist eine Voraussetzung für die Befreiung der Frauen. -- Mitglieder des Frauenbundes
          Message 4 of 10 , Mar 18, 2013
          • 0 Attachment
            Hi

            On Mo, 18 Mär 2013, Christian Brabandt wrote:

            > Hi Ben!
            >
            > On Mo, 18 Mär 2013, Ben Fritz wrote:
            >
            > > On Monday, March 18, 2013 2:18:57 PM UTC-5, Charles Campbell wrote:
            > > > Next: $hj moved the cursor to the "." in the second line.
            > > > Next: set cuc<enter> k
            > > >
            > > > This ended up with the cursor on "a". Again, this is what I'd expect --
            > > > because the cursor got onto the "." via a vertical move, not a "$".
            > > >
            > >
            > > No, this is wrong. Try it without the ":set cuc" and you'll see that the cursor moves back to the end of the word "line" where it started. With the ":set cuc" the cursor moves to the "a" above the end of the second line. Vim seems to be forgetting where it's desired cursor column is.
            >
            > That is because certain options reset curwin->w_set_curswant (all
            > options that have the redraw flags P_RSTAT, P_RWIN, P_RBUF, P_RALL,
            > P_RCLR). My guess is, that this is some vi-compatible thing.
            >
            > This also happens for e.g. :set nu

            (and also in nvi)

            regards,
            Christian
            --
            Die Streichung des §218 ist eine Voraussetzung für die Befreiung
            der Frauen.
            -- Mitglieder des Frauenbundes Westberlin, 6. Juni 1971

            --
            --
            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 vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • OmnipotentEntity
            ... Last line should be norm! k Anyway, testing out with the set cuc and set nocuc specified yields different behavior from with those 3 lines commented out.
            Message 5 of 10 , Mar 18, 2013
            • 0 Attachment
              On Monday, March 18, 2013 3:41:00 PM UTC-5, Charles Campbell wrote:
              > Ben Fritz wrote:
              >
              > > On Monday, March 18, 2013 2:18:57 PM UTC-5, Charles Campbell wrote:
              >
              > >> Next: $hj moved the cursor to the "." in the second line.
              >
              > >> Next: set cuc<enter> k
              >
              > >>
              >
              > >> This ended up with the cursor on "a". Again, this is what I'd expect --
              >
              > >> because the cursor got onto the "." via a vertical move, not a "$".
              >
              > >>
              >
              > > No, this is wrong. Try it without the ":set cuc" and you'll see that the cursor moves back to the end of the word "line" where it started. With the ":set cuc" the cursor moves to the "a" above the end of the second line. Vim seems to be forgetting where it's desired cursor column is.
              >
              > >
              >
              > However, the OP did say to do the ":set cuc", unless that's not what he
              >
              > meant to say.
              >
              > Here's a short command file doing what the OP specified:
              >
              > --------cmdfile.vim--------
              >
              > norm! $j
              >
              > set cuc
              >
              > norm! k
              >
              > set nocuc
              >
              > norm! $hj
              >
              > set cuc
              >
              > norm !k
              >
              > --------------------------------
              >
              >
              >
              > vim -u NONE -N textfile -S cmdfile.vim
              >
              >
              >
              > yields the cursor ending up on the "a". FWIW, commenting out the "set
              >
              > cuc" still ends up with the cursor on the "a" (vim 7.3.861).
              >
              >
              >
              > I suspect that what is showing up is the difference between using "$" to
              >
              > move to the end of line and simply moving to the end of line with hjkl
              >
              > (etc). The cursor moves to the same location, but there's a
              >
              > difference. You can see it with (assuming the OP's example file):
              >
              >
              >
              > vim -u NONE -N textfile
              >
              >
              >
              > ---
              >
              > norm! G$k
              >
              > ---
              >
              >
              >
              > versus
              >
              >
              >
              > ---
              >
              > norm! G$hlk
              >
              > ---
              >
              >
              >
              > In the first case, the cursor ends up on the "." at the end-of-line. In
              >
              > the second case, the cursor ends up on the "a" in the line above.
              >
              >
              >
              > Regards,
              >
              > C Campbell

              Slight typo in your vim command file:

              > --------cmdfile.vim--------
              >
              > norm! $j
              >
              > set cuc
              >
              > norm! k
              >
              > set nocuc
              >
              > norm! $hj
              >
              > set cuc
              >
              > norm !k
              >
              > --------------------------------

              Last line should be norm! k

              Anyway, testing out with the set cuc and set nocuc specified yields different behavior from with those 3 lines commented out. (Aside from the obvious difference in column highlighting.

              This behavior is also reproducible using "set cul", "set nocuc", and "set nocul".

              --
              --
              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 vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • Christian Brabandt
              ... I already wrote, what is causing this. Didn t you get that message? The problem is, that certain options set curwin- w_set_curswant (and this is consistent
              Message 6 of 10 , Mar 19, 2013
              • 0 Attachment
                On Mon, March 18, 2013 23:23, OmnipotentEntity wrote:
                >
                > Anyway, testing out with the set cuc and set nocuc specified yields
                > different behavior from with those 3 lines commented out. (Aside from the
                > obvious difference in column highlighting.
                >
                > This behavior is also reproducible using "set cul", "set nocuc", and "set
                > nocul".

                I already wrote, what is causing this. Didn't you get that message?

                The problem is, that certain options set curwin->w_set_curswant
                (and this is consistent with other vi clones), so I wouldn't call
                this a bug here.


                regards,
                Christian

                --
                --
                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 vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/groups/opt_out.
              Your message has been successfully submitted and would be delivered to recipients shortly.