mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibLine: Never assume a 25x80 terminal
Just reuse the lldb hack if the normal stderr ioctl fails for any reason, and read the size directly off /dev/tty.
This commit is contained in:
parent
b05af48d80
commit
1fcef99ff7
Notes:
sideshowbarker
2024-07-17 17:53:07 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/1fcef99ff7 Pull-request: https://github.com/SerenityOS/serenity/pull/12903
@ -218,11 +218,7 @@ void Editor::ensure_free_lines_from_origin(size_t count)
|
||||
void Editor::get_terminal_size()
|
||||
{
|
||||
struct winsize ws;
|
||||
|
||||
if (ioctl(STDERR_FILENO, TIOCGWINSZ, &ws) < 0) {
|
||||
m_num_columns = 80;
|
||||
m_num_lines = 25;
|
||||
} else {
|
||||
ioctl(STDERR_FILENO, TIOCGWINSZ, &ws);
|
||||
if (ws.ws_col == 0 || ws.ws_row == 0) {
|
||||
// LLDB uses ttys which "work" and then gives us a zero sized
|
||||
// terminal which is far from useful
|
||||
@ -233,7 +229,6 @@ void Editor::get_terminal_size()
|
||||
}
|
||||
m_num_columns = ws.ws_col;
|
||||
m_num_lines = ws.ws_row;
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::add_to_history(String const& line)
|
||||
|
Loading…
Reference in New Issue
Block a user