diff --git a/CHANGES b/CHANGES index 5e0db208..eb0080ec 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,216 @@ +CHANGES FROM 3.5a TO 3.6 + +* Add seconds options for clock mode (issue 4697). + +* Add a resize callback for menus so that they are correctly moved on resize + (issue 4696). + +* Make -v to source-file pass through to subsequent source-file commands (issue + 4216). + +* If display-popup is used inside a popup, modify that popup (issue 4678). + +* Add selection-mode command to expilcitly set the selection mode in copy mode + (issue 3842). + +* Save and restore images in alternate screen (issue 3732). + +* Ignore Hangul filler character (issue 3998). + +* Improve handling of regional indicators and emoji modifiers (issue 3998). + +* Preserve marked pane with swap-window and move-window (issue 3443). + +* Set and check COLORTERM as a hint for RGB colour. + +* If tmux receives a palette request (OSC 4) in a pane and the palette entry + has not been set, send a request to the most recently used client and + forward any response instead (based on change from Tim Culverhouse, issue + 4665). + +* Add -l flag to command-prompt to disable splitting into multiple prompts + (issue 4483). + +* Don't enter copy mode on mouse wheel in alternate screen (issue 3705). + +* Add commands to centre the cursor in copy mode (issue 4662). + +* Support case insensitive search in modes in the same way as copy mode + (like emacs, so all-lowercase means case insensitive) (issue 4396). + +* Fix the logic of the no-detached case for the detach-on-destroy option (from + Martin Louazel, issue 4649). + +* Add buffer_full format variable (from Mohammad AlSaleh, issue 4630). + +* Introduce a new window option, tiled-layout-max-columns, which configures the + maximum number of columns in the tiled layout. + +* Add support for DECRQSS SP q (report cursor style), DECRQM ?12 (report cursor + blink state) and DECRQM ?2004, ?1004, ?1006 (report mouse state) ( rom + Andrea Alberti, issue 4618). + +* Fix missing argument from OSC 4 reply (issue 4596). + +* Add -k flag to display-popup which allows any key to dismiss the popup once + the command has exited (from Meriel Luna Mittelbach, issue 4612). + +* Add nicer default second and third status lines (from Michael Grant, issue + 4490). + +* Add a pane-border-lines "spaces" value to use spaces for pane borders (issue + 4587). + +* Replace invalid UTF-8 characters with the placeholder instead of ignoring + them (issue 4514). + +* Fix incorrect handling of Korean Hangul Jamo characters (from Roy Jung, issue + 4546). + +* Allow uppercase letters in gray/grey color names (from Pavel Roskin, issue + 4560). + +* Add sorting to W, P, L loop operators (from Michael Grant, issue 4516). + +* Detect support for OSC 52 using the device attributes report (from James + Holderness, issue 4539). + +* Add noattr for styles and use in mode-style to allow whether attributes are + ignored or used to be configured (issue 4498). + +* Add a set-default style attribute which replaces the current default colours + and attributes completely. + +* Add -E to run-shell to forward stderr as well as stdout (issue 4246). + +* Add an option variation-selector-always-wide to instruct tmux not to + always interpret VS16 as a wide character and assume the terminal does + likewise. + +* Switch to getopt_long from OpenSSH (from Koichi Murase, issue 4492). + +* Add more features for boolean expressions in formats: 1) extend && and || to + support arbitrarily many arguments and 2) add ! and !! for not and not-not + (from David Mandelberg). + +* Do not mistake other DCS sequences for SIXEL sequences (from James + Holderness, issue 4488). + +* Improve #? conditional expression in formats: add support for else if and + default empty string if no else value (from David Mandelberg, issue 4451). + +* Add default-client-command to set the command used if tmux is run without a + command; the default stays new-session (from David Mandelberg, issue + 4422). + +* Add S-Up and S-Down to move windows in tree mode (from David Mandelberg, + issue 4415). + +* Add mode 2031 support to automatically report dark or light theme. tmux will + guess the theme from the background colour on terminals which do not + themselves support the escape sequence (from Jonathan Slenders, issue 4353). + +* Add -M flag to capture-pane to use the copy mode screen (issue 4358). + +* Align index numbers in trees (from David Mandelberg, issue 4360). + +* Add display-message -C flag to update pane while message is displayed (from + Vitaly Ostrosablin, issue 4363). + +* Make list-commands command show only one command if an argument is given + (from Ilya Grigoriev, issue 4352). + +* Count line numbers correctly inside strings in configuration files (reported + by Pedro Navarro, issue 4325). + +* Map bright black (colour 8) to white (7) if the background is black on + terminals with only eight colours so the text is not invisible (from Dmytro + Bagrii, issue 4322). + +* New codepoint-widths option allowing users to override the width of + individual Unicode codepoints. + +* Add a nesting limit to source-file (from Fadi Afani, issue 4223). + +* Add copy-mode-position-style and copy-mode-selection-style options for copy + mode. + +* Add no-detach-on-destroy client option (issue 4242). + +* Add input-buffer-size option (from Ken Lau). + +* Add support for a scrollbar at the side of each pane. New options + pane-scrollbars turn them on or off, pane-scrollbars-position sets the + position (left or right), and pane-scrollbars-style to set the colours (from + Michael Grant, issue 4221). + +* Allow control characters to be entered at the command prompt by prefixing + with C-v (from Alexander Arch, issue 4206). + +* Do not attempt to search for zero length strings (from Alexander Arch, issue + 4209). + +* Preserve tabs for copying and capture-pane (from Alexander Arch, issue + 4201). + +* Increase the maximum for repeat-time. + +* Adjust how Ctrl and Meta keys are sent to use standard representation if + available in mode 1 (from Stanislav Kljuhhin, issue 4188). + +* Allow attributes in menu style (from Japin Li, issue 4194). + +* Add a sixel_support format variable which is 1 if SIXEL is supported, always + 0 on OpenBSD (requested by Misaki Masa, issue 4177). + +* Add prompt-cursor-colour and prompt-cursor-style to set the style of the + cursor in the command prompt and remove the emulated cursor (from Alexander + Arch, issue 4170). + +* Add initial-repeat-time option to allow the first repeat time to be increased + and later reduced (from David le Blanc, issue 4164). + +* Send focus events to pane when entering or leaving popup (issue 3991). + +* Add copy-mode-position-format to configure the position indicator. + +* Add -y flag to disable confirmation prompts in modes (issue 4152). + +* Add -C and -P flags to the copy commands in copy mode: -C prevents the + commands from sending the text to the clipboard and -P prevents them from + adding the text as a paste buffer (issue 4153). + +* Preserve transparency and raster attribute dimensions when sending a SIXEL + image, and avoid collapsing empty lines (issue 4149). + +* Bypass permission check for Cygwin (based on a change by Yuya Adachi via + Rafael Kitover, issue 4148). + +* Add MSYSTEM to default update-environment (for Cgywin). + +* Set client stdout file descriptor also for Cgywin (from Michael Wild via Rafael + Kitover, issue 4148). + +* Use global cursor style and colour options for modes instead of default + (issue 4117). + +* Fix pasting so it does not interpret keys but instead copies the input + without interpretation (reported by Mark Kelly). + +* Try to query window pixel size from the outside terminal if the values + returned by TIOCGWINSZ are zero (Dmitry Galchinsky, issue 4099). + +CHANGES FROM 3.5 TO 3.5a + +* Do not translate BSpace as Unicode with extended keys. + +* Fix so that keys with Shift are represented correctly with extended keys. + +* Revert to using /bin/sh for #() and run-shell and if-shell; the change to use + default-shell only applies now to popups. + +* Fix grey colour without a number suffix in styles. + CHANGES FROM 3.4 TO 3.5 * Revamp extended keys support to more closely match xterm and support mode 2 diff --git a/configure.ac b/configure.ac index 3b23febe..e6d4b548 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # configure.ac -AC_INIT([tmux], next-3.6) +AC_INIT([tmux], next-3.7) AC_PREREQ([2.60]) AC_CONFIG_AUX_DIR(etc) diff --git a/menu.c b/menu.c index fd3a9fe4..7449d88d 100644 --- a/menu.c +++ b/menu.c @@ -438,6 +438,38 @@ chosen: return (1); } +static void +menu_resize_cb(struct client *c, void *data) +{ + struct menu_data *md = data; + u_int nx, ny, w, h; + + if (md == NULL) + return; + + nx = md->px; + ny = md->py; + + w = md->menu->width + 4; + h = md->menu->count + 2; + + if (nx + w > c->tty.sx) { + if (c->tty.sx <= w) + nx = 0; + else + nx = c->tty.sx - w; + } + + if (ny + h > c->tty.sy) { + if (c->tty.sy <= h) + ny = 0; + else + ny = c->tty.sy - h; + } + md->px = nx; + md->py = ny; +} + static void menu_set_style(struct client *c, struct grid_cell *gc, const char *style, const char *option) @@ -551,6 +583,6 @@ menu_display(struct menu *menu, int flags, int starting_choice, if (md == NULL) return (-1); server_client_set_overlay(c, 0, NULL, menu_mode_cb, menu_draw_cb, - menu_key_cb, menu_free_cb, NULL, md); + menu_key_cb, menu_free_cb, menu_resize_cb, md); return (0); } diff --git a/options-table.c b/options-table.c index 6946a085..8989c264 100644 --- a/options-table.c +++ b/options-table.c @@ -36,7 +36,7 @@ static const char *options_table_mode_keys_list[] = { "emacs", "vi", NULL }; static const char *options_table_clock_mode_style_list[] = { - "12", "24", NULL + "12", "24", "12-with-seconds", "24-with-seconds", NULL }; static const char *options_table_status_list[] = { "off", "on", "2", "3", "4", "5", NULL diff --git a/server-client.c b/server-client.c index 1e79a49c..d93bd54b 100644 --- a/server-client.c +++ b/server-client.c @@ -2933,8 +2933,8 @@ server_client_reset_state(struct client *c) struct window_pane *wp = server_client_get_pane(c), *loop; struct screen *s = NULL; struct options *oo = c->session->options; - int mode = 0, cursor, flags, n; - u_int cx = 0, cy = 0, ox, oy, sx, sy; + int mode = 0, cursor, flags; + u_int cx = 0, cy = 0, ox, oy, sx, sy, n; if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) return; @@ -2966,13 +2966,13 @@ server_client_reset_state(struct client *c) if (c->prompt_string != NULL) { n = options_get_number(oo, "status-position"); if (n == 0) - cy = 0; + cy = status_prompt_line_at(c); else { - n = status_line_size(c); - if (n == 0) - cy = tty->sy - 1; - else + n = status_line_size(c) - status_prompt_line_at(c); + if (n <= tty->sy) cy = tty->sy - n; + else + cy = tty->sy - 1; } cx = c->prompt_cursor; } else if (c->overlay_draw == NULL) { diff --git a/server-fn.c b/server-fn.c index 6ab7fa48..29802a60 100644 --- a/server-fn.c +++ b/server-fn.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/status.c b/status.c index 2786db7e..0551b547 100644 --- a/status.c +++ b/status.c @@ -264,14 +264,19 @@ status_line_size(struct client *c) } /* Get the prompt line number for client's session. 1 means at the bottom. */ -static u_int +u_int status_prompt_line_at(struct client *c) { struct session *s = c->session; + u_int line, lines; - if (c->flags & (CLIENT_STATUSOFF|CLIENT_CONTROL)) - return (1); - return (options_get_number(s->options, "message-line")); + lines = status_line_size(c); + if (lines == 0) + return (0); + line = options_get_number(s->options, "message-line"); + if (line >= lines) + return (lines - 1); + return (line); } /* Get window at window list position. */ diff --git a/tmux.1 b/tmux.1 index a25da1fb..5a17095d 100644 --- a/tmux.1 +++ b/tmux.1 @@ -4927,7 +4927,7 @@ option is enabled. Set clock colour. .Pp .It Xo Ic clock-mode-style -.Op Ic 12 | 24 +.Op Ic 12 | 24 | 12-with-seconds | 24-with-seconds .Xc Set clock hour format. .Pp diff --git a/tmux.h b/tmux.h index ff04ba95..d62b0a96 100644 --- a/tmux.h +++ b/tmux.h @@ -2961,6 +2961,7 @@ extern u_int status_prompt_hsize[]; void status_timer_start(struct client *); void status_timer_start_all(void); void status_update_cache(struct session *); +u_int status_prompt_line_at(struct client *); int status_at_line(struct client *); u_int status_line_size(struct client *); struct style_range *status_get_range(struct client *, u_int, u_int); diff --git a/tty.c b/tty.c index c484cbdd..aa522d6b 100644 --- a/tty.c +++ b/tty.c @@ -35,6 +35,8 @@ static int tty_log_fd = -1; +static void tty_start_timer_callback(int, short, void *); +static void tty_clipboard_query_callback(int, short, void *); static void tty_set_italics(struct tty *); static int tty_try_colour(struct tty *, int, const char *); static void tty_force_cursor_colour(struct tty *, int); @@ -296,6 +298,8 @@ tty_open(struct tty *tty, char **cause) if (tty->out == NULL) fatal("out of memory"); + evtimer_set(&tty->clipboard_timer, tty_clipboard_query_callback, tty); + evtimer_set(&tty->start_timer, tty_start_timer_callback, tty); evtimer_set(&tty->timer, tty_timer_callback, tty); tty_start_tty(tty); @@ -327,7 +331,6 @@ tty_start_start_timer(struct tty *tty) log_debug("%s: start timer started", c->name); evtimer_del(&tty->start_timer); - evtimer_set(&tty->start_timer, tty_start_timer_callback, tty); evtimer_add(&tty->start_timer, &tv); } @@ -445,6 +448,7 @@ tty_stop_tty(struct tty *tty) tty->flags &= ~TTY_STARTED; evtimer_del(&tty->start_timer); + evtimer_del(&tty->clipboard_timer); event_del(&tty->timer); tty->flags &= ~TTY_BLOCK; @@ -3316,6 +3320,5 @@ tty_clipboard_query(struct tty *tty) tty_putcode_ss(tty, TTYC_MS, "", "?"); tty->flags |= TTY_OSC52QUERY; - evtimer_set(&tty->clipboard_timer, tty_clipboard_query_callback, tty); evtimer_add(&tty->clipboard_timer, &tv); } diff --git a/window-clock.c b/window-clock.c index 8cef3f9a..51620d4a 100644 --- a/window-clock.c +++ b/window-clock.c @@ -45,7 +45,7 @@ const struct window_mode window_clock_mode = { }; struct window_clock_mode_data { - struct screen screen; + struct screen screen; time_t tim; struct event timer; }; @@ -142,7 +142,7 @@ window_clock_timer_callback(__unused int fd, __unused short events, void *arg) t = time(NULL); gmtime_r(&t, &now); gmtime_r(&data->tim, &then); - if (now.tm_min == then.tm_min) + if (now.tm_sec == then.tm_sec) return; data->tim = t; @@ -207,11 +207,12 @@ window_clock_draw_screen(struct window_mode_entry *wme) { struct window_pane *wp = wme->wp; struct window_clock_mode_data *data = wme->data; - struct screen_write_ctx ctx; + struct screen_write_ctx ctx; int colour, style; struct screen *s = &data->screen; struct grid_cell gc; char tim[64], *ptr; + const char *timeformat; time_t t; struct tm *tm; u_int i, j, x, y, idx; @@ -223,14 +224,23 @@ window_clock_draw_screen(struct window_mode_entry *wme) t = time(NULL); tm = localtime(&t); - if (style == 0) { - strftime(tim, sizeof tim, "%l:%M ", localtime(&t)); + if (style == 0 || style == 2) { + if (style == 2) + timeformat = "%l:%M:%S "; + else + timeformat = "%l:%M "; + strftime(tim, sizeof tim, timeformat, localtime(&t)); if (tm->tm_hour >= 12) strlcat(tim, "PM", sizeof tim); else strlcat(tim, "AM", sizeof tim); - } else - strftime(tim, sizeof tim, "%H:%M", tm); + } else { + if (style == 3) + timeformat = "%H:%M:%S"; + else + timeformat = "%H:%M"; + strftime(tim, sizeof tim, timeformat, tm); + } screen_write_clearscreen(&ctx, 8);