List Info

Thread: Saving Viewed Source Loses Spaces




Saving Viewed Source Loses Spaces
country flaguser name
United States
2008-02-23 17:06:15
Summary: Saving viewed source loses spaces in the middle of
lines.

Description: When viewing HTML source (), if lines are
wider than the
terminal window and have spaces in the right place, the
spaces are lost
when the source is saved with the print functions.  This is
not losing
extra spaces or the conversion of tabs into spaces, but loss
of the only
space between words, HTML tag attributes, etc.  It happens
when the last
character displayed on a window's line is a space, and the
first character
on the next line of the display (after the plus sign) is not
a space.
For an 80 column window, the problem is seen when the HTML
source has
a space in column 80 and a non-space character in column 81.
 Depending
on where the space is lost, it might just cause spelling
errors in text,
but also will cause HTML errors when a space is lost in the
middle of an
HTML tag.  If the HTML source has tabs, the problem columns
will vary
due to tab expansion.

Environment:  The problem was first seen in Lynx 2.8.7dev.4
installed
on Debian Etch "Linux 2.6.18-4-686" with Debian's
"lynx-cur" package.
The problem was reproduced on 2.8.7dev.8 compiled from
source on Mandrake
9 "Linux 2.4.19-16mdk" with various configuration
options tried, including
enabling and disabling prettysrc.  Also seen on 2.8.7dev.7
previously
compiled from source.  The problem was not seen with
2.8.5rel.1 compiled
from source with the same options used for 2.8.7dev.8.

Recreating: A test page (test2.html) is attached that has
the problem in
various locations.  Hopefully it is self explanatory.  The
best use is to
view the page in lynx, switch to source view, print to a
file, and compare
the saved version with the original.  Best done with
prettysrc disabled.
The problem was also seen when viewing the
"source" of e-mails and plain
text files that have spaces at the window width.

Cause:  It looks like the problem is caused by the new
"TrimmedLength"
subroutine in "GridText.c".  Looking through the
CHANGES file, this was
probably added in 2.8.6dev.9 in response to Debian #204515. 
It doesn't
know if the "trailing blanks" on a displayed line
are part of a continued
HTML source line that are needed when the displayed lines
are joined when
written to a file.

Solution:  My solution was to add a check for source mode
shortly after
the original string length is determined.  If in source
mode, just
return the original length and skip all trim operations.
The added code is:  if (HTisDocumentSource) return result;
Attached is a patch file created using the 2.8.7dev.8 code
and
this command:  LC_ALL=C TZ=UTC0 diff -Naur (Original_dir)
(Patched_dir)

Caveat:  I tested the "Save to a local file",
"Print to the screen", and
"View formatted" Printing Options, but didn't test
"Mail the file" or
"Print out on a printer attached ...".  My change
might break something I
didn't test.  The problem might also show up with things
viewed in normal
(non-source) mode, so the test for HTisDocumentSource
wouldn't fix them,
but I didn't find any.  There also might be a more elegant
solution that
I didn't find.

     Mike Knight, just a user

_______________________________________________
Lynx-dev mailing list
Lynx-devnongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev

  
  
Re: Saving Viewed Source Loses Spaces
country flaguser name
United States
2008-02-23 18:08:32
On Sat, 23 Feb 2008, Mike Knight wrote:

> Solution:  My solution was to add a check for source
mode shortly after
> the original string length is determined.  If in source
mode, just
> return the original length and skip all trim
operations.
> The added code is:  if (HTisDocumentSource) return
result;
> Attached is a patch file created using the 2.8.7dev.8
code and
> this command:  LC_ALL=C TZ=UTC0 diff -Naur
(Original_dir) (Patched_dir)

thanks - I'll try to test it (as you notice, the logic there
is messy 

>
> Caveat:  I tested the "Save to a local file",
"Print to the screen", and
> "View formatted" Printing Options, but didn't
test "Mail the file" or
> "Print out on a printer attached ...".  My
change might break something I
> didn't test.  The problem might also show up with
things viewed in normal
> (non-source) mode, so the test for HTisDocumentSource
wouldn't fix them,
> but I didn't find any.  There also might be a more
elegant solution that
> I didn't find.
>
>     Mike Knight, just a user
>

-- 
Thomas E. Dickey
http://invisible-island.n
et
ftp://invisible-island.net


_______________________________________________
Lynx-dev mailing list
Lynx-devnongnu.org
htt
p://lists.nongnu.org/mailman/listinfo/lynx-dev

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )