#1076944 w3m: with -dump and large -cols, w3m inserts line breaks at column 1024 or before

Package:
w3m
Source:
w3m
Description:
WWW browsable pager with excellent tables/frames support
Submitter:
Vincent Lefevre
Date:
2024-07-24 15:39:04 UTC
Severity:
normal
#1076944#5
Date:
2024-07-24 12:47:43 UTC
From:
To:
With -dump and large -cols, w3m inserts line breaks to make lines
no longer than 1024 characters.

Testcase:

$ { echo "<html>" ; seq 2000 ; } > a.html
$ w3m -dump -cols 999999 a.html

w3m inserts a line break after 283, 539, 795, 1040, 1244, 1448, 1652
and 1856 instead of outputting a single line.

#1076944#10
Date:
2024-07-24 15:32:11 UTC
From:
To:
-cols. fm.h defines MAXIMUM_COLS as 1024 and when parsing the command
line parameters the argument to -cols is checked against this limit - if
the argument is greater then MAXIMUM_COLS that will be used instead.

I appended a patch to drop that feature.

Thanks for your report!

From: Rene Kita <mail@rkta.de>
Date: Wed Jul 24 17:15:06 CEST 2024
Subject: Drop upper limit on COLS
Patch: patches/Drop-upper-limit-on-COLS.patch

The parameter -cols has an undocumented arbitrary limit of 1024. If a
number greater than that is passed as an argument the value will be set
to 1024 instead.

I don't see a reason for this behavior. Drop that limit and let the user
decide.

This fixes Debian BTS #1076944 and GH issue #286.
---
 fm.h   |    1 -
 main.c |    3 ---
 2 files changed, 4 deletions(-)
--- a/fm.h
+++ b/fm.h
@@ -103,7 +103,6 @@ void bzero(void *, int);
 #define LINELEN	256		/* Initial line length */
 #define PAGER_MAX_LINE	10000	/* Maximum line kept as pager */

-#define MAXIMUM_COLS 1024
 #define DEFAULT_COLS 80

 #ifdef USE_IMAGE
--- a/main.c
+++ b/main.c
@@ -692,9 +692,6 @@ main(int argc, char **argv)
 		if (++i >= argc)
 		    usage();
 		COLS = atoi(argv[i]);
-		if (COLS > MAXIMUM_COLS) {
-		    COLS = MAXIMUM_COLS;
-		}
 	    }
 	    else if (!strcmp("-ppc", argv[i])) {
 		double ppc;

#1076944#15
Date:
2024-07-24 15:25:52 UTC
From:
To:
-cols. fm.h defines MAXIMUM_COLS as 1024 and when parsing the command
line parameters the argument to -cols is checked against this limit - if
the argument is greater then MAXIMUM_COLS that will be used instead.

I appended a patch to drop that feature.

Thanks for your report!

From: Rene Kita <mail@rkta.de>
Date: Wed Jul 24 17:15:06 CEST 2024
Subject: Drop upper limit on COLS
Patch: patches/Drop-upper-limit-on-COLS.patch

The parameter -cols has an undocumented arbitrary limit of 1024. If a
number greater than that is passed as an argument the value will be set
to 1024 instead.

I don't see a reason for this behavior. Drop that limit and let the user
decide.

This fixes Debian BTS #1076944 and GH issue #286.
---
 fm.h   |    1 -
 main.c |    3 ---
 2 files changed, 4 deletions(-)
--- a/fm.h
+++ b/fm.h
@@ -103,7 +103,6 @@ void bzero(void *, int);
 #define LINELEN	256		/* Initial line length */
 #define PAGER_MAX_LINE	10000	/* Maximum line kept as pager */

-#define MAXIMUM_COLS 1024
 #define DEFAULT_COLS 80

 #ifdef USE_IMAGE
--- a/main.c
+++ b/main.c
@@ -692,9 +692,6 @@ main(int argc, char **argv)
 		if (++i >= argc)
 		    usage();
 		COLS = atoi(argv[i]);
-		if (COLS > MAXIMUM_COLS) {
-		    COLS = MAXIMUM_COLS;
-		}
 	    }
 	    else if (!strcmp("-ppc", argv[i])) {
 		double ppc;

#1076944#20
Date:
2024-07-24 15:25:52 UTC
From:
To:
-cols. fm.h defines MAXIMUM_COLS as 1024 and when parsing the command
line parameters the argument to -cols is checked against this limit - if
the argument is greater then MAXIMUM_COLS that will be used instead.

I appended a patch to drop that feature.

Thanks for your report!

From: Rene Kita <mail@rkta.de>
Date: Wed Jul 24 17:15:06 CEST 2024
Subject: Drop upper limit on COLS
Patch: patches/Drop-upper-limit-on-COLS.patch

The parameter -cols has an undocumented arbitrary limit of 1024. If a
number greater than that is passed as an argument the value will be set
to 1024 instead.

I don't see a reason for this behavior. Drop that limit and let the user
decide.

This fixes Debian BTS #1076944 and GH issue #286.
---
 fm.h   |    1 -
 main.c |    3 ---
 2 files changed, 4 deletions(-)
--- a/fm.h
+++ b/fm.h
@@ -103,7 +103,6 @@ void bzero(void *, int);
 #define LINELEN	256		/* Initial line length */
 #define PAGER_MAX_LINE	10000	/* Maximum line kept as pager */

-#define MAXIMUM_COLS 1024
 #define DEFAULT_COLS 80

 #ifdef USE_IMAGE
--- a/main.c
+++ b/main.c
@@ -692,9 +692,6 @@ main(int argc, char **argv)
 		if (++i >= argc)
 		    usage();
 		COLS = atoi(argv[i]);
-		if (COLS > MAXIMUM_COLS) {
-		    COLS = MAXIMUM_COLS;
-		}
 	    }
 	    else if (!strcmp("-ppc", argv[i])) {
 		double ppc;