mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
c07e856d24
60
mode-tree.c
60
mode-tree.c
@ -25,6 +25,11 @@
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
enum mode_tree_search_dir {
|
||||
MODE_TREE_SEARCH_FORWARD,
|
||||
MODE_TREE_SEARCH_BACKWARD
|
||||
};
|
||||
|
||||
struct mode_tree_item;
|
||||
TAILQ_HEAD(mode_tree_list, mode_tree_item);
|
||||
|
||||
@ -68,6 +73,7 @@ struct mode_tree_data {
|
||||
char *search;
|
||||
char *filter;
|
||||
int no_matches;
|
||||
enum mode_tree_search_dir search_dir;
|
||||
};
|
||||
|
||||
struct mode_tree_item {
|
||||
@ -786,7 +792,49 @@ done:
|
||||
}
|
||||
|
||||
static struct mode_tree_item *
|
||||
mode_tree_search_for(struct mode_tree_data *mtd)
|
||||
mode_tree_search_backward(struct mode_tree_data *mtd)
|
||||
{
|
||||
struct mode_tree_item *mti, *last, *prev;
|
||||
|
||||
if (mtd->search == NULL)
|
||||
return (NULL);
|
||||
|
||||
mti = last = mtd->line_list[mtd->current].item;
|
||||
for (;;) {
|
||||
if ((prev = TAILQ_PREV(mti, mode_tree_list, entry)) != NULL) {
|
||||
/* Point to the last child in the previous subtree. */
|
||||
while (!TAILQ_EMPTY(&prev->children))
|
||||
prev = TAILQ_LAST(&prev->children, mode_tree_list);
|
||||
mti = prev;
|
||||
} else {
|
||||
/* If prev is NULL, jump to the parent. */
|
||||
mti = mti->parent;
|
||||
}
|
||||
|
||||
if (mti == NULL) {
|
||||
/* Point to the last child in the last root subtree. */
|
||||
prev = TAILQ_LAST(&mtd->children, mode_tree_list);
|
||||
while (!TAILQ_EMPTY(&prev->children))
|
||||
prev = TAILQ_LAST(&prev->children, mode_tree_list);
|
||||
mti = prev;
|
||||
}
|
||||
if (mti == last)
|
||||
break;
|
||||
|
||||
if (mtd->searchcb == NULL) {
|
||||
if (strstr(mti->name, mtd->search) != NULL)
|
||||
return (mti);
|
||||
continue;
|
||||
}
|
||||
if (mtd->searchcb(mtd->modedata, mti->itemdata, mtd->search))
|
||||
return (mti);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
static struct mode_tree_item *
|
||||
mode_tree_search_forward(struct mode_tree_data *mtd)
|
||||
{
|
||||
struct mode_tree_item *mti, *last, *next;
|
||||
|
||||
@ -832,7 +880,10 @@ mode_tree_search_set(struct mode_tree_data *mtd)
|
||||
struct mode_tree_item *mti, *loop;
|
||||
uint64_t tag;
|
||||
|
||||
mti = mode_tree_search_for(mtd);
|
||||
if (mtd->search_dir == MODE_TREE_SEARCH_FORWARD)
|
||||
mti = mode_tree_search_forward(mtd);
|
||||
else
|
||||
mti = mode_tree_search_backward(mtd);
|
||||
if (mti == NULL)
|
||||
return;
|
||||
tag = mti->tag;
|
||||
@ -1165,6 +1216,11 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
|
||||
PROMPT_NOFORMAT, PROMPT_TYPE_SEARCH);
|
||||
break;
|
||||
case 'n':
|
||||
mtd->search_dir = MODE_TREE_SEARCH_FORWARD;
|
||||
mode_tree_search_set(mtd);
|
||||
break;
|
||||
case 'N':
|
||||
mtd->search_dir = MODE_TREE_SEARCH_BACKWARD;
|
||||
mode_tree_search_set(mtd);
|
||||
break;
|
||||
case 'f':
|
||||
|
12
tmux.1
12
tmux.1
@ -2297,7 +2297,8 @@ The following keys may be used in client mode:
|
||||
.It Li "Up" Ta "Select previous client"
|
||||
.It Li "Down" Ta "Select next client"
|
||||
.It Li "C-s" Ta "Search by name"
|
||||
.It Li "n" Ta "Repeat last search"
|
||||
.It Li "n" Ta "Repeat last search forwards"
|
||||
.It Li "N" Ta "Repeat last search backwards"
|
||||
.It Li "t" Ta "Toggle if client is tagged"
|
||||
.It Li "T" Ta "Tag no clients"
|
||||
.It Li "C-t" Ta "Tag all clients"
|
||||
@ -2384,7 +2385,8 @@ The following keys may be used in tree mode:
|
||||
.It Li "C-s" Ta "Search by name"
|
||||
.It Li "m" Ta "Set the marked pane"
|
||||
.It Li "M" Ta "Clear the marked pane"
|
||||
.It Li "n" Ta "Repeat last search"
|
||||
.It Li "n" Ta "Repeat last search forwards"
|
||||
.It Li "N" Ta "Repeat last search backwards"
|
||||
.It Li "t" Ta "Toggle if item is tagged"
|
||||
.It Li "T" Ta "Tag no items"
|
||||
.It Li "C-t" Ta "Tag all items"
|
||||
@ -2462,7 +2464,8 @@ The following keys may be used in customize mode:
|
||||
.It Li "u" Ta "Unset an option (set to default value if global) or unbind a key"
|
||||
.It Li "U" Ta "Unset tagged options and unbind tagged keys"
|
||||
.It Li "C-s" Ta "Search by name"
|
||||
.It Li "n" Ta "Repeat last search"
|
||||
.It Li "n" Ta "Repeat last search forwards"
|
||||
.It Li "N" Ta "Repeat last search backwards"
|
||||
.It Li "t" Ta "Toggle if item is tagged"
|
||||
.It Li "T" Ta "Tag no items"
|
||||
.It Li "C-t" Ta "Tag all items"
|
||||
@ -6469,7 +6472,8 @@ The following keys may be used in buffer mode:
|
||||
.It Li "Up" Ta "Select previous buffer"
|
||||
.It Li "Down" Ta "Select next buffer"
|
||||
.It Li "C-s" Ta "Search by name or content"
|
||||
.It Li "n" Ta "Repeat last search"
|
||||
.It Li "n" Ta "Repeat last search forwards"
|
||||
.It Li "N" Ta "Repeat last search backwards"
|
||||
.It Li "t" Ta "Toggle if buffer is tagged"
|
||||
.It Li "T" Ta "Tag no buffers"
|
||||
.It Li "C-t" Ta "Tag all buffers"
|
||||
|
2
utf8.c
2
utf8.c
@ -525,7 +525,7 @@ utf8_strvis(char *dst, const char *src, size_t len, int flag)
|
||||
/* Not a complete, valid UTF-8 character. */
|
||||
src -= ud.have;
|
||||
}
|
||||
if (src[0] == '$' && src < end - 1) {
|
||||
if ((flag & VIS_DQ) && src[0] == '$' && src < end - 1) {
|
||||
if (isalpha((u_char)src[1]) ||
|
||||
src[1] == '_' ||
|
||||
src[1] == '{')
|
||||
|
Loading…
Reference in New Issue
Block a user