summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-03-20 18:35:54 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-03-20 18:35:54 +0000
commit19551f79aa8542b422be2ef4076c2059fd8c725f (patch)
tree689711e7d445e3fac31b3d24fff9dc67ae0b05c4 /usr.bin
parent9c2c26afef4dae14b22806fd37e9132322a977eb (diff)
Apply same menu items to view mode like copy mode.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/format.c8
-rw-r--r--usr.bin/tmux/key-bindings.c10
2 files changed, 10 insertions, 8 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index 2f92b1f7106..b9b1e25924f 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.228 2020/03/20 17:59:39 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.229 2020/03/20 18:35:53 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1021,7 +1021,8 @@ format_cb_mouse_word(struct format_tree *ft, struct format_entry *fe)
return;
if (!TAILQ_EMPTY(&wp->modes)) {
- if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode)
+ if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode ||
+ TAILQ_FIRST(&wp->modes)->mode == &window_view_mode)
s = window_copy_get_word(wp, x, y);
else
s = NULL;
@@ -1077,7 +1078,8 @@ format_cb_mouse_line(struct format_tree *ft, struct format_entry *fe)
return;
if (!TAILQ_EMPTY(&wp->modes)) {
- if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode)
+ if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode ||
+ TAILQ_FIRST(&wp->modes)->mode == &window_view_mode)
s = window_copy_get_line(wp, y);
else
s = NULL;
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c
index c9022216558..cbdbc7172a0 100644
--- a/usr.bin/tmux/key-bindings.c
+++ b/usr.bin/tmux/key-bindings.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key-bindings.c,v 1.114 2020/03/20 18:22:37 nicm Exp $ */
+/* $OpenBSD: key-bindings.c,v 1.115 2020/03/20 18:35:53 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -46,10 +46,10 @@
" 'New After' 'w' {new-window -a}" \
" 'New At End' 'W' {new-window}"
#define DEFAULT_PANE_MENU \
- " '#{?#{==:#{pane_mode},copy-mode},Go To Top,}' '<' {send -X history-top}" \
- " '#{?#{==:#{pane_mode},copy-mode},Go To Bottom,}' '>' {send -X history-bottom}" \
+ " '#{?#{m/r:(copy|view)-mode,#{pane_mode}},Go To Top,}' '<' {send -X history-top}" \
+ " '#{?#{m/r:(copy|view)-mode,#{pane_mode}},Go To Bottom,}' '>' {send -X history-bottom}" \
" ''" \
- " '#{?mouse_word,Search For #[underscore]#{=/9/...:mouse_word},}' 'C-r' {copy-mode -t=; send -Xt= search-backward \"#{q:mouse_word}\"}" \
+ " '#{?mouse_word,Search For #[underscore]#{=/9/...:mouse_word},}' 'C-r' {if -F '#{?#{m/r:(copy|view)-mode,#{pane_mode}},0,1}' 'copy-mode -t='; send -Xt= search-backward \"#{q:mouse_word}\"}" \
" '#{?mouse_word,Type #[underscore]#{=/9/...:mouse_word},}' 'C-y' {copy-mode -q; send-keys -l -- \"#{q:mouse_word}\"}" \
" '#{?mouse_word,Copy #[underscore]#{=/9/...:mouse_word},}' 'c' {copy-mode -q; set-buffer -- \"#{q:mouse_word}\"}" \
" '#{?mouse_line,Copy Line,}' 'l' {copy-mode -q; set-buffer -- \"#{q:mouse_line}\"}" \
@@ -357,7 +357,7 @@ key_bindings_init(void)
"bind -n MouseDown3Status display-menu -t= -xW -yS -T '#[align=centre]#{window_index}:#{window_name}' " DEFAULT_WINDOW_MENU,
/* Mouse button 3 down on pane. */
- "bind -n MouseDown3Pane if -Ft= '#{||:#{mouse_any_flag},#{&&:#{pane_in_mode},#{!=:#{pane_mode},copy-mode}}}' { select-pane -t=; send -M } { display-menu -t= -xM -yM -T '#[align=centre]#{pane_index} (#{pane_id})' " DEFAULT_PANE_MENU " }",
+ "bind -n MouseDown3Pane if -Ft= '#{||:#{mouse_any_flag},#{&&:#{pane_in_mode},#{?#{m/r:(copy|view)-mode,#{pane_mode}},0,1}}}' { select-pane -t=; send -M } { display-menu -t= -xM -yM -T '#[align=centre]#{pane_index} (#{pane_id})' " DEFAULT_PANE_MENU " }",
"bind -n M-MouseDown3Pane display-menu -t= -xM -yM -T '#[align=centre]#{pane_index} (#{pane_id})' " DEFAULT_PANE_MENU,
/* Copy mode (emacs) keys. */