[Top][All Lists]

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

[Nano-devel] Port of variable-width chunks (version 2)

From: David Ramsey
Subject: [Nano-devel] Port of variable-width chunks (version 2)
Date: Fri, 19 May 2017 01:02:44 -0500

On Tue, May 16, 2017 at 3:57 AM, Benno Schulenberg
<address@hidden> wrote:
> I don't know, as I have avoided looking at this code.  But now that I
> have used 'set atblanks' for a few minutes, I think nano really needs
> to have this feature and that performance issues can be solved later.

Good to know.

> Renaming something shouldn't require any rewriting.  Assuming you
> regularly do a 'git rebase master' of your branch, you could:
> rm 00*
> git format-patch master
> sed -i 's/name/othername/' 00*
> git checkout master
> git checkout -b newone
> git am 00*

Also good to know.

> As in this case there is just one call that uses NULL, I would
> probably have chosen to pass a dummy instead.  It is done elsewhere in
> the code.


> Okay; let the cursor stay always on the row that was clicked on.


> And if I remove that redrawing of ">", I can't see things getting
> mishighlighted.

Okay; it's been removed, and I can't see any problems yet either.

> The non-softwrap routine has a special case for zero-length matches,
> the softwrap routine doesn't.  When trying to replace the regex "^" in
> the new softwrap mode, nothing gets highlighted.


I shuffled and simplified a few other bits in the patchset as well.
do_home(), do_end(), and get_edge_and_target() still have to set
was_column to xplustabs() instead of placewewant, but I've kept the
optimizations in do_home() as best I can, and ported them to do_end()
where applicable.

As for why xplustabs() is needed, get_edge_and_target() needs an actual
column to calculate its leftedge, and the recent fixes keeping the
values of +LINE,COLUMN onscreen mean that it can be simplified
(xplustabs() is usually less time than xplustabs(), and the former can
never be greater than the latter anyway according to utils.c).  As for
do_home() and do_end(), like get_edge_and_target(), they need an actual
column to calculate their leftedges.  Softwrapping lines early mean that
placewewant can be set to a column we want that's past the end of the
line and doesn't actually exist, and if a leftedge is calculated based
on it, nano will end up with the leftedge of the wrong line, and the
cursor will be wrongly placed.  I've come up with two examples where
using placewewant instead of xplustabs() goes wrong (both regarding that
text file I sent you privately, though).

The new version (version 2, synced with git c1b0830) is attached.

Description: Zip archive

reply via email to

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