help-texinfo
[Top][All Lists]
Advanced

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

Re: reformatting man pages at SIGWINCH


From: Alejandro Colomar
Subject: Re: reformatting man pages at SIGWINCH
Date: Sat, 8 Apr 2023 00:16:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1

Hi Dirk,

On 4/8/23 00:09, Dirk Gouders wrote:
>> Maybe it could be done with .SH and .SS.  The heuristics to find these
>> are simple.  It wouldn't be very precise, but it could try to find the
>> closest (only upwards) (sub)section heading.  With some luck, .TP would
>> also be helpful.
> 
> Yes, that should give nice results.  But for manual pages like git(1)
> with large areas between those this becomes difficult, again.
> 
> Today, I experimented with one more heuristics, adjusting the current
> position according to the proportional change of avg. line size and also
> change of window dimension (horizontal) but all of those didn't get better
> results than what I currently implemented (stay at the position).
> 
> Out of curiosity, I checked how firefox behaves on horizontal resizes
> and comparing to some of those results, lsp is not the worst on earth ;-)
> 
> If time allows, I want to see if working with Levenshtein distances
> could get exact results.  Perhaps this will turn out to be too expensive
> but maybe the fact that the area to be checked is limited helps...

For something simpler, you could just count words since the start of the
section divided by total words in the section.  That should be fast, and
I expect, also quite precise.  Hyphenating might work against you on
this, but on average it shouldn't move you too much.

Cheers,
Alex

> 
> Regards,
> 
> Dirk

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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