nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] how and when to rewrap the help text


From: Benno Schulenberg
Subject: [Nano-devel] how and when to rewrap the help text
Date: Sun, 11 Dec 2016 19:22:25 +0100

> > The only way I can think of is to calculate how many characters
> > there are between the start of the help text and the start of the
> > current top line shown on the screen (not counting newlines), [...]
> 
> But... this solution isn't considering the case where text won't be
> rewrapped; it *blindly* closes, opens and redisplays the help text and
> recomputes the edittop (and even rewraps the help text) when
> rewrapping won't be needed.

Yes.  Why not?  Handling the resizing of a terminal window is not
nano's core business.  It must be /handled/, but it doesn't have
to be cheap nor optimized.  The only demand I make on it is: that
it occupies as little code as possible.

> And there are 3 such cases:
> 
> 1. window size changes vertically

If you can catch that special case in just two lines of code,
I will let it pass.  (But think of that /later/.  First do the
"blind" case: simply always rewrap.)

> 2. window size changes to become wider than 76 characters

Please stop the 76-business.  There is nothing special about
being wider or narrower than 76 columns.  Run for example:
'LANGUAGE=de src/nano' (without your patch), type ^G and
then ^V until you get to the M-9 and M-0 keys.  Resize the
terminal till the longest line exactly fits on the screen
and notice that the terminal is now 90 characters wide.
Other translations might have even longer lines.  So you
cannot assume anything about not needing to rewrap above
a certain width.

> 3. window size changes horizontally but the change is not enough to
> make the text rewrap.

Pfff...  How would you find out?  Only by doing a rewrapping
run.  You might then as well redisplay the result instead of
laboriously comparing the two files.

> Umm... a slight adjustment (at the version of code before last commit)
> would make the call to total_refresh() redundant; a simple return in
> display_the_help_text() statement would suffice.

If that is so, show me a patch, against the current state.

> However, "roughly staying" must become "staying"; in favour of that.

Good.

Benno

-- 
http://www.fastmail.com - Same, same, but different...




reply via email to

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