Package: mc
Version: 2:4.6.2~git20080311-2
Severity: normal
Tags: patch

First reported this bug in launchpad: 
https://bugs.launchpad.net/ubuntu/+source/mc/+bug/243790

When I built and installed mc-4.6.2~git20080311 I found that it lacks the 
feature I love the most: visible tabs and 
whitespace in the editor. I found that the cause is 
debian/patches/utf8/mc-utf8.patch, which pretty much removes the heart 
of the feature (search for visible_tabs and visible_tws handled in case '\t' 
and case ' ' in file mc/edit/editdraw.c).

I have created a patch for this, either place it in debian/patches/utf8 and add 
to the series or merge with mc-utf8.patch.

-- System Information:
Debian Release: lenny/sid
  APT prefers hardy-updates
  APT policy: (500, 'hardy-updates'), (500, 'hardy-security'), (500, 
'hardy-proposed'), (500, 'hardy-backports'), (500, 'hardy')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-19-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mc depends on:
ii  libc6                   2.7-10ubuntu3    GNU C Library: Shared libraries
ii  libglib2.0-0            2.16.3-1ubuntu3  The GLib library of C routines
ii  libgpmg1                1.19.6-25ubuntu1 General Purpose Mouse - shared lib
ii  libslang2               2.1.3-2          The S-Lang programming library - r

mc recommends no packages.

-- no debconf information
--- mc/edit/editdraw.c.orig	2008-06-28 21:54:42.000000000 +0400
+++ mc/edit/editdraw.c	2008-06-28 22:53:40.000000000 +0400
@@ -359,17 +359,63 @@
 		    p->ch = ' ';
 		    p++;
 		    break;
- 		case '\t':
- 		    i = TAB_SIZE - ((int) col % TAB_SIZE);
-		    p->ch = ' ';
-		    c = p->style & ~MOD_CURSOR;
-		    p++;
- 		    col += i;
-		    while (--i) {
-			p->ch = ' '; p->style = c;
+		case '\t':
+		    i = TAB_SIZE - ((int) col % TAB_SIZE);
+		    col += i;
+		    if (use_colors && visible_tabs) {
+			c = (p->style & ~MOD_CURSOR) | MOD_WHITESPACE;
+			if (i > 2) {
+			    p->ch = '<';
+			    p->style |= MOD_WHITESPACE;
+			    p++;
+			    while (--i > 1) {
+				p->ch = '-';
+				p->style = c;
+				p++;
+			    }
+			    p->ch = '>';
+			    p->style = c;
+			    p++;
+			} else if (i > 1) {
+			    p->ch = '<';
+			    p->style |= MOD_WHITESPACE;
+			    p++;
+			    p->ch = '>';
+			    p->style = c;
+			    p++;
+			} else {
+			    p->ch = '>';
+			    p->style |= MOD_WHITESPACE;
+			    p++;
+			}
+		    } else if (use_colors && visible_tws && q >= tws) {
+			p->ch = '.';
+			p->style |= MOD_WHITESPACE;
+			c = p->style & ~MOD_CURSOR;
+			p++;
+			while (--i) {
+			    p->ch = '.';
+			    p->style = c;
+			    p++;
+			}
+		    } else {
+			p->ch = ' ';
+			c = p->style & ~MOD_CURSOR;
 			p++;
+			while (--i) {
+			    p->ch = ' '; p->style = c;
+			    p++;
+			}
+		    }
+		    break;
+		case ' ':
+		    if (use_colors && visible_tws && q >= tws) {
+			p->ch = '.';
+			p->style |= MOD_WHITESPACE;
+			p++;
+			col++;
+			break;
 		    }
- 		    break;
 		    /* fallthrough */
 		default:
 		    c = convert_to_display_c (c);

Reply via email to