mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Skip over padding cells when moving the cursor left or right.
This commit is contained in:
		@@ -1921,14 +1921,22 @@ static void
 | 
			
		||||
window_copy_cursor_left(struct window_pane *wp)
 | 
			
		||||
{
 | 
			
		||||
	struct window_copy_mode_data	*data = wp->modedata;
 | 
			
		||||
	u_int				 py;
 | 
			
		||||
	u_int				 py, cx;
 | 
			
		||||
	struct grid_cell		 gc;
 | 
			
		||||
 | 
			
		||||
	py = screen_hsize(data->backing) + data->cy - data->oy;
 | 
			
		||||
	if (data->cx == 0 && py > 0) {
 | 
			
		||||
	cx = data->cx;
 | 
			
		||||
	while (cx > 0) {
 | 
			
		||||
		grid_get_cell(data->backing->grid, cx, py, &gc);
 | 
			
		||||
		if (~gc.flags & GRID_FLAG_PADDING)
 | 
			
		||||
			break;
 | 
			
		||||
		cx--;
 | 
			
		||||
	}
 | 
			
		||||
	if (cx == 0 && py > 0) {
 | 
			
		||||
		window_copy_cursor_up(wp, 0);
 | 
			
		||||
		window_copy_cursor_end_of_line(wp);
 | 
			
		||||
	} else if (data->cx > 0) {
 | 
			
		||||
		window_copy_update_cursor(wp, data->cx - 1, data->cy);
 | 
			
		||||
	} else if (cx > 0) {
 | 
			
		||||
		window_copy_update_cursor(wp, cx - 1, data->cy);
 | 
			
		||||
		if (window_copy_update_selection(wp, 1))
 | 
			
		||||
			window_copy_redraw_lines(wp, data->cy, 1);
 | 
			
		||||
	}
 | 
			
		||||
@@ -1938,21 +1946,29 @@ static void
 | 
			
		||||
window_copy_cursor_right(struct window_pane *wp)
 | 
			
		||||
{
 | 
			
		||||
	struct window_copy_mode_data	*data = wp->modedata;
 | 
			
		||||
	u_int				 px, py, yy;
 | 
			
		||||
	u_int				 px, py, yy, cx, cy;
 | 
			
		||||
	struct grid_cell		 gc;
 | 
			
		||||
 | 
			
		||||
	py = screen_hsize(data->backing) + data->cy - data->oy;
 | 
			
		||||
	yy = screen_hsize(data->backing) + screen_size_y(data->backing) - 1;
 | 
			
		||||
	if (data->screen.sel.flag && data->rectflag)
 | 
			
		||||
		px = screen_size_x(&data->screen);
 | 
			
		||||
	else {
 | 
			
		||||
	else
 | 
			
		||||
		px = window_copy_find_length(wp, py);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (data->cx >= px && py < yy) {
 | 
			
		||||
		window_copy_cursor_start_of_line(wp);
 | 
			
		||||
		window_copy_cursor_down(wp, 0);
 | 
			
		||||
	} else if (data->cx < px) {
 | 
			
		||||
		window_copy_update_cursor(wp, data->cx + 1, data->cy);
 | 
			
		||||
		cx = data->cx + 1;
 | 
			
		||||
		cy = screen_hsize(data->backing) + data->cy - data->oy;
 | 
			
		||||
		while (cx < px) {
 | 
			
		||||
			grid_get_cell(data->backing->grid, cx, cy, &gc);
 | 
			
		||||
			if (~gc.flags & GRID_FLAG_PADDING)
 | 
			
		||||
				break;
 | 
			
		||||
			cx++;
 | 
			
		||||
		}
 | 
			
		||||
		window_copy_update_cursor(wp, cx, data->cy);
 | 
			
		||||
		if (window_copy_update_selection(wp, 1))
 | 
			
		||||
			window_copy_redraw_lines(wp, data->cy, 1);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user