SOLVED (long) Re: colorization difference between 1.4.x and 1.5.x
On 2004-06-04T00:40:34+0200, Alain Bench wrote:
> On Thursday, June 3, 2004 at 1:12:38 PM -0400, Michael W. Oliver wrote:
>
> > On 2004-06-03T10:26:17+0200, Alain Bench wrote:
> > > patch-1.5-me.color_eol.1
> > where I can get it?
>
> On mutt-dev archives id <20021006162429.GB27632@xxxxxxxxxxxxxxxxx>.
> You'll have to reverse it.
Ok, you were right on the money with this tip. At first, I thought that
it wasn't right, but then I looked closer at the patch. I had started
using (and liking) slang support in Mutt, but the patch had no effect
when Mutt was compiled with slang support as follows:
/etc/make.conf (same in /usr/local/etc/pkgtools.conf "MAKE_ARGS")
-----------------------------------------------------------------
WITH_MUTT_LOCALES_FIX=YES
WITH_MUTT_IMAP_HEADER_CACHE=YES
WITH_MUTT_MAILDIR_HEADER_CACHE=YES
WITH_MUTT_SMIME_OUTLOOK_COMPAT=YES
WITH_MUTT_PGP_PATCH=YES
WITH_MUTT_NNTP=YES
WITH_MUTT_EDIT_THREADS=YES
WITH_MUTT_SIGNATURE_MENU=YES
WITH_MUTT_IFDEF_PATCH=YES
WITH_MUTT_SLANG=YES
So, using the above port compilation flags, and with the patch applied,
the colorization still extended to the right edge of the terminal. Gah!
Ok, so I commented out "WITH_MUTT_SLANG=YES" from /etc/make.conf, and
recompiled the port (with the extra patch again), and now the pager
colorization works just like it did in 1.4.x!! Whoo-hoo!
For the record, here is the `ldd` output from what I am using now:
# ldd `which mutt`
/usr/local/bin/mutt:
libncurses.so.5 => /usr/lib/libncurses.so.5 (0x280ef000)
libssl.so.3 => /usr/local/lib/libssl.so.3 (0x28131000)
libcrypto.so.3 => /usr/local/lib/libcrypto.so.3 (0x2815f000)
libintl.so.6 => /usr/local/lib/libintl.so.6 (0x2824c000)
libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x28255000)
libgdbm.so.3 => /usr/local/lib/libgdbm.so.3 (0x28343000)
libc.so.4 => /usr/lib/libc.so.4 (0x28349000)
# pkg_info | grep mutt-devel
mutt-devel-1.5.6_1 The Mongrel of Mail User Agents (part Elm, ...
If you don't mind, I would like to ask two more questions of you. What
are the good and bad points about ncurses vs. slang? Is one better than
the other?
Thanks for your help!
[pasting the patch inline in case someone looks for it one day]
[patch begin]
--- pager.c.orig Thu Jun 3 20:45:08 2004
+++ pager.c Thu Jun 3 20:56:48 2004
@@ -1371,6 +1371,26 @@
if (!(flags & M_SHOW))
return 0;
+ if (flags & M_SHOWCOLOR)
+ {
+ m = ((*lineInfo)[n].continuation) ? ((*lineInfo)[n].syntax)[0].first : n;
+ if ((*lineInfo)[m].type == MT_COLOR_HEADER)
+ def_color = ((*lineInfo)[m].syntax)[0].color;
+ else
+ def_color = (*lineInfo)[m].type;
+
+ attrset (def_color);
+#ifdef HAVE_BKGDSET
+ bkgdset (def_color | ' ');
+#endif
+ clrtoeol ();
+ SETCOLOR (MT_COLOR_NORMAL);
+ BKGDSET (MT_COLOR_NORMAL);
+
+ }
+ else
+ clrtoeol ();
+
/* display the line */
format_line (lineInfo, n, buf, flags, &a, cnt, &ch, &vch, &col, &special);
@@ -1387,25 +1407,6 @@
if (special || (col != COLS && (flags & (M_SHOWCOLOR | M_SEARCH))))
resolve_color (*lineInfo, n, vch, flags, 0, &a);
- /*
- * Fill the blank space at the end of the line with the prevailing color.
- * ncurses does an implicit clrtoeol() when you do addch('\n') so we have
- * to make sure to reset the color *after* that
- */
- if (flags & M_SHOWCOLOR)
- {
- m = ((*lineInfo)[n].continuation) ? ((*lineInfo)[n].syntax)[0].first : n;
- if ((*lineInfo)[m].type == MT_COLOR_HEADER)
- def_color = ((*lineInfo)[m].syntax)[0].color;
- else
- def_color = ColorDefs[ (*lineInfo)[m].type ];
-
- attrset (def_color);
-#ifdef HAVE_BKGDSET
- bkgdset (def_color | ' ');
-#endif
- }
-
/* ncurses always wraps lines when you get to the right side of the
* screen, but S-Lang seems to only wrap if the next character is *not*
* a newline (grr!).
@@ -1414,17 +1415,6 @@
if (col < COLS)
#endif
addch ('\n');
-
- /*
- * reset the color back to normal. This *must* come after the
- * addch('\n'), otherwise the color for this line will not be
- * filled to the right margin.
- */
- if (flags & M_SHOWCOLOR)
- {
- SETCOLOR(MT_COLOR_NORMAL);
- BKGDSET(MT_COLOR_NORMAL);
- }
/* build a return code */
if (!(flags & M_SHOW))
[patch end]
--
Mike
perl -e 'print unpack("u","88V]N=&%C=\"!I;F9O(&EN(&AE861E<G,*");'