mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 17:06:59 +08:00
parent
3e35e6e488
commit
0a929f7a0b
|
@ -1415,10 +1415,13 @@ static void validate_new_termsize(struct winsize *new_termsize) {
|
|||
/// Export the new terminal size as env vars and to the kernel if possible.
|
||||
static void export_new_termsize(struct winsize *new_termsize) {
|
||||
wchar_t buf[64];
|
||||
env_var_t cols = env_get_string(L"COLUMNS", ENV_EXPORT);
|
||||
swprintf(buf, 64, L"%d", (int)new_termsize->ws_col);
|
||||
env_set(L"COLUMNS", buf, ENV_EXPORT | ENV_GLOBAL);
|
||||
env_set(L"COLUMNS", buf, ENV_GLOBAL | (cols.missing_or_empty() ? 0 : ENV_EXPORT));
|
||||
|
||||
env_var_t lines = env_get_string(L"LINES", ENV_EXPORT);
|
||||
swprintf(buf, 64, L"%d", (int)new_termsize->ws_row);
|
||||
env_set(L"LINES", buf, ENV_EXPORT | ENV_GLOBAL);
|
||||
env_set(L"LINES", buf, ENV_GLOBAL | (lines.missing_or_empty() ? 0 : ENV_EXPORT));
|
||||
|
||||
#ifdef HAVE_WINSIZE
|
||||
ioctl(STDOUT_FILENO, TIOCSWINSZ, new_termsize);
|
||||
|
|
|
@ -474,9 +474,10 @@ static void setup_path() {
|
|||
/// adjusted.
|
||||
static void env_set_termsize() {
|
||||
env_var_t cols = env_get_string(L"COLUMNS");
|
||||
if (cols.missing_or_empty()) env_set(L"COLUMNS", DFLT_TERM_COL_STR, ENV_EXPORT | ENV_GLOBAL);
|
||||
if (cols.missing_or_empty()) env_set(L"COLUMNS", DFLT_TERM_COL_STR, ENV_GLOBAL);
|
||||
|
||||
env_var_t rows = env_get_string(L"LINES");
|
||||
if (rows.missing_or_empty()) env_set(L"LINES", DFLT_TERM_ROW_STR, ENV_EXPORT | ENV_GLOBAL);
|
||||
if (rows.missing_or_empty()) env_set(L"LINES", DFLT_TERM_ROW_STR, ENV_GLOBAL);
|
||||
}
|
||||
|
||||
bool env_set_pwd() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user