Re: reformatting man pages at SIGWINCH

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

 



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


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux