From f21b89e428fa6cc339d2081cfe48fb96742c0576 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Wed, 16 Mar 2016 23:50:38 +1100 Subject: [PATCH] Improve /WINDOW DESCRIBE output Instead of showing a meaningless pointer value for Screen:, we show the screen number and ttyname. Also take the CO, LI values from the window's screen. Don't show the Prompt: unless one is set. --- Changelog | 2 ++ source/screen.c | 12 +++++++--- source/window.c | 61 +++++++++++++++++++------------------------------ 3 files changed, 34 insertions(+), 41 deletions(-) diff --git a/Changelog b/Changelog index 5687f22..d82020b 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2.2] +* Improve /WINDOW DESCRIBE output a little. (caf) + * If we can't create a socket for the first address returned by getaddrinfo(), try the other returned addresses. (caf) diff --git a/source/screen.c b/source/screen.c index 1248916..d032b9b 100644 --- a/source/screen.c +++ b/source/screen.c @@ -1531,10 +1531,15 @@ Screen * BX_create_new_screen(void) if (!main_screen) #ifdef GUI gui_screen(new); - + + malloc_strcpy(&new->tty_name, ""); gui_resize(new); #else + { + extern char attach_ttyname[]; main_screen = new; + malloc_strcpy(&new->tty_name, attach_ttyname); + } #endif init_input(); return new; @@ -1733,8 +1738,9 @@ extern Window *BX_create_additional_screen (void) kill(child, SIGKILL); return NULL; } - else - malloc_strcpy(&new->tty_name, buffer); + + chop(buffer, 1); + malloc_strcpy(&new->tty_name, buffer); win = new_window(new); refresh_screen(0, NULL); diff --git a/source/window.c b/source/window.c index 29a9f74..b6f610f 100644 --- a/source/window.c +++ b/source/window.c @@ -697,9 +697,7 @@ void BX_move_window(Window *window, int offset) void BX_resize_window(int how, Window *window, int offset) { Window *other; - int after, - window_size, - other_size; + int window_size, other_size; if (!window) window = current_window; @@ -717,7 +715,6 @@ void BX_resize_window(int how, Window *window, int offset) how = RESIZE_REL; } - after = 1; other = window; do @@ -725,10 +722,7 @@ void BX_resize_window(int how, Window *window, int offset) if (other->next) other = other->next; else - { other = window->screen->window_list; - after = 0; - } if (other == window) { @@ -2981,40 +2975,36 @@ static Window *window_describe (Window *window, char **args, char *usage) else say("Window %u", window->refnum); - say("\tServer: [%d] %s", - window->server, - window->server <= -1 ? - get_server_name(window->server) : ""); - say("\tScreen: %p", window->screen); + say("\tServer: [%d] %s", window->server, get_server_name(window->server)); + if (window->screen) + { + say("\tScreen: [%d] %s", window->screen->screennum, + window->screen->tty_name ? window->screen->tty_name : ""); + say("\tCO, LI are [%d %d]", window->screen->co, window->screen->li); + } + else + say("\tScreen: "); say("\tGeometry Info: [%d %d %d %d %d %d]", window->top, window->bottom, window->held_displayed, window->display_size, window->cursor, window->distance_from_display); -#ifndef GUI - say("\tCO, LI are [%d %d]", current_term->TI_cols, current_term->TI_lines); -#else - say("\tCO, LI are [%d %d]", output_screen->co, output_screen->li); -#endif say("\tCurrent channel: %s", window->current_channel ? window->current_channel : ""); - -if (window->waiting_channel) - say("\tWaiting channel: %s", - window->waiting_channel); - -if (window->bind_channel) - say("\tBound channel: %s", - window->bind_channel); + if (window->waiting_channel) + say("\tWaiting channel: %s", window->waiting_channel); + if (window->bind_channel) + say("\tBound channel: %s", window->bind_channel); say("\tQuery User: %s %s", window->query_nick ? window->query_nick : "", window->query_cmd ? window->query_cmd : empty_string); - say("\tPrompt: %s", - window->prompt ? - window->prompt : ""); + + if (window->prompt) + say("\tPrompt: %s", window->prompt); + say("\tSecond status line is %s", onoff[window->double_status]); say("\tSplit line is %s triple is %s", onoff[window->status_split], onoff[window->status_lines]); say("\tLogging is %s", onoff[window->log]); @@ -3024,16 +3014,11 @@ if (window->bind_channel) else say("\tNo logfile given"); - say("\tNotification is %s", - onoff[window->miscflags & WINDOW_NOTIFY]); - say("\tHold mode is %s", - onoff[window->hold_mode]); - say("\tWindow level is %s", - bits_to_lastlog_level(window->window_level)); - say("\tLastlog level is %s", - bits_to_lastlog_level(window->lastlog_level)); - say("\tNotify level is %s", - bits_to_lastlog_level(window->notify_level)); + say("\tNotification is %s", onoff[window->miscflags & WINDOW_NOTIFY]); + say("\tHold mode is %s", onoff[window->hold_mode]); + say("\tWindow level is %s", bits_to_lastlog_level(window->window_level)); + say("\tLastlog level is %s", bits_to_lastlog_level(window->lastlog_level)); + say("\tNotify level is %s", bits_to_lastlog_level(window->notify_level)); if (window->nicks) {