Some mc patches - 1



I write some patches to mc and I think they will be interesting for somebody.
I use this patches few monthes and I don't see mc without they.


1) this patch allow to mark vertical blocks with ALT+arrows. Sometimes this 
may be useful.

-- 
C U L8er!
Max Schedriviy                  mailto:max tavrida net
diff -Naur mc/gtkedit/edit.c mc-new/gtkedit/edit.c
--- mc/gtkedit/edit.c	Wed Jun 27 16:29:08 2001
+++ mc-new/gtkedit/edit.c	Mon Jul  2 15:15:21 2001
@@ -40,6 +40,7 @@
 #include "mad.h"
 #endif
 
+#include <../src/key.h>	/* for alt_pressed() - mAX */
 #include <../src/dialog.h> /* MSG_ERROR */
 
 #ifdef HAVE_CHARSET
@@ -2194,7 +2195,11 @@
 	edit->force |= REDRAW_PAGE;
 
     if (command / 100 == 6) {	/* a highlight command like shift-arrow */
-	column_highlighting = 0;
+	/* column highlighting if ALT key pressed - mAX */
+	if (!alt_pressed())
+	    column_highlighting = 0;
+	else
+	    column_highlighting = 1;
 	if (!edit->highlight || (edit->mark2 != -1 && edit->mark1 != edit->mark2)) {
 	    edit_mark_cmd (edit, 1);	/* clear */
 	    edit_mark_cmd (edit, 0);	/* marking on */
diff -Naur mc/src/key.c mc-new/src/key.c
--- mc/src/key.c	Wed Jun 27 16:29:14 2001
+++ mc-new/src/key.c	Mon Jul  2 15:44:18 2001
@@ -982,8 +982,16 @@
 {
     if (get_modifier () & CONTROL_PRESSED)
 	return 1;
-    else
-	return 0;
+    return 0;
+}
+
+/* return 1 if ALT key pressed else return 0 - added by mAX */
+int
+alt_pressed ()
+{
+    if ((get_modifier () & ALTL_PRESSED) || (get_modifier () & ALTR_PRESSED))
+	return 1;
+    return 0;
 }
 
 #ifdef HAVE_MAD
diff -Naur mc/src/key.h mc-new/src/key.h
--- mc/src/key.h	Wed Jun  6 01:08:31 2001
+++ mc-new/src/key.h	Mon Jul  2 15:39:44 2001
@@ -8,6 +8,7 @@
 int get_event (Gpm_Event *event, int redo_event, int block);
 int is_idle (void);
 int ctrl_pressed (void);
+int alt_pressed (void);	/* added by mAX */
 
 #ifndef PORT_HAS_GETCH
 int mi_getch (void);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]