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

Re: Showing all registers

Expand Messages
  • Dan Sharp
    It is expected behavior. You can t create a variable name the way you tried in the if check. Looking at ... it looks like the @ , which is expected to be a
    Message 1 of 3 , Oct 1, 2001
    • 0 Attachment
      It is expected behavior. You can't create a variable name the way you tried
      in the if check. Looking at

      :debug call ShowRegisters()

      it looks like the '@', which is expected to be a variable, is expanded to ''
      and concatenated to the "nr2char(start)" string, making one string, of which
      the length is then taken.

      To combine characters to create a variable name, you need to use :execute to
      generate the line you want to execute, such as concatenating strings to form
      variable names. That way, the line that is actually executed will look the
      way you meant.

      Hmm...not a clear description. Sorry. Someone else may be able to explain
      it better.

      Dan Sharp



      >From: yahoogroups@...
      >To: vim@...
      >Subject: Re: Showing all registers
      >Date: Mon, 1 Oct 2001 13:34:36 -0700 (PDT)
      >
      >Yup, right on target.
      >
      >But then is this expected behaviour or a bug? As per the docs:
      >
      >strlen({expr})
      >
      >This should first evaluate {expr}, which, in this case, returns @a and then
      >execute strlen(@a) which returns 0.
      >
      >Why is the "nr2char(start)" being seen as part of the string? The *result*
      >of
      >the entire expression (passed in as a parameter to strlen()) should be
      >treated
      >like a expression. Or something like that.
      >
      >Oh heck, I am now thoroughly confused. :)
      >
      >--- Dan Sharp <dwsharp.at.hotmail.com@...>
      >wrote:
      > > Try changing the 'if' check from
      > >
      > > if strlen(@ . "nr2char(start)")
      > >
      > > to
      > >
      > > execute "let len=strlen(@" . nr2char(start) . ")"
      > > if len
      > >
      > > and see if it works better. I don't think your 'if' check is working
      >the
      > > way you expect. I have a feeling that "nr2char(start)" is being seen as
      > > part of the string and its length makes the check always be true.
      >
      >
      >__________________________________________________
      >Do You Yahoo!?
      >Listen to your Yahoo! Mail messages from any phone.
      >http://phone.yahoo.com


      _________________________________________________________________
      Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
    Your message has been successfully submitted and would be delivered to recipients shortly.