On Mon, Jun 11, 2012 at 10:14 AM, Laurent Bercot
<[email protected]> wrote:
>> Unfortunately, I'm not sure it's simple to do this without
>> curses/terminfo. That is, I'm not sure if the escapes are
>> standardized, and whether there's a danger of them having unwanted
>> effects on terminals that don't support them. Perhaps someone can
>> research this, and if it's a problem, the behavior could be made
>> configurable with a "set" option and off by default..
>
> Except for the basic escape sequences used in the current vi applet
> - and I wouldn't even swear all of them work everywhere - it's flat
> out NOT safe to assume things will work. There's a bazillion of
> different terminals out there, and not all of them behave nicely like
> a Linux console or a xterm. The widely-used rxvt doesn't have an
> alternate terminal and I'm not sure it properly ignores the corresponding
> xterm escapes (rxvt needs its own termcap/terminfo entry, it doesn't
> quite work with the xterm ones).
>
> The point of busybox vi is that it's going to be used on weird stuff
> with minimal terminal support, not on a gnome-terminal or a kterm, and
> I'm already impressed that the existing embedded escape sequences work
> on every terminal I've used it on. Better not push it: this "alternate
> scrolling buffer" is a luxury provided by full-fledged high-quality
> terminal emulators.
I checked what ncurses uses, and it seems that vi can be made to do
the same with these two write1() calls in vi_main():
// "Save cursor, use alternate screen buffer, clear screen"
write1("\033[?1049h");
while (1) {
edit_file(argv[optind]); /* param might be NULL */
if (++optind >= argc)
break;
}
// "Use normal screen buffer, restore cursor"
write1("\033[?1049l");
I think we can risk using it.
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox