nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] Softwrap navigation overhaul


From: David Ramsey
Subject: Re: [Nano-devel] Softwrap navigation overhaul
Date: Tue, 7 Feb 2017 14:13:05 -0600

On Tue, Feb 7, 2017 at 9:04 AM, Benno Schulenberg
<address@hidden> wrote:
> Ehm...  No.  The user can switch that off himself if he doesn't want
> it. (When the terminal gets too narrow, I've made it so that
> linenumbers get switched off automatically, but that was because
> things would crash when the available space for text became zero.
> Plus: what is the use when all that can be shown is the linenumbers
> and nothing of the text? With constant cursor display, the cursor
> position only overwrites the text for horizontal movements; the user
> can stil see the text if he does a quick <Up><Down>.)

Okay.

> That is still far from straightforward.  I would write the above as:

<snip>

The last line should actually be:

>            current_chunk = (strlenpt((*line)->data) / editwincols);

since you set line to line->prev in the line before that, but done, for
both backwards and forwards iteration.

> Is it possible for the chunk routines to get called with nrows = 0?

It probably shouldn't be.  Removed.

> Testing after applying all 32 patches.  The logic for how to scroll
> when inserting a short/long file doesn't work as expected.  Take
> the attached file, download it.  Then run:
>
>   stty cols 44 && stty rows 24 && src/nano --soft +185 NEWS
>
> Then type ^R toast <Enter>.  The cursor goes to the bottom of the
> screen.  But it has inserted nearly two screenfuls of text, which
> means it should center the cursor line -- whenever more than a
> screenful of text is inserted, it should do this.  I don't know
> where this goes wrong; I'm just testing.  (After an undo, then
> a redo /will/ center the cursor line, as it should.)

Good catch!  read_file() sets focusing to FALSE when inserting less than
a screenful, similarly to do_uncut_text().  It equates lines with rows,
which is incorrect in softwrap mode, but also doesn't account for when
rows are lost due to inserting in the middle of a file.

There's a new patch in the set that should fix this.  It counts rows
along with lines throughout the file.  (Ideally, it would count only
until it reaches editwinrows, but the checks for inserting in the middle
of the file are done after everything else, which would require
revamping read_file() somewhat to fix, and considering the weird stuff
read_file() does to current that makes it impossible to just copy and
adapt the code from do_uncut_text()... it's hairy enough that I'm not
inclined to change more in it than necessary for now.)

Attached version 3c to fix these issues (33 patches now).

Attachment: softwrap-navigation-overhaul-3c.zip
Description: Zip archive


reply via email to

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