nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH] bug #48305: allow any kind of separator in "Go


From: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] bug #48305: allow any kind of separator in "Go To Line"
Date: Sun, 03 Jul 2016 20:12:33 +0200

On Sun, Jul 3, 2016, at 16:58, Rishabh Dave wrote:
> On Sat, Jul 2, 2016 at 8:55 PM, Benno Schulenberg
> <address@hidden> wrote:
> > Also, the parsing routine should skip any leading separators
> > (especially whitespace).  So you first search in the input for
> > the first digit, and then search in the rest for the first
> > occurrence of something that is not a digit nor a plus nor a
> > minus.
> 
> What about alphabets at beginning? Parsing routine is okay with
> whitespace at the beginning but not with non-whitespace characters.

Yes, you're right.

A detail about the patch:

+    /* If we have any character other than '+', '-' or alphabets, it is
+     * comma between line and column number. */

That comment is in the wrong place; it should be before the second
'if'.  And instead of "alphabets" it should say "digits" -- which
will be obvious when you place it right.


But forget all that.  Patch is too complicated.  Let's start over.

You can skip whitespace with:

    while (*str == ' ')
       str++;

Skipping just spaces is enough -- input from the prompt won't
contain tabs.  (Oh, it could, if the user typed M-V <Tab>, but
we're just trying to forgive accidental mistypings, we're not
trying to read hieroplyphs.)  And let's forget about accepting
/any/ character as a separator, let's just take the ones that
are next to the comma key (m and period) and some that are
commonly used as a separator (space, semicolon and slash).
Try using strpbrk() -- see man 3 strpbrk. 

Patch should be very simple.


> > Also, do you ever look at the output of 'git diff"?  Because
> > again you have trailing whitespace in your patch.  If you do
> > use 'git diff' (don't use 'less', it will do that automatically),
> 
> Mostly, yes. I would look specifically for them before attaching the
> patch using nano's alt+p option.

But it should be unnecessary to use Alt+P.  When you look at a
.patch or .diff file with nano, trailing whitespace should be
very visible: green blocks at the ends of lines.


> > what is the output of 'git config color.diff'?  If it's not auto,
> > then set it so with 'git config color.diff auto'.
> 
> It gives no output.

Then run this again:

  git config color.diff auto

and then:

  git config color.diff

What does it say then?

(And of course you run those commands inside your
nano git repo.)

Benno

-- 
http://www.fastmail.com - Accessible with your email software
                          or over the web




reply via email to

[Prev in Thread] Current Thread [Next in Thread]