mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Make C-space toggle. Fix sel on same line.
This commit is contained in:
		
							
								
								
									
										23
									
								
								screen.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								screen.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: screen.c,v 1.38 2007-11-22 19:17:01 nicm Exp $ */
 | 
					/* $Id: screen.c,v 1.39 2007-11-22 19:26:20 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -126,7 +126,10 @@ screen_resize(struct screen *s, u_int sx, u_int sy)
 | 
				
			|||||||
	 * X dimension.
 | 
						 * X dimension.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (sx != ox) {
 | 
						if (sx != ox) {
 | 
				
			||||||
		/* If getting smaller, nuke any data in lines over the new size. */
 | 
							/* 
 | 
				
			||||||
 | 
							 * If getting smaller, nuke any data in lines over the new
 | 
				
			||||||
 | 
							 * size.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
		if (sx < ox) {
 | 
							if (sx < ox) {
 | 
				
			||||||
			for (i = s->hsize; i < s->hsize + oy; i++) {
 | 
								for (i = s->hsize; i < s->hsize + oy; i++) {
 | 
				
			||||||
				if (s->grid_size[i] > sx)
 | 
									if (s->grid_size[i] > sx)
 | 
				
			||||||
@@ -305,11 +308,23 @@ screen_check_selection(struct screen_draw_ctx *ctx, u_int px, u_int py)
 | 
				
			|||||||
		sel->ex = xx;
 | 
							sel->ex = xx;
 | 
				
			||||||
		sel->ey = yy;
 | 
							sel->ey = yy;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if (sel->sy == sel->ey && sel->ex < sel->sx) {
 | 
				
			||||||
 | 
							xx = sel->sx;
 | 
				
			||||||
 | 
							sel->sx = sel->ex;
 | 
				
			||||||
 | 
							sel->ex = xx;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (py < sel->sy || py > sel->ey)
 | 
						if (py < sel->sy || py > sel->ey)
 | 
				
			||||||
		return (0);
 | 
							return (0);
 | 
				
			||||||
	if ((py == sel->sy && px < sel->sx) || (py == sel->ey && px > sel->ex))
 | 
						if (py == sel->sy && py == sel->ey) {
 | 
				
			||||||
		return (0);
 | 
							if (px < sel->sx || px > sel->ex)
 | 
				
			||||||
 | 
								return (0);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							if (py == sel->sy && px < sel->sx)
 | 
				
			||||||
 | 
								return (0);
 | 
				
			||||||
 | 
							if (py == sel->ey && px > sel->ex)
 | 
				
			||||||
 | 
								return (0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return (1);
 | 
						return (1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: window-copy.c,v 1.2 2007-11-22 19:17:01 nicm Exp $ */
 | 
					/* $Id: window-copy.c,v 1.3 2007-11-22 19:26:20 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -184,7 +184,7 @@ window_copy_key(struct window *w, int key)
 | 
				
			|||||||
			data->oy -= sy;
 | 
								data->oy -= sy;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case '\000':	/* C-space */
 | 
						case '\000':	/* C-space */
 | 
				
			||||||
		data->sel.flag = 1;
 | 
							data->sel.flag = !data->sel.flag;
 | 
				
			||||||
		data->sel.sx = data->cx + data->ox;
 | 
							data->sel.sx = data->cx + data->ox;
 | 
				
			||||||
		data->sel.sy = data->size + data->cy - data->oy;
 | 
							data->sel.sy = data->size + data->cy - data->oy;
 | 
				
			||||||
		oy = -1;	/* XXX */
 | 
							oy = -1;	/* XXX */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user