Closed totph closed 5 years ago
@totph Would you please try again using term.print(0, 0, "end of main2 ")
? The characters printed by println
will mess up with tuikit.
Even removing both println!()
calls does not seem to fix it, konsole (18.08.3), terminator (1.91), gnome-terminal (3.30.2 using VTE 0.54.3 +GNUTLS) and xterm (334) still reset the cursor 0, 0 after exiting.
Same with urxvt (9.22), where $TERM
is rxvt-unicode
and which reads /usr/share/terminfo/r/rxvt-unicode
instead of xterm-256color
/ /usr/share/terminfo/x/xterm-256color
. In screen (reading /usr/share/terminfo/s/screen
it all works fine.
With the let _ = term.print(0, 0, "end of main2 "); let _ = term.present();
at the end of main2()
:
ABCor i in 1 2 3 4 $TERM; do echo $i; done
>
2
3
4
rxvt-unicode
> tuikit-demo; echo ABC
end of main2 ey to move the text, (q) to quit
The very first "correct" output is also from gnome-terminal, but most instances show the same mistakes.
I could finally reproduce why some terminals are correct after using them for actual work:
> for i in `seq 1000`; do echo $i; done # ensure the terminal has a scrollbar
[...]
997
998
999
1000
> vim # open and close (:wq) vim
> tuikit-demo
end of main2 ey to move the text, (q) to quit
> # everything works as expected
> ~/tuikit-demo
end of main2 ey to move the text, (q) to quit
end of main2, println!()
after tuikit is done
> # even with println!()
vim is version 8.1, and it seems to "fix" all tested terminal emulators when a scollbar is present. But until this combination happens the output is jumbled.
@totph I'd like to define "correct" behavior: All lines drawn by tuikit should be cleared after it exits.
Please try the latest snapshot for this behavior.
[dependencies]
tuikit = { git = "https://github.com/lotabout/tuikit.git" }
Great, thanks! It now works as expected.
Though I could also think of situations where the last buffer state which tuikit showed should remain preserved on the terminal.
If I modify the
Hello World! 你好!今日は。
example by moving tuikit into a function and addingprintf!()
statements[1] most terminals do not position the cursor to print these lines correctly.Expected (after
export PS1='> '
) and input Down/Right/q):In
screen
one line is missing:However in xterm, konsole, terminator and some gnome-terminals I get:
and if I have command output from
for i in 1 2 3 4; do echo $i; done
the result is:The very first "correct" output is also from gnome-terminal, but most instances show the same mistakes.
1: