Page MenuHomeFreeBSD

core.lua: Fix KEYSTR_RESET sequence
AbandonedPublic

Authored by jlduran_gmail.com on Mar 11 2022, 10:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 29 2024, 1:11 PM
Unknown Object (File)
Dec 23 2023, 2:53 AM
Unknown Object (File)
Dec 2 2023, 4:09 PM
Unknown Object (File)
Jun 25 2023, 6:24 PM
Unknown Object (File)
Mar 5 2023, 5:32 PM
Unknown Object (File)
Feb 17 2023, 2:38 AM
Subscribers

Details

Reviewers
kevans
manu
tsoome
Group Reviewers
Contributor Reviews (src)
Summary

Use \027[H\027[J to reset the terminal in Lua (for now), as \027c produces bogus characters and does not clear the terminal.

Test Plan
echo "end" > /boot/lua/local.lua
shutdown -r now
...
Type '?' for a list of commands, 'help' for more detailed help.
OK printc("\027c")
?cOK

Evidently, that is not what we want. As a workaround:

OK printc("\027[H\027[J")

Almost works (does not reset the colors), but is better than what we currently have.

OK boot

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

A lot depends on which terminal emulator you are on.

KEYSTR_RESET is defined to be ESCAPE c in the standards. Most terminal emulators get this right. It also resets attributes and other things that the clear screen sequence that you propose does not.

Given the diversity of terminal emulators in the wild, I'd be quite hesitant to make this change...

In D34532#782394, @imp wrote:

A lot depends on which terminal emulator you are on.

You are right, I should have specified this originally.

Given the diversity of terminal emulators in the wild, I'd be quite hesitant to make this change...

Can we have _both_ clearing methods? I can propose a different revision then.

Thanks!