Re: [Lynx-dev] Invoking a lynx script

From:

Thomas Dickey

Subject:

Re: [Lynx-dev] Invoking a lynx script

Date:

Mon, 10 Oct 2011 05:41:14 -0400 (EDT)

On Mon, 10 Oct 2011, Bela Lubkin wrote:

Thomas Dickey wrote:
BL>>>> You might use that to advantage, e.g. adding "-width 10000" so that
BL>>>> paragraphs are inserted without line breaks (then vim's :set textwidth=
BL>>>> wrapping will work). Slight bug there: Lynx has a line length limit of
BL>>>> 1014 chars (from testing); paragraphs longer than that will have
BL>>>> arbitrary line breaks inserted.
TD>>> yes - it's a compile-time limit, used in various buffer-sizes as well
TD>>> as a chunk-size in GridText.c's memory-allocation scheme.
BL>> Yes, documented as LINE_MAX in recent man pages. I've never tried
BL>> compiling Lynx with an expanded LINE_MAX: does it work or does it run
BL>> into countervailing assumptions elsewhere in the code? I imagine that
TD> I recall checking in a previous discussion, and found some buffer-sizes
TD> that should be made dependent on that.
Ok, then not for random people to mess with...

;-)

BL>> setting it to a large value like 1M would bloat the Lynx process (but
BL>> nothing like a GUI browser...) and probably slow it down as well...
TD> It probably would be slower, though it might be interesting to massage
TD> the code so that it could use plain malloc/free in GridText.c to see
TD> how much faster the current scheme uses.
I was thinking there were probably things like sprintf() or memcpy()
where libc would end up zeroing or copying the entire trailing buffer
after the interesting part.
TD> For the buffer sizes - there are probably some special cases that would
TD> complicate things.
No doubt.
So for my original purpose (avoiding buffer-size-imposed line wrap in
"-dump" output) it might be better to kludge it. Add a "-dont_wrap"
flag (following the example of "-dont_wrap_pre"). When inserting a
line break due to running out of buffer space, remember the reason;
when actually outputting it, if the reason was "out of space" rather
than "document said so", output the line without a trailing newline.
"-dont_wrap" would also set "-width" to the applicable max (so that the
"out of space, don't newline" path isn't exercised unnecessarily).

hmm - but the dump is working from essentially the same data that would
be displayed - and already subject to line-length. I recall that lynx
uses some special control characters to denote things like bold- and
underline-, as well as something related to wrapping. There may/may
not be enough existing logic to make an option like that relatively
simply to implement.
--
Thomas E. Dickey
http://invisible-island.netftp://invisible-island.net