Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/tmux merge changes between tmux-3.2 and tmux-3.2a



details:   https://anonhg.NetBSD.org/src/rev/82082810a52b
branches:  trunk
changeset: 359800:82082810a52b
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 23 16:47:46 2022 +0000

description:
merge changes between tmux-3.2 and tmux-3.2a

diffstat:

 external/bsd/tmux/dist/cmd-display-menu.c |    2 +-
 external/bsd/tmux/dist/cmd-new-session.c  |    1 +
 external/bsd/tmux/dist/format.c           |   10 +-
 external/bsd/tmux/dist/input-keys.c       |   26 +----
 external/bsd/tmux/dist/input.c            |    2 +
 external/bsd/tmux/dist/key-bindings.c     |    6 +
 external/bsd/tmux/dist/resize.c           |   49 ++++++--
 external/bsd/tmux/dist/screen.c           |    4 +-
 external/bsd/tmux/dist/server-client.c    |  156 ++++++++++++++++++-----------
 external/bsd/tmux/dist/status.c           |    4 +-
 external/bsd/tmux/dist/tmux.1             |   42 ++++++-
 external/bsd/tmux/dist/tmux.c             |   15 +-
 external/bsd/tmux/dist/tmux.h             |   59 ++++++++---
 external/bsd/tmux/dist/tty-keys.c         |   39 ++++---
 external/bsd/tmux/dist/tty-term.c         |   98 ++++++++++++------
 external/bsd/tmux/dist/tty.c              |    9 +-
 external/bsd/tmux/dist/window-buffer.c    |    4 +-
 external/bsd/tmux/dist/window-copy.c      |   41 +++++--
 external/bsd/tmux/dist/window.c           |   53 ++++-----
 external/bsd/tmux/usr.bin/tmux/Makefile   |   11 +-
 20 files changed, 383 insertions(+), 248 deletions(-)

diffs (truncated from 1297 to 300 lines):

diff -r ba11abc896a2 -r 82082810a52b external/bsd/tmux/dist/cmd-display-menu.c
--- a/external/bsd/tmux/dist/cmd-display-menu.c Sun Jan 23 16:45:03 2022 +0000
+++ b/external/bsd/tmux/dist/cmd-display-menu.c Sun Jan 23 16:47:46 2022 +0000
@@ -205,7 +205,7 @@
        if (xp == NULL || strcmp(xp, "C") == 0)
                xp = "#{popup_centre_x}";
        else if (strcmp(xp, "R") == 0)
-               xp = "#{popup_right}";
+               xp = "#{popup_pane_right}";
        else if (strcmp(xp, "P") == 0)
                xp = "#{popup_pane_left}";
        else if (strcmp(xp, "M") == 0)
diff -r ba11abc896a2 -r 82082810a52b external/bsd/tmux/dist/cmd-new-session.c
--- a/external/bsd/tmux/dist/cmd-new-session.c  Sun Jan 23 16:45:03 2022 +0000
+++ b/external/bsd/tmux/dist/cmd-new-session.c  Sun Jan 23 16:47:46 2022 +0000
@@ -269,6 +269,7 @@
        memset(&sc, 0, sizeof sc);
        sc.item = item;
        sc.s = s;
+       sc.tc = c;
 
        sc.name = args_get(args, 'n');
        sc.argc = args->argc;
diff -r ba11abc896a2 -r 82082810a52b external/bsd/tmux/dist/format.c
--- a/external/bsd/tmux/dist/format.c   Sun Jan 23 16:45:03 2022 +0000
+++ b/external/bsd/tmux/dist/format.c   Sun Jan 23 16:47:46 2022 +0000
@@ -103,7 +103,7 @@
 #define FORMAT_CHARACTER 0x10000
 
 /* Limit on recursion. */
-#define FORMAT_LOOP_LIMIT 10
+#define FORMAT_LOOP_LIMIT 100
 
 /* Format expand flags. */
 #define FORMAT_EXPAND_TIME 0x1
@@ -3991,7 +3991,7 @@
                result = (mleft < mright);
                break;
        case LESS_THAN_EQUAL:
-               result = (mleft > mright);
+               result = (mleft <= mright);
                break;
        }
        if (use_fp)
@@ -4199,7 +4199,7 @@
                        value = xstrdup("0");
                } else {
                        format_log(es, "search '%s' pane %%%u", new, wp->id);
-                       value = format_search(fm, wp, new);
+                       value = format_search(search, wp, new);
                }
                free(new);
        } else if (cmp != NULL) {
@@ -4441,8 +4441,10 @@
        if (fmt == NULL || *fmt == '\0')
                return (xstrdup(""));
 
-       if (es->loop == FORMAT_LOOP_LIMIT)
+       if (es->loop == FORMAT_LOOP_LIMIT) {
+               format_log(es, "reached loop limit (%u)", FORMAT_LOOP_LIMIT);
                return (xstrdup(""));
+       }
        es->loop++;
 
        format_log(es, "expanding format: %s", fmt);
diff -r ba11abc896a2 -r 82082810a52b external/bsd/tmux/dist/input-keys.c
--- a/external/bsd/tmux/dist/input-keys.c       Sun Jan 23 16:45:03 2022 +0000
+++ b/external/bsd/tmux/dist/input-keys.c       Sun Jan 23 16:47:46 2022 +0000
@@ -94,30 +94,6 @@
        { .key = KEYC_F12,
          .data = "\033[24~"
        },
-       { .key = KEYC_F1|KEYC_SHIFT,
-         .data = "\033[25~"
-       },
-       { .key = KEYC_F2|KEYC_SHIFT,
-         .data = "\033[26~"
-       },
-       { .key = KEYC_F3|KEYC_SHIFT,
-         .data = "\033[28~"
-       },
-       { .key = KEYC_F4|KEYC_SHIFT,
-         .data = "\033[29~"
-       },
-       { .key = KEYC_F5|KEYC_SHIFT,
-         .data = "\033[31~"
-       },
-       { .key = KEYC_F6|KEYC_SHIFT,
-         .data = "\033[32~"
-       },
-       { .key = KEYC_F7|KEYC_SHIFT,
-         .data = "\033[33~"
-       },
-       { .key = KEYC_F8|KEYC_SHIFT,
-         .data = "\033[34~"
-       },
        { .key = KEYC_IC,
          .data = "\033[2~"
        },
@@ -476,7 +452,7 @@
                input_key_write(__func__, bev, (const char *)ud.data, 1);
                return (0);
        }
-       if (justkey > 0x7f && justkey < KEYC_BASE) {
+       if (KEYC_IS_UNICODE(justkey)) {
                if (key & KEYC_META)
                        input_key_write(__func__, bev, "\033", 1);
                utf8_to_data(justkey, &ud);
diff -r ba11abc896a2 -r 82082810a52b external/bsd/tmux/dist/input.c
--- a/external/bsd/tmux/dist/input.c    Sun Jan 23 16:45:03 2022 +0000
+++ b/external/bsd/tmux/dist/input.c    Sun Jan 23 16:47:46 2022 +0000
@@ -1390,6 +1390,8 @@
        case INPUT_CSI_MODSET:
                n = input_get(ictx, 0, 0, 0);
                m = input_get(ictx, 1, 0, 0);
+               if (options_get_number(global_options, "extended-keys") == 2)
+                       break;
                if (n == 0 || (n == 4 && m == 0))
                        screen_write_mode_clear(sctx, MODE_KEXTENDED);
                else if (n == 4 && (m == 1 || m == 2))
diff -r ba11abc896a2 -r 82082810a52b external/bsd/tmux/dist/key-bindings.c
--- a/external/bsd/tmux/dist/key-bindings.c     Sun Jan 23 16:45:03 2022 +0000
+++ b/external/bsd/tmux/dist/key-bindings.c     Sun Jan 23 16:47:46 2022 +0000
@@ -215,6 +215,9 @@
        if (repeat)
                bd->flags |= KEY_BINDING_REPEAT;
        bd->cmdlist = cmdlist;
+
+       log_debug("%s: %#llx %s = %s", __func__, bd->key,
+           key_string_lookup_key(bd->key, 1), cmd_list_print(bd->cmdlist, 0));
 }
 
 void
@@ -231,6 +234,9 @@
        if (bd == NULL)
                return;
 
+       log_debug("%s: %#llx %s", __func__, bd->key,
+           key_string_lookup_key(bd->key, 1));
+
        RB_REMOVE(key_bindings, &table->key_bindings, bd);
        key_bindings_free(bd);
 
diff -r ba11abc896a2 -r 82082810a52b external/bsd/tmux/dist/resize.c
--- a/external/bsd/tmux/dist/resize.c   Sun Jan 23 16:45:03 2022 +0000
+++ b/external/bsd/tmux/dist/resize.c   Sun Jan 23 16:47:46 2022 +0000
@@ -108,17 +108,19 @@
 }
 
 static int
-clients_calculate_size(int type, int current, struct session *s,
-    struct window *w, int (*skip_client)(struct client *, int, int,
-    struct session *, struct window *), u_int *sx, u_int *sy, u_int *xpixel,
-    u_int *ypixel)
+clients_calculate_size(int type, int current, struct client *c,
+    struct session *s, struct window *w, int (*skip_client)(struct client *,
+    int, int, struct session *, struct window *), u_int *sx, u_int *sy,
+    u_int *xpixel, u_int *ypixel)
 {
        struct client   *loop;
        u_int            cx, cy, n = 0;
 
        /* Manual windows do not have their size changed based on a client. */
-       if (type == WINDOW_SIZE_MANUAL)
+       if (type == WINDOW_SIZE_MANUAL) {
+               log_debug("%s: type is manual", __func__);
                return (0);
+       }
 
        /*
         * Start comparing with 0 for largest and UINT_MAX for smallest or
@@ -134,23 +136,29 @@
         * For latest, count the number of clients with this window. We only
         * care if there is more than one.
         */
-       if (type == WINDOW_SIZE_LATEST)
+       if (type == WINDOW_SIZE_LATEST && w != NULL)
                n = clients_with_window(w);
 
        /* Loop over the clients and work out the size. */
        TAILQ_FOREACH(loop, &clients, entry) {
-               if (ignore_client_size(loop))
+               if (loop != c && ignore_client_size(loop)) {
+                       log_debug("%s: ignoring %s", __func__, loop->name);
                        continue;
-               if (skip_client(loop, type, current, s, w))
+               }
+               if (loop != c && skip_client(loop, type, current, s, w)) {
+                       log_debug("%s: skipping %s", __func__, loop->name);
                        continue;
+               }
 
                /*
                 * If there are multiple clients attached, only accept the
                 * latest client; otherwise let the only client be chosen as
                 * for smallest.
                 */
-               if (type == WINDOW_SIZE_LATEST && n > 1 && loop != w->latest)
+               if (type == WINDOW_SIZE_LATEST && n > 1 && loop != w->latest) {
+                       log_debug("%s: %s is not latest", __func__, loop->name);
                        continue;
+               }
 
                /* Work out this client's size. */
                cx = loop->tty.sx;
@@ -175,16 +183,24 @@
                        *xpixel = loop->tty.xpixel;
                        *ypixel = loop->tty.ypixel;
                }
+               log_debug("%s: after %s (%ux%u), size is %ux%u", __func__,
+                   loop->name, cx, cy, *sx, *sy);
        }
 
        /* Return whether a suitable size was found. */
-       if (type == WINDOW_SIZE_LARGEST)
+       if (type == WINDOW_SIZE_LARGEST) {
+               log_debug("%s: type is largest", __func__);
                return (*sx != 0 && *sy != 0);
+       }
+       if (type == WINDOW_SIZE_LATEST)
+               log_debug("%s: type is latest", __func__);
+       else
+               log_debug("%s: type is smallest", __func__);
        return (*sx != UINT_MAX && *sy != UINT_MAX);
 }
 
 static int
-default_window_size_skip_client (struct client *loop, int type,
+default_window_size_skip_client(struct client *loop, int type,
     __unused int current, struct session *s, struct window *w)
 {
        /*
@@ -221,23 +237,25 @@
                        *sy = c->tty.sy - status_line_size(c);
                        *xpixel = c->tty.xpixel;
                        *ypixel = c->tty.ypixel;
+                       log_debug("%s: using %ux%u from %s", __func__, *sx, *sy,
+                           c->name);
                        goto done;
                }
-               if (w == NULL)
-                       type = WINDOW_SIZE_MANUAL;
        }
 
        /*
         * Look for a client to base the size on. If none exists (or the type
         * is manual), use the default-size option.
         */
-       if (!clients_calculate_size(type, 0, s, w,
+       if (!clients_calculate_size(type, 0, c, s, w,
            default_window_size_skip_client, sx, sy, xpixel, ypixel)) {
                value = options_get_string(s->options, "default-size");
                if (sscanf(value, "%ux%u", sx, sy) != 2) {
                        *sx = 80;
                        *sy = 24;
                }
+               log_debug("%s: using %ux%u from default-size", __func__, *sx,
+                   *sy);
        }
 
 done:
@@ -250,6 +268,7 @@
                *sy = WINDOW_MINIMUM;
        if (*sy > WINDOW_MAXIMUM)
                *sy = WINDOW_MAXIMUM;
+       log_debug("%s: resulting size is %ux%u", __func__, *sx, *sy);
 }
 
 static int
@@ -289,7 +308,7 @@
        current = options_get_number(w->options, "aggressive-resize");
 
        /* Look for a suitable client and get the new size. */
-       changed = clients_calculate_size(type, current, NULL, w,
+       changed = clients_calculate_size(type, current, NULL, NULL, w,
            recalculate_size_skip_client, &sx, &sy, &xpixel, &ypixel);
 
        /*
diff -r ba11abc896a2 -r 82082810a52b external/bsd/tmux/dist/screen.c
--- a/external/bsd/tmux/dist/screen.c   Sun Jan 23 16:45:03 2022 +0000
+++ b/external/bsd/tmux/dist/screen.c   Sun Jan 23 16:47:46 2022 +0000
@@ -100,7 +100,9 @@
        s->rupper = 0;
        s->rlower = screen_size_y(s) - 1;
 
-       s->mode = MODE_CURSOR | MODE_WRAP;
+       s->mode = MODE_CURSOR|MODE_WRAP;
+       if (options_get_number(global_options, "extended-keys") == 2)
+               s->mode |= MODE_KEXTENDED;
 
        if (s->saved_grid != NULL)
                screen_alternate_off(s, NULL, 0);
diff -r ba11abc896a2 -r 82082810a52b external/bsd/tmux/dist/server-client.c
--- a/external/bsd/tmux/dist/server-client.c    Sun Jan 23 16:45:03 2022 +0000
+++ b/external/bsd/tmux/dist/server-client.c    Sun Jan 23 16:47:46 2022 +0000
@@ -43,6 +43,7 @@
 static void    server_client_set_title(struct client *);
 static void    server_client_reset_state(struct client *);
 static int     server_client_assume_paste(struct session *);
+static void    server_client_update_latest(struct client *);



Home | Main Index | Thread Index | Old Index