mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
dump: Trim spaces only in color mode 0 or -1
The old code failed to write pending spaces before changing the background color. That seems hard to fix without duplicating code, and ELinks pads dumped lines to the requested width in these color modes anyway, so this commit just makes ELinks write all spaces immediately when colors are being used. Try the following command before and after this commit: elinks --no-home --eval "set document.colors.use_document_colors = 2" \ --dump-color-mode 1 --dump test/color.html
This commit is contained in:
parent
9bc79e4ecf
commit
645e9f22fe
@ -42,7 +42,9 @@ DUMP_FUNCTION_SPECIALIZED(struct document *document, struct dump_output *out)
|
||||
#endif /* DUMP_COLOR_MODE_TRUE */
|
||||
|
||||
for (y = 0; y < document->height; y++) {
|
||||
#ifdef DUMP_COLOR_MODE_NONE
|
||||
int white = 0;
|
||||
#endif
|
||||
int x;
|
||||
|
||||
#ifdef DUMP_COLOR_MODE_16
|
||||
@ -127,13 +129,14 @@ DUMP_FUNCTION_SPECIALIZED(struct document *document, struct dump_output *out)
|
||||
&& c >= 176 && c < 224)
|
||||
c = frame_dumb[c - 176];
|
||||
|
||||
if (c == ' '
|
||||
#ifdef DUMP_CHARSET_UTF8
|
||||
|| !isscreensafe_ucs(c)
|
||||
if (!isscreensafe_ucs(c)) c = ' ';
|
||||
#else
|
||||
|| !isscreensafe(c)
|
||||
if (!isscreensafe(c)) c = ' ';
|
||||
#endif
|
||||
) {
|
||||
|
||||
#ifdef DUMP_COLOR_MODE_NONE
|
||||
if (c == ' ') {
|
||||
/* Count spaces. */
|
||||
white++;
|
||||
continue;
|
||||
@ -145,6 +148,7 @@ DUMP_FUNCTION_SPECIALIZED(struct document *document, struct dump_output *out)
|
||||
return -1;
|
||||
white--;
|
||||
}
|
||||
#endif /* DUMP_COLOR_MODE_NONE */
|
||||
|
||||
/* Print normal char. */
|
||||
#ifdef DUMP_CHARSET_UTF8
|
||||
|
Loading…
Reference in New Issue
Block a user