diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-10-27 10:01:13 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-10-27 10:01:13 +0000 |
commit | 147b5ae5145dc29e9bf4d0ebbc635939b6fdc60b (patch) | |
tree | 099e5b6dfcbcf9dcd4849da370549c39f0aa8602 | |
parent | 9c69a79f9ae14e3530ec50fcff32d57f0dd63aaf (diff) | |
parent | 9952201ca72b42819d64a9174fa7b5b898215668 (diff) | |
download | rtmux-147b5ae5145dc29e9bf4d0ebbc635939b6fdc60b.tar.gz rtmux-147b5ae5145dc29e9bf4d0ebbc635939b6fdc60b.tar.bz2 rtmux-147b5ae5145dc29e9bf4d0ebbc635939b6fdc60b.zip |
Merge branch 'obsd-master'
-rw-r--r-- | format.c | 34 | ||||
-rw-r--r-- | key-bindings.c | 2 | ||||
-rw-r--r-- | screen.c | 2 |
3 files changed, 22 insertions, 16 deletions
@@ -660,6 +660,8 @@ format_find(struct format_tree *ft, const char *key, int modifiers) return (NULL); found: + if (found == NULL) + return (NULL); copy = xstrdup(found); if (modifiers & FORMAT_BASENAME) { saved = copy; @@ -685,7 +687,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, char *copy, *copy0, *endptr, *ptr, *saved, *trimmed, *value; size_t valuelen; u_long limit = 0; - int modifiers = 0; + int modifiers = 0, brackets; /* Make a copy of the key. */ copy0 = copy = xmalloc(keylen + 1); @@ -733,20 +735,26 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, goto fail; *ptr = '\0'; - value = saved = format_find(ft, copy + 1, modifiers); - if (value != NULL && *value != '\0' && - (value[0] != '0' || value[1] != '\0')) { - value = ptr + 1; - ptr = strchr(value, ','); - if (ptr == NULL) - goto fail; + value = ptr + 1; + saved = format_find(ft, copy + 1, modifiers); + + brackets = 0; + for (ptr = ptr + 1; *ptr != '\0'; ptr++) { + if (*ptr == '{') + brackets++; + if (*ptr == '}') + brackets--; + if (*ptr == ',' && brackets == 0) + break; + } + if (*ptr == '\0') + goto fail; + + if (saved != NULL && *saved != '\0' && + (saved[0] != '0' || saved[1] != '\0')) { *ptr = '\0'; - } else { - ptr = strchr(ptr + 1, ','); - if (ptr == NULL) - goto fail; + } else value = ptr + 1; - } value = format_expand(ft, value); free(saved); saved = value; diff --git a/key-bindings.c b/key-bindings.c index 2d739e84..e12dd62c 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -227,7 +227,7 @@ key_bindings_init(void) "bind -n WheelUpStatus previous-window", "bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= \"#{pane_in_mode}\" \"copy-mode -M\" \"send-keys -M\"' 'copy-mode -M'", "bind -n MouseDown3Pane select-pane -mt=", - "bind -n WheelUpPane if-shell -Ft= '#{mouse_any_flag}' 'send-keys -M' 'if -Ft= \"#{pane_in_mode}\" \"send-keys -M\" \"copy-mode -e\"'", + "bind -n WheelUpPane if-shell -Ft= '#{mouse_any_flag}' 'send-keys -M' 'if -Ft= \"#{pane_in_mode}\" \"send-keys -M\" \"copy-mode -et=\"'", }; u_int i; struct cmd_list *cmdlist; @@ -194,8 +194,6 @@ screen_resize_y(struct screen *s, u_int sy) * Now just increase the history size, if possible, to take * over the lines which are left. If history is off, delete * lines from the top. - * - * XXX Should apply history limit? */ available = s->cy; if (gd->flags & GRID_HISTORY) |