-.\" $OpenBSD: tmux.1,v 1.812 2021/01/20 07:16:54 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.813 2021/01/22 10:24:52 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 20 2021 $
+.Dd $Mdocdate: January 22 2021 $
.Dt TMUX 1
.Os
.Sh NAME
.It Li "previous-paragraph" Ta "{" Ta "M-{"
.It Li "previous-space" Ta "B" Ta ""
.It Li "previous-word" Ta "b" Ta "M-b"
+.It Li "rectangle-on" Ta "" Ta ""
+.It Li "rectangle-off" Ta "" Ta ""
.It Li "rectangle-toggle" Ta "v" Ta "R"
.It Li "refresh-from-pane" Ta "r" Ta "r"
.It Li "scroll-down" Ta "C-e" Ta "C-Down"
-/* $OpenBSD: window-copy.c,v 1.312 2021/01/22 10:21:24 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.313 2021/01/22 10:24:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
const char *, int);
static void window_copy_scroll_up(struct window_mode_entry *, u_int);
static void window_copy_scroll_down(struct window_mode_entry *, u_int);
-static void window_copy_rectangle_toggle(struct window_mode_entry *);
+static void window_copy_rectangle_set(struct window_mode_entry *, int);
static void window_copy_move_mouse(struct mouse_event *);
static void window_copy_drag_update(struct client *, struct mouse_event *);
static void window_copy_drag_release(struct client *, struct mouse_event *);
return (WINDOW_COPY_CMD_NOTHING);
}
+static enum window_copy_cmd_action
+window_copy_cmd_rectangle_on(struct window_copy_cmd_state *cs)
+{
+ struct window_mode_entry *wme = cs->wme;
+ struct window_copy_mode_data *data = wme->data;
+
+ data->lineflag = LINE_SEL_NONE;
+ window_copy_rectangle_set(wme, 1);
+
+ return (WINDOW_COPY_CMD_NOTHING);
+}
+
+static enum window_copy_cmd_action
+window_copy_cmd_rectangle_off(struct window_copy_cmd_state *cs)
+{
+ struct window_mode_entry *wme = cs->wme;
+ struct window_copy_mode_data *data = wme->data;
+
+ data->lineflag = LINE_SEL_NONE;
+ window_copy_rectangle_set(wme, 0);
+
+ return (WINDOW_COPY_CMD_NOTHING);
+}
+
static enum window_copy_cmd_action
window_copy_cmd_rectangle_toggle(struct window_copy_cmd_state *cs)
{
struct window_copy_mode_data *data = wme->data;
data->lineflag = LINE_SEL_NONE;
- window_copy_rectangle_toggle(wme);
+ window_copy_rectangle_set(wme, !data->rectflag);
return (WINDOW_COPY_CMD_NOTHING);
}
window_copy_cmd_previous_space },
{ "previous-word", 0, 0, WINDOW_COPY_CMD_CLEAR_EMACS_ONLY,
window_copy_cmd_previous_word },
+ { "rectangle-on", 0, 0, WINDOW_COPY_CMD_CLEAR_ALWAYS,
+ window_copy_cmd_rectangle_on },
+ { "rectangle-off", 0, 0, WINDOW_COPY_CMD_CLEAR_ALWAYS,
+ window_copy_cmd_rectangle_off },
{ "rectangle-toggle", 0, 0, WINDOW_COPY_CMD_CLEAR_ALWAYS,
window_copy_cmd_rectangle_toggle },
{ "refresh-from-pane", 0, 0, WINDOW_COPY_CMD_CLEAR_ALWAYS,
}
static void
-window_copy_rectangle_toggle(struct window_mode_entry *wme)
+window_copy_rectangle_set(struct window_mode_entry *wme, int rectflag)
{
struct window_copy_mode_data *data = wme->data;
u_int px, py;
- data->rectflag = !data->rectflag;
+ data->rectflag = rectflag;
py = screen_hsize(data->backing) + data->cy - data->oy;
px = window_copy_find_length(wme, py);