Re: Patch for switching to subshel in editor and viewer



On Mon, Aug 06, 2001 at 04:03:57AM -0400, Pavel Roskin wrote:
> Hi, Walery!
> 
> > Here is the patch which allows to switch to subshell
> > from internal viewer (Ctrl-O) and from internal editor
> > (Ctrl-Shift-O, because Ctrl-O is already taken by another function).
> >
> > view.c.diff		- viewer stuff.
> 
> What's wrong with `!'?  Why don't you reuse this code?

Ok, now Ctrl-O and '!' reuse the same core.

> > edit_key_translator.c	- edutor stuff
> 
> What's wrong with `F11 s'?  Is it really so important to access the same
> shell used by MC as subshell?

Yes, it may be important.
For instance if you want to see output of the previous command
of if you continue to do the same task in the subshell.

> And why Ctrl-Shift-O?  This won't work on remote terminals at all.  Maybe
> it's better to redefine "Open" to another key in the editor?  Can you
> check what is the "traditional" key to open a new file?  GNOME uses F3,
> but how about Far.

Fixed. "Open file" is rebinded to F18
(anyway IMHO this is not used very often).
Now Ctrl-O is also used here for invoking subshell.

> > I hope this patch will be included into CVS.
> 
> May be for the viewer.  Creating another dependency on the get_modifier()
> is not nice - it doesn't work on all systems.

Well, all problems are fixed.
Now we have the same keys in all modes of operation.
Also we invoke the same subshell.
Also this will work in the remote terminals.
I see no obstacles for including this into CVS.

The new patch is attached.


Regards, Walery
--- edit_key_translator.c.orig	Mon Aug  6 00:00:40 2001
+++ edit_key_translator.c	Mon Aug  6 14:16:17 2001
@@ -47,7 +47,7 @@
      KEY_PPAGE, CK_Page_Up, KEY_NPAGE, CK_Page_Down, KEY_LEFT, CK_Left,
      KEY_RIGHT, CK_Right, KEY_UP, CK_Up, KEY_DOWN, CK_Down, ALT ('\t'), CK_Return, ALT ('\n'), CK_Return,
      KEY_HOME, CK_Home, KEY_END, CK_End, '\t', CK_Tab, XCTRL ('u'), CK_Undo, KEY_IC, CK_Toggle_Insert,
-     XCTRL ('o'), CK_Load, KEY_F (3), CK_Mark, KEY_F (13), CK_Column_Mark, KEY_F (5), CK_Copy,
+     KEY_F (18), CK_Load, KEY_F (3), CK_Mark, KEY_F (13), CK_Column_Mark, KEY_F (5), CK_Copy,
      KEY_F (6), CK_Move, KEY_F (8), CK_Remove, KEY_F (12), CK_Save_As,
      KEY_F (2), CK_Save, XCTRL ('n'), CK_New,
      XCTRL ('l'), CK_Refresh, ESC_CHAR, CK_Exit, KEY_F (10), CK_Exit,
@@ -70,7 +70,7 @@
      KEY_PPAGE, CK_Page_Up, KEY_NPAGE, CK_Page_Down, KEY_LEFT, CK_Left,
      KEY_RIGHT, CK_Right, KEY_UP, CK_Up, KEY_DOWN, CK_Down, ALT ('\t'), CK_Return, ALT ('\n'), CK_Return,
      KEY_HOME, CK_Home, KEY_END, CK_End, '\t', CK_Tab, XCTRL ('u'), CK_Undo, KEY_IC, CK_Toggle_Insert,
-     XCTRL ('o'), CK_Load, KEY_F (3), CK_Mark, KEY_F (13), CK_Column_Mark, KEY_F (5), CK_Copy,
+     KEY_F (18), CK_Load, KEY_F (3), CK_Mark, KEY_F (13), CK_Column_Mark, KEY_F (5), CK_Copy,
      KEY_F (6), CK_Move, KEY_F (8), CK_Remove, KEY_F (12), CK_Save_As,
      KEY_F (2), CK_Save, ALT ('p'), CK_Paragraph_Format,
 
@@ -107,7 +107,7 @@
      0, 0};
 
     static long const key_pad_map[10] =
-    {XCTRL ('o'), KEY_END, KEY_DOWN, KEY_NPAGE, KEY_LEFT,
+    {KEY_F (18), KEY_END, KEY_DOWN, KEY_NPAGE, KEY_LEFT,
      KEY_DOWN, KEY_RIGHT, KEY_HOME, KEY_UP, KEY_PPAGE};
 
 
@@ -149,6 +149,17 @@
 #ifdef HAVE_CHARSET
     if (x_key == XCTRL('t')) {
 	do_select_codepage();
+
+	edit->force = REDRAW_COMPLETELY;
+	command = CK_Refresh;
+	goto fin;
+    }
+#endif
+
+#if !HAVE_X && HAVE_SUBSHELL_SUPPORT
+    if (x_key == XCTRL('o')) {
+	/* Show subshell */
+	view_other_cmd();
 
 	edit->force = REDRAW_COMPLETELY;
 	command = CK_Refresh;
2421a2422,2424
> .B C-o
> Temporarly switch to subshell.
> .PP
2493a2497,2500
> .PP
> You can use
> .B Ctrl-O
> to temporarly switch to subshell.
--- view.orig.c	Mon Aug  6 12:11:00 2001
+++ view.c	Mon Aug  6 14:00:26 2001
@@ -2282,6 +2282,7 @@
         view_move_forward (view, vheight - 1);
         return 1;
 
+    case XCTRL('o'):
     case '!':
 	exec_shell ();
 	return 1;


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