[PATCH] info_show_info(): hline() parameter fix
- From: Pavel Tsekov <ptsekov gmx net>
- To: MC dev <mc-devel gnome org>
- Subject: [PATCH] info_show_info(): hline() parameter fix
- Date: Sat, 9 Jul 2005 21:01:51 +0300
Hello,
I wonder for how much time this has gone unnoticed. Look at this
line of code from info.c, info_show_info() - the function which
fills the info view:
hline (ACS_HLINE|NORMAL_COLOR, info->widget.x-2);
^^^^^^^^^^^^^^^^
The second argument of hline() is supposed to indicate the length of the
line to be drawn. The first argument is supposed to indicate the fill
character of the line to be drawn - in this case this is ACS_HLINE
(horizontal line character).
Now, start MC and switch the right panel panel to Info mode. Do you see a
horizontal line like the one just described somewhere ? Yes ? Ok, now
switch the left panel to Info mode. Do you still see the line ? No ? Well,
this shouldn't be a surprise . In this case the second argument of of
hline() becomes negative i.e. invalid. The same happens for both of the
panels if you have split the screen horizontally.
There is another funny side effect of this bug but I'll leave that for
some other time. For the curious - look closer at hline() in slint.c. What
whould happen if a negative length is passed as the second argument ? ;)
I am attaching a patch.
Changelog:
2005-07-09 Pavel Tsekov <ptsekov gmx net>
* info.c (info_show_info): Properly calculate the length of the
line drawn by hline().
Index: src/info.c
===================================================================
RCS file: /cvsroot/mc/mc/src/info.c,v
retrieving revision 1.39
diff -u -p -r1.39 info.c
--- src/info.c 31 May 2005 09:13:41 -0000 1.39
+++ src/info.c 9 Jul 2005 17:26:04 -0000
@@ -77,7 +77,7 @@ info_show_info (struct WInfo *info)
printw (const_cast(char *, _("Midnight Commander %s")), VERSION);
attrset (NORMAL_COLOR);
widget_move (&info->widget, 2, 1);
- hline (ACS_HLINE|NORMAL_COLOR, info->widget.x-2);
+ hline (ACS_HLINE|NORMAL_COLOR, info->widget.cols-2);
if (get_current_type () != view_listing)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]