Fix for "Finishedg"


I've just fixed another "prehistoric" bug in MC.  When "Verbose operation"
is off, searching for file without content ends up with "Finishedg"
appearing in the status line.

It turns out that the status label in initialized with the value
"Searching".  The initial width of the label is automatically set to 1
when the widget is initialized in label_new().

Since "verbose" is off, "Searching in ..." messages don't appear, so the
next message is "Finished".

label_set_text() cleans up the maximum of the old and the new text
lengths.  The old value is 1 (which is wrong!), and the new value is the
length of "Finished", which is shorter than "Searching".

The fixed code sets the label width to the length of the initial text or
to 0 if there is no initial text.

--- ChangeLog
+++ ChangeLog
@@ -2,2 +2,5 @@

+	* widget.c (label_new): Set initial width of the widget based on
+	the initial text.
 	* view.c (hex_search): Don't use sscanf() to search for quoted
--- widget.c
+++ widget.c
@@ -631,7 +631,7 @@ label_new (int y, int x, const char *tex
     WLabel *l = g_new (WLabel, 1);

-    init_widget (&l->widget, y, x, 1, 1,
+    init_widget (&l->widget, y, x, 1, text ? strlen (text) : 0,
 		 (callback_fn) label_callback,
 		 (destroy_fn) label_destroy, NULL, tkname);
     l->text = text ? g_strdup (text) : 0;

Pavel Roskin

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