nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] Nano with Line Numbering


From: Benno Schulenberg
Subject: Re: [Nano-devel] Nano with Line Numbering
Date: Sun, 18 Sep 2016 20:09:33 +0200

On Sun, Sep 18, 2016, at 12:05, Faissal Bensefia wrote:
> Should all be done, attached.

Your patch submissions are too terse -- they lack an explanation
for the changes that are made.  For example:

-       for (index += COLS; index <= full_length && line < editwinrows - 1; 
index += COLS) {
+       for (index += COLS - margin; index < full_length && line < editwinrows 
- 1; index += COLS - margin) {

In case of /no/ line numbers, margin will be zero, and you will have
effectively changed a "<=" to a "<": you have changed the default
behavior of nano.  Why?  Is there a bug?  Is nano doing it wrong at
the moment?  If so, you must explain how.  If not, then you may not
change anything when margin == 0.

You can see this go wrong when running:
  stty cols 44 && src/nano --ignore --soft --linenum +1 README.GIT
and looking at the tail of line 11.  The "g" is missing after "followin".


    for (n = 0; n < editwinrows && foo; n++) {
        maxrows++;
-       n += strlenpt(foo->data) / COLS;
+       n += (strlenpt(foo->data) + margin) / COLS;
        foo = foo->next;
     }

This is wrong.  This tries to compute how many screen lines a
softwrapped real line takes up.  When there is a margin, the
space for wrapping each line is smaller: COLS - margin.  So the
computattion becomes: n += strlenpt(foo->data)/ (COLS - margin);

I haven't looked further than those two issues.

Upon your next patch submission, please explain the reason
for the changes compared to your previous version.

Benno

-- 
http://www.fastmail.com - Does exactly what it says on the tin




reply via email to

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