Fix for "ugly border" bug


The bug shown here is actually a
bug in SLang 1.x including the latest version 1.4.4, but not 0.99.38.

I don't have a fix for S-Lang, maybe I'll find it later, but let me tell
you what I have found so far.

The problem is triggered by the subshell code. The command prompt is
loaded and the command line is resized and redrawn in setup_panels().
When the command line is redrawn in update_input(), it's filled with

Somehow at this point S-Lang loses track of the charset it's using. I know
that printing any non-spaces would fix the problem, but the initial
command line is empty, so it's the last this MC outputs via SLang before
going to the event loop.

The subsequent call to SLsmg_draw_box works in the way as if S-Lang
believed that the terminal is already using the alternative charset.

This is a fix for MC. I'm applying it. SLsmg_fill_region is just an
optimization, since I'm writing ifdef anyways.

        * widget.c (update_input) [HAVE_SLANG]: Work around a bug in
        SLang 1.x - set charset to alternative when printing spaces.

For readers of slang-workers babayaga math fu-berlin de:
#define acs()   SLsmg_set_char_set(1)
#define noacs() SLsmg_set_char_set(0)

Pavel Roskin

--- widget.c
+++ widget.c
@@ -840,9 +840,24 @@ update_input (WInput *in, int clear_firs

     attrset (in->color);

+#ifdef HAVE_SLANG
+    /*
+     * acs() and noacs() here are a workaround for what seems to be
+     * a bug in SLang 1.x (up to 1.4.4, but not in 0.99.38). Without
+     * them, the first dialog box to appear may have part of its
+     * frame displayed in ASCII characters instead of line drawing
+     * characters. Subshell support and color terminal are needed for
+     * the bug to show up.
+     */
+    acs ();
+    SLsmg_fill_region (in->widget.y, in->widget.x,
+		       1, in->field_len - has_history, ' ');
+    noacs ();
     widget_move (&in->widget, 0, 0);
     for (i = 0; i < in->field_len - has_history; i++)
 	addch (' ');
     widget_move (&in->widget, 0, 0);

     for (i = 0, j = in->first_shown; i < in->field_len - has_history && in->buffer [j]; i++){

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