On Tue, Jul 20, 2010 at 9:36 PM, Rob Landley <[email protected]> wrote:
> On Monday 19 July 2010 22:16:40 Denys Vlasenko wrote:
>> Ah, FEATURE_**VI**_ASK_TERMINAL. I thought you test it with shell...
>
> I tested both, the behavior was the same.  80x25.
>
> (I'm assuming that hitting "enter" a couple times re-detects the shell input
> line size, and I don't have to exit and re-start the shell.)
>
>> FEATURE_VI_ASK_TERMINAL case is similar:
>>
>> # if ENABLE_FEATURE_VI_ASK_TERMINAL
>>         if (!G.get_rowcol_error)
>>                 G.get_rowcol_error =
>> # endif
>>                         get_terminal_width_height(STDIN_FILENO, &columns,
>> &rows);
>>
>> I need to know whether here G.get_rowcol_error gets set to 1,
>> and if not, why... can you take a look?
>
> gre=1
>
> Yet when I resize the window and then try to cursor around in a file that goes
> off the right edge of the screen, it's very unhappy.  (Well, if I make it
> bigger it happily gives me an 80x25 chunk in the upper left corner, and
> scrolls within it, but if I make it smaller it goes all wrappy and strange.)

vi detects window size only when it loads the file (see edit_file() function),
not every second. (It also does it on SIGWINCH, which you'll never get
on serial console).

Aha. I see the bug.

        query_screen_dimensions();
#if ENABLE_FEATURE_VI_ASK_TERMINAL
        if (G.get_rowcol_error /* TODO? && no input on stdin */) {
                uint64_t k;
                write1("\033[999;999H" "\033[6n");
                fflush_all();
                k = read_key(STDIN_FILENO, readbuffer, /*timeout_ms:*/ 100);
                if ((int32_t)k == KEYCODE_CURSOR_POS) {
                        uint32_t rc = (k >> 32);
                        columns = (rc & 0x7fff);
                        rows = ((rc >> 16) & 0x7fff);
                }
                query_screen_dimensions();  <===== WRONG, DELETE THIS
        }
#endif

The idea was to reuse sanitization code in query_screen_dimensions(),
but I overlooked that it will revert to 80x24.

Please try this patch:

http://busybox.net/downloads/fixes-1.17.0/busybox-1.17.0-vi.patch

-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to