[PATCH] panelize indicator



Hello.

This patch adds an indication of the "panelized" mode to the title
of the panel. Currently there exists no indication when the panel
is in the panelized mode, which is very confusing.

The patch also fixes a buffer overflow on screens with more than
200 columns, which is not impossible with high resolutions and/or
small fonts.

The only modified file is screen.c.

Regards.

-- 
Tomas Styblo <tripie cpan org>
PGP: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC97EA4B6
diff -purN mc-4.6.0-pre1/src/screen.c mc-4.6.0-pre1.new/src/screen.c
--- mc-4.6.0-pre1/src/screen.c	Mon Aug 19 00:07:09 2002
+++ mc-4.6.0-pre1.new/src/screen.c	Sun Dec 22 00:15:51 2002
@@ -705,7 +705,11 @@ mini_info_separator (WPanel *panel)
 static void
 show_dir (WPanel *panel)
 {
-    char tmp [200];
+    char tmp[4096]; /* this buffer must not be smaller 
+		       than number of screen columns */
+    char title_panelized[20];
+        
+    strcpy(title_panelized, _(" (panelized)"));
 
     set_colors (panel);
     draw_double_box (panel->widget.parent,
@@ -736,7 +740,11 @@ show_dir (WPanel *panel)
 
     widget_move (&panel->widget, 0, 3);
 
-    trim (strip_home_and_password (panel->cwd), tmp, panel->widget.cols-7);
+    trim (strip_home_and_password (panel->cwd), tmp, (panel->widget.cols-7) -
+	    (panel->is_panelized ? strlen(title_panelized) : 0));
+    if (panel->is_panelized) {
+	strcat(tmp, title_panelized);	/* safe */
+    }
     addstr (tmp);
     widget_move (&panel->widget, 0, 1);
     addstr ("<");


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