Patches for editor

Steef Boerrigter sxmboer at sci.kun.nl
Mon Jul 2 16:57:47 UTC 2001


Hi midnight commander people,


Please find a patch against mc-4.5.54 for the editor containing the
missing ALT-B bracket button and some more. Also, I've fixed and beefed
up the status line a bit and fixed the bug that randomly ate the right
bit.

If anyone is seriously interested in a rewritten version of mad.c which
does not crash on other platforms than pc-linux and is also fully
dynamical and faster than the original mad.c, please let me know. Then I
will translate the dutch comments and release it as well.

Can someone tell me what's wrong with the user menu?
Most functions in the distribution version from the menu overwrite the
file being edited instead of pasting the output into
~/.cedit/cooledit.block
which basically destroys the input file.
Is anyone actively working on that functionality?

I previously sent this email to mcbugs at nuclecu.unam.mx which doesn't
seem to work anymore. Miguel thought this might be the correct address.
Could someone please confirm? Who are the (active) maintainers?


Kind regards,

Steef Boerrigter
-- 
------------------------------------------------------------------------
Drs. S.X.M. Boerrigter
RIM Laboratory of Solid State Chemistry, University of Nijmegen
Toernooiveld 1, 6525 ED  Nijmegen, The Netherlands
Telephone: (+31)-(0)24-3652831    Fax:(+31)-(0)24-3653067
email: sxmboer at sci.kun.nl         http://savannah.gnu.org/users/sxmboer
------------------------------------------------------------------------
Quidquid latine dictum sit, altum viditur.
"Unix was not designed to stop people from doing stupid things,
 because that would also stop them from doing clever things." --Doug
Gwyn
Murphy's law: Anyt<Warning: Mail system error: Unexpected End Of File>
-------------- next part --------------
diff -ru mc-4.5.54/edit/edit_key_translator.c mc-4.5.54.new/edit/edit_key_translator.c
--- mc-4.5.54/edit/edit_key_translator.c	Wed Nov  1 07:19:40 2000
+++ mc-4.5.54.new/edit/edit_key_translator.c	Sun Apr 22 03:11:23 2001
@@ -61,7 +61,9 @@
      KEY_F (4), CK_Replace, KEY_F (7), CK_Find, KEY_F (14), CK_Replace_Again,
      XCTRL ('h'), CK_BackSpace, ALT ('l'), CK_Goto, ALT ('L'), CK_Goto, XCTRL ('y'), CK_Delete_Line,
      KEY_F (17), CK_Find_Again, ALT ('p'), CK_Paragraph_Format,
+     ALT ('b'), CK_Match_Bracket,
      0177, CK_BackSpace,
+
      0, 0};
 
     static long const emacs_key_map[] =
@@ -190,6 +192,12 @@
 	case KEY_RIGHT:
 	    command = CK_Word_Right_Highlight;
 	    goto fin;
+	case KEY_UP:
+	    command = CK_Scroll_Up_Highlight;
+	    goto fin;
+	case KEY_DOWN:
+	    command = CK_Scroll_Down_Highlight;
+	    goto fin;
 	}
     }
     if ((x_state & SHIFT_PRESSED) && !(x_state & CONTROL_PRESSED)) {
@@ -295,5 +303,3 @@
 	goto fin;
     }
   fin:
-
-
diff -ru mc-4.5.54/gtkedit/editdraw.c mc-4.5.54.new/gtkedit/editdraw.c
--- mc-4.5.54/gtkedit/editdraw.c	Mon May  8 21:11:34 2000
+++ mc-4.5.54.new/gtkedit/editdraw.c	Fri May  4 04:05:41 2001
@@ -41,8 +41,11 @@
     int i;
 #endif
     char t[160];		/* 160 just to be sure */
-/* The field lengths just prevents the status line from shortening to much */
-sprintf (t,"[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %c %d %xH",
+    unsigned char c;
+/* The field lengths just prevents the status line from shortening too much */
+        c=edit_get_byte (edit, edit->curs1);
+        sprintf (t,"[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)=",
+
 	edit->mark1 != edit->mark2 ? ( column_highlighting ? 'C' : 'B') : '-',
 	edit->modified ? 'M' : '-',
         edit->macro_i < 0 ? '-' : 'R',
@@ -55,19 +58,24 @@
         edit->total_lines + 1,
         
         edit->curs1,
-	edit->last_byte, 
-        
-        edit->curs1 < edit->last_byte ? edit_get_byte (edit, edit->curs1) : '?',
-        edit->curs1 < edit->last_byte ? edit_get_byte (edit, edit->curs1) : -1,
-        edit->curs1 < edit->last_byte ? edit_get_byte (edit, edit->curs1) : -1
+	edit->last_byte
         );
+
+        if  (edit->curs1 == edit->last_byte)
+                sprintf (&(t[strlen(t)]), "EOF");
+        else if (c>31) /* printable ? Does it make sense to print the character
+                          anyway?  the cursor is on it! */
+                sprintf(&(t[strlen(t)]),"%3d=%2xH='%c'", c,c,c);
+        else
+                sprintf(&(t[strlen(t)]), "%3d=%2xH=?", c,c);
+
 #ifdef MIDNIGHT
     sprintf (s, "%.*s", w + 1, t);
     i = strlen (s);
-    s[i] = ' ';
+    s[i] = fill;
     i = w;
     do {
-	if (strchr ("+-*=/:b", s[i]))	/* chop off the last word/number */
+	if (strchr ("=/ ", s[i]))	/* chop off the last word/number */
 	    break;
 	s[i] = fill;
     } while (i--);
@@ -378,7 +386,7 @@
     }
 }
 
-/* b pointer to begining of line */
+/* b pointer to beginning of line */
 static void edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_col)
 {
     static unsigned int line[MAX_LINE_LEN];
@@ -500,7 +508,7 @@
 #endif
 
 
-/* b for pointer to begining of line */
+/* b for pointer to beginning of line */
 static void edit_draw_this_char (WEdit * edit, long curs, long row)
 {
     int b = edit_bol (edit, curs);


More information about the mc-devel mailing list