Hi Yegappan,

On Fri, Jul 19, 2019 at 8:39 AM Yegappan Lakshmanan <[email protected]> wrote:
> On Thu, Jul 18, 2019 at 11:31 PM Christ van Willegen
> <[email protected]> wrote:
> >
> > Hi,
> >
> > Op vr 19 jul. 2019 07:56 schreef Yegappan Lakshmanan 
> > <[email protected]>:
> >>
> >> I have ported the diff sent by Dave Eggum in 2006 to add support
> >> for conditional assignment using ?=.
> >>
> >> The following item in the todo list refers to this:
> >>
> >> Add ":let var ?= value", conditional assignment. Patch by Dave Eggum,
> >> 2006 Dec 11.
> >
> > There are one or two places in the patch that include code or comments that 
> > implements the .= operator.
> >
>
> Which part of the diff are you referring to? All the changes in the diff
> are related to "?=".

I was thrown off by these lines:

-    if (*expr != '=' && !((vim_strchr((char_u *)"+-*/%", *expr) != NULL
+    if (*expr != '=' && !((vim_strchr((char_u *)"+-*/%?", *expr) != NULL
  && expr[1] == '=') || concat))

(That I now see totally misread! I just went "Oooh" when I revisited the patch).

I _thought_ that the original code did not use the '|| concat' in the
second line. I totally missed that there was no + in fron of it, so I
thought it was a change with respect to the original code.

Also, I misread this:

- * must appear after the variable(s).  Use "+", "-" or "." for add, subtract
- * or concatenate.
+ * must appear after the variable(s).  Use "+", "-", "." or "?" for add,
+ * subtract, concatenate or conditionally assign.

Because the "." was originally after the 'or', I didn't see that it
was in the original code as well...

This should teach me to:

- Read the patch carefully
- Re-read the patch carefully
- Think
- Think harder
- Only _then_ complain on the mailing list about wrong code...

Christ van Willegen

-- 
-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CA%2BOt1OxXSN6sjaeX40_AO_v1tW1f%3Da_84%3DZ-mJB59KQmg4cGLQ%40mail.gmail.com.

Raspunde prin e-mail lui