Command line on top of the screen? [PATCH]
Cristian Rigamonti
cri at linux.it
Mon Oct 9 21:44:28 UTC 2006
On Mon, Oct 02, 2006 at 09:50:35PM +0200, Cristian Rigamonti wrote:
>
> I tried messing around with it, but unfortunately with no results (I'm
> definitely not a C programmer).
...
Ok, after a little more trial and error, I came up with the enclosed patch
(against the current CVS), which allows the user to have the command prompt on
the second line of the screen, rather than at the bottom.
To try it out, just check the new "Command prompt on top" option in the
"Options->Layout" dialog box.
It seems to work fine on my i386 Debian GNU/Linux unstable system, except for
the following bugs:
- The "Options->Layout" dialog box features the new option "command prompt on
top", but now it lacks the "menuBar visible" option. If you take a look at the
patch, I've just added the new option and I guess that some other changes are
needed in layout.c (and perhaps in other files), but I have no idea how to
proceed (also I couldn't get how the ordering of options is managed).
I really hope that someone can help me fixing this bug, even if you don't
accept the patch.
- The keybar line only appears after pressing tab (well, I can live with that)
Of course I may have introduced some other bugs, since I don't know the mc
source code very much (nor C :-), so any help is very welcome!
Cri
--
GPG/PGP Key-Id 0x943A5F0E - http://www.linux.it/~cri/cri.asc
Free software, free society - http://www.fsfeurope.org
-------------- next part --------------
Index: layout.c
===================================================================
RCS file: /cvsroot/mc/mc/src/layout.c,v
retrieving revision 1.96
diff -u -r1.96 layout.c
--- layout.c 25 Sep 2006 08:34:48 -0000 1.96
+++ layout.c 9 Oct 2006 21:42:41 -0000
@@ -87,6 +87,9 @@
/* Set if the command prompt is to be displayed */
int command_prompt = 1;
+/* Set if the command line appears on top of the screen */
+int command_ontop = 0;
+
/* Set if the nice and useful keybar is visible */
int keybar_visible = 1;
@@ -122,6 +125,7 @@
static int _menubar_visible;
static int _output_lines;
static int _command_prompt;
+static int _command_ontop;
static int _keybar_visible;
static int _message_visible;
static int _xterm_title;
@@ -159,6 +163,7 @@
{ N_("h&Intbar visible"), &message_visible, 0 },
{ N_("&Keybar visible"), &keybar_visible, 0 },
{ N_("command &Prompt"), &command_prompt, 0 },
+ { N_("command prompt on &Top"), &command_ontop, 0 },
{ N_("show &Mini status"), &show_mini_info, 0 },
{ N_("menu&Bar visible"), &menubar_visible, 0 },
{ N_("&Equal split"), &equal_split, 0 },
@@ -466,6 +471,7 @@
_equal_split = equal_split;
_menubar_visible = menubar_visible;
_command_prompt = command_prompt;
+ _command_ontop = command_ontop;
_keybar_visible = keybar_visible;
_message_visible = message_visible;
_xterm_title = xterm_title;
@@ -645,6 +651,7 @@
{
int start_y;
int promptl; /* the prompt len */
+ int command_y; /* y position of the command line */
if (console_flag) {
int minimum;
@@ -664,7 +671,7 @@
message_visible;
}
check_split ();
- start_y = menubar_visible;
+ start_y = menubar_visible + command_ontop * command_prompt;
/* The column computing is defered until panel_do_cols */
if (horizontal_split) {
@@ -688,13 +695,23 @@
widget_set_size (&the_menubar->widget, 0, 0, 1, COLS);
+ /*
+ * If the command prompt line is on top of the screen, we have to
+ * re-define its y position
+ */
+ if (command_ontop) {
+ command_y = menubar_visible;
+ } else {
+ command_y = LINES - 1 - keybar_visible;
+ }
+
if (command_prompt) {
- widget_set_size (&cmdline->widget, LINES - 1 - keybar_visible,
+ widget_set_size (&cmdline->widget, command_y,
promptl, 1,
COLS - promptl - (keybar_visible ? 0 : 1));
winput_set_origin (cmdline, promptl,
COLS - promptl - (keybar_visible ? 0 : 1));
- widget_set_size (&the_prompt->widget, LINES - 1 - keybar_visible,
+ widget_set_size (&the_prompt->widget, command_y,
0, 1, promptl);
} else {
widget_set_size (&cmdline->widget, 0, 0, 0, 0);
Index: layout.h
===================================================================
RCS file: /cvsroot/mc/mc/src/layout.h,v
retrieving revision 1.10
diff -u -r1.10 layout.h
--- layout.h 3 Dec 2004 19:17:47 -0000 1.10
+++ layout.h 9 Oct 2006 21:42:41 -0000
@@ -35,6 +35,7 @@
extern int first_panel_size;
extern int output_lines;
extern int command_prompt;
+extern int command_ontop;
extern int keybar_visible;
extern int output_start_y;
extern int message_visible;
Index: setup.c
===================================================================
RCS file: /cvsroot/mc/mc/src/setup.c,v
retrieving revision 1.92
diff -u -r1.92 setup.c
--- setup.c 23 Feb 2006 15:32:18 -0000 1.92
+++ setup.c 9 Oct 2006 21:42:44 -0000
@@ -130,6 +130,7 @@
{ "xterm_title", &xterm_title },
{ "output_lines", &output_lines },
{ "command_prompt", &command_prompt },
+ { "command_ontop", &command_ontop },
{ "menubar_visible", &menubar_visible },
{ "show_mini_info", &show_mini_info },
{ "permission_mode", &permission_mode },
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.midnight-commander.org/pipermail/mc/attachments/20061009/f234ce08/attachment.asc>
More information about the mc
mailing list