163 lines
5.8 KiB
Diff
163 lines
5.8 KiB
Diff
2005-05-09 12:27:44 Manfred Hollstein <mh@novell.com>
|
|
|
|
* globals.h (WrapColumn): Add new global variable.
|
|
* init.h (MuttVars): Likewise.
|
|
* init.c (mutt_init): Add warning message about deprecation of
|
|
wrapmargin variable in favour of new wrapcolumn. Map uses of
|
|
wrapmargin onto corresponding settings for wrapcolumn.
|
|
* handler.c (text_enriched_handler): Initialize .WrapMargin field
|
|
under consideration of the new variable WrapColumn.
|
|
(text_plain_flowed_handler): Likewise for flowed_max.
|
|
* pager.c (format_line): Likewise for wrap_cols.
|
|
* Muttrc, doc/manual.sgml: Add documentation for new variable.
|
|
* doc/manual*.html, doc/manual.txt, doc/muttrc.man: Regenerate.
|
|
|
|
--- mutt-1.5.11/Muttrc
|
|
+++ mutt-1.5.11/Muttrc 2006-06-28 19:52:05.000000000 +0200
|
|
@@ -4103,6 +4103,21 @@ set tilde=yes
|
|
# unset, searches will not wrap.
|
|
#
|
|
#
|
|
+# set wrapcolumn=0
|
|
+#
|
|
+# Name: wrapcolumn
|
|
+# Type: number
|
|
+# Default: 0
|
|
+#
|
|
+#
|
|
+# Controls at which column mutt's pager does smart wrapping. If
|
|
+# set to 0, no smart wrapping is done. If set to a negative value,
|
|
+# mutt's pager wraps at screen width - absolute value (wrapcolumn);
|
|
+# if set to a positive value, it'll wrap at that column. If the
|
|
+# absolute value of wrapcolumn is larger than what the current
|
|
+# display can handle, this value is ignored.
|
|
+#
|
|
+#
|
|
# set wrapmargin=0
|
|
#
|
|
# Name: wrapmargin
|
|
@@ -4112,6 +4127,8 @@ set tilde=yes
|
|
#
|
|
# Controls the size of the margin remaining at the right side of
|
|
# the terminal when mutt's pager does smart wrapping.
|
|
+#
|
|
+# Note, this variable will be replaced by wrapcolumn in future releases.
|
|
#
|
|
#
|
|
# set write_inc=10
|
|
--- mutt-1.5.11/globals.h
|
|
+++ mutt-1.5.11/globals.h 2006-06-28 19:52:05.000000000 +0200
|
|
@@ -177,6 +177,7 @@ WHERE short ReadInc;
|
|
WHERE short SendmailWait;
|
|
WHERE short SleepTime INITVAL (1);
|
|
WHERE short Timeout;
|
|
+WHERE short WrapColumn;
|
|
WHERE short WrapMargin;
|
|
WHERE short WriteInc;
|
|
|
|
--- mutt-1.5.11/handler.c
|
|
+++ mutt-1.5.11/handler.c 2006-06-28 19:52:05.000000000 +0200
|
|
@@ -780,7 +780,12 @@ int text_enriched_handler (BODY *a, STAT
|
|
|
|
memset (&stte, 0, sizeof (stte));
|
|
stte.s = s;
|
|
- stte.WrapMargin = ((s->flags & M_DISPLAY) ? (COLS-4) : ((COLS-4)<72)?(COLS-4):72);
|
|
+ if (WrapColumn > 0)
|
|
+ stte.WrapMargin = ((s->flags & M_DISPLAY) ? (MIN (COLS-4, WrapColumn)) : ((MIN (COLS-4, WrapColumn))<72)?(MIN (COLS-4, WrapColumn)):72);
|
|
+ else if (WrapColumn < 0)
|
|
+ stte.WrapMargin = ((s->flags & M_DISPLAY) ? (COLS-WrapColumn) : ((COLS-WrapColumn)<72)?(COLS-WrapColumn):72);
|
|
+ if (WrapColumn == 0 || stte.WrapMargin < 0)
|
|
+ stte.WrapMargin = ((s->flags & M_DISPLAY) ? (COLS-4) : ((COLS-4)<72)?(COLS-4):72);
|
|
stte.line_max = stte.WrapMargin * 4;
|
|
stte.line = (char *) safe_calloc (1, stte.line_max + 1);
|
|
stte.param = (char *) safe_calloc (1, STRING);
|
|
@@ -996,8 +1001,15 @@ static int text_plain_flowed_handler (BO
|
|
|
|
if ((flowed_max = FLOWED_MAX) > COLS - 3)
|
|
flowed_max = COLS - 3;
|
|
- if (flowed_max > COLS - WrapMargin)
|
|
- flowed_max = COLS - WrapMargin;
|
|
+ if (WrapColumn > 0)
|
|
+ {
|
|
+ if (flowed_max > WrapColumn)
|
|
+ flowed_max = WrapColumn;
|
|
+ }
|
|
+ else if (WrapColumn < 0)
|
|
+ {
|
|
+ flowed_max = COLS + WrapColumn;
|
|
+ }
|
|
if (flowed_max <= 0)
|
|
flowed_max = COLS;
|
|
|
|
--- mutt-1.5.11/init.c
|
|
+++ mutt-1.5.11/init.c 2006-06-28 19:52:05.000000000 +0200
|
|
@@ -2476,6 +2476,25 @@ void mutt_init (int skip_sys_rc, LIST *c
|
|
exit (1);
|
|
}
|
|
|
|
+ if (WrapMargin != 0)
|
|
+ {
|
|
+ fputs ("wrapmargin: Usage of this variable is deprecated. It will be replaced by\n", stderr);
|
|
+ fputs (" ``wrapcolumn'' in future releases. Please read the documentation and change\n", stderr);
|
|
+ fputs (" your muttrc files accordingly.\n", stderr);
|
|
+ if (WrapColumn != 0)
|
|
+ {
|
|
+ fputs (" You defined both ``wrapmargin'' and ``wrapcolumn'' in your muttrc files.\n", stderr);
|
|
+ fputs (" The setting of ``wrapmargin'' will be ignored.\n", stderr);
|
|
+ }
|
|
+ need_pause = 1;
|
|
+
|
|
+ if (WrapColumn == 0) /* Map wrapmargin's settings onto wrapcolumn. */
|
|
+ WrapColumn = -WrapMargin;
|
|
+ /* Ignore any wrap-points outside of the display's width. */
|
|
+ if (WrapColumn > COLS || -WrapColumn > COLS)
|
|
+ WrapColumn = 0;
|
|
+ }
|
|
+
|
|
if (mutt_execute_commands (commands) != 0)
|
|
need_pause = 1;
|
|
|
|
--- mutt-1.5.11/init.h
|
|
+++ mutt-1.5.11/init.h 2006-06-28 19:52:05.000000000 +0200
|
|
@@ -2876,11 +2876,23 @@ struct option_t MuttVars[] = {
|
|
** When set, searches will wrap around the first (or last) message. When
|
|
** unset, searches will not wrap.
|
|
*/
|
|
+ { "wrapcolumn", DT_NUM, R_PAGER, UL &WrapColumn, 0 },
|
|
+ /*
|
|
+ ** .pp
|
|
+ ** Controls at which column mutt's pager does smart wrapping. If
|
|
+ ** set to 0, no smart wrapping is done. If set to a negative value,
|
|
+ ** mutt's pager wraps at screen width - absolute value (wrapcolumn);
|
|
+ ** if set to a positive value, it'll wrap at that column. If the
|
|
+ ** absolute value of wrapcolumn is larger than what the current
|
|
+ ** display can handle, this value is ignored.
|
|
+ */
|
|
{ "wrapmargin", DT_NUM, R_PAGER, UL &WrapMargin, 0 },
|
|
/*
|
|
** .pp
|
|
** Controls the size of the margin remaining at the right side of
|
|
** the terminal when mutt's pager does smart wrapping.
|
|
+ ** .pp
|
|
+ ** Note, wrapmargin will be replaced by wrapcolumn in future releases.
|
|
*/
|
|
{ "write_inc", DT_NUM, R_NONE, UL &WriteInc, 10 },
|
|
/*
|
|
--- mutt-1.5.11/pager.c
|
|
+++ mutt-1.5.11/pager.c 2006-06-28 19:52:05.000000000 +0200
|
|
@@ -1065,8 +1065,12 @@ static int format_line (struct line_t **
|
|
int ch, vch, k, last_special = -1, special = 0, t;
|
|
wchar_t wc;
|
|
mbstate_t mbstate;
|
|
-
|
|
- int wrap_cols = COLS - WrapMargin;
|
|
+ int wrap_cols;
|
|
+
|
|
+ if (WrapColumn <= 0)
|
|
+ wrap_cols = COLS + WrapColumn;
|
|
+ else if (WrapColumn > 0)
|
|
+ wrap_cols = MIN (WrapColumn, COLS);
|
|
|
|
if (wrap_cols <= 0)
|
|
wrap_cols = COLS;
|