mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 16:46:18 +00:00 
			
		
		
		
	Add rectangle-on and rectangle-off copy mode commands, GitHub isse 2546
from author at will dot party.
This commit is contained in:
		
							
								
								
									
										2
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1657,6 +1657,8 @@ The following commands are supported in copy mode:
 | 
			
		||||
.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"
 | 
			
		||||
 
 | 
			
		||||
@@ -128,7 +128,7 @@ static void	window_copy_cursor_previous_word(struct window_mode_entry *,
 | 
			
		||||
		    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 *);
 | 
			
		||||
@@ -1625,6 +1625,30 @@ window_copy_cmd_previous_word(struct window_copy_cmd_state *cs)
 | 
			
		||||
	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)
 | 
			
		||||
{
 | 
			
		||||
@@ -1632,7 +1656,7 @@ 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);
 | 
			
		||||
}
 | 
			
		||||
@@ -2251,6 +2275,10 @@ static const struct {
 | 
			
		||||
	  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,
 | 
			
		||||
@@ -4726,12 +4754,12 @@ window_copy_scroll_down(struct window_mode_entry *wme, u_int ny)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user