mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Keys in status line (p in vi mode, M-y in emacs) to paste the first line of the upper paste buffer. Suggested by Dan Colish.
This commit is contained in:
		
							
								
								
									
										4
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								CHANGES
									
									
									
									
									
								
							@@ -1,5 +1,7 @@
 | 
			
		||||
14 May 2009
 | 
			
		||||
 | 
			
		||||
* Keys in status line (p in vi mode, M-y in emacs) to paste the first line
 | 
			
		||||
  of the upper paste buffer. Suggested by Dan Colish.
 | 
			
		||||
* clear-history command to clear a pane's history.
 | 
			
		||||
* Don't force wrapping with \n when asked, let the cursor code figure it out.
 | 
			
		||||
  Should fix terminals which use this to detect line breaks.
 | 
			
		||||
@@ -1255,7 +1257,7 @@
 | 
			
		||||
  (including mutt, emacs). No status bar yet and no key remapping or other
 | 
			
		||||
  customisation.
 | 
			
		||||
 | 
			
		||||
$Id: CHANGES,v 1.287 2009-05-14 16:56:23 nicm Exp $
 | 
			
		||||
$Id: CHANGES,v 1.288 2009-05-14 19:36:56 nicm Exp $
 | 
			
		||||
 | 
			
		||||
 LocalWords:  showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
 | 
			
		||||
 LocalWords:  rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								mode-key.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								mode-key.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: mode-key.c,v 1.11 2009-05-04 17:58:27 nicm Exp $ */
 | 
			
		||||
/* $Id: mode-key.c,v 1.12 2009-05-14 19:36:56 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -54,6 +54,13 @@ mode_key_lookup(struct mode_key_data *mdata, int key)
 | 
			
		||||
enum mode_key_cmd
 | 
			
		||||
mode_key_lookup_vi(struct mode_key_data *mdata, int key)
 | 
			
		||||
{
 | 
			
		||||
	if (KEYC_ISESC(key)) {
 | 
			
		||||
		key = KEYC_REMOVEESC(key);
 | 
			
		||||
		if (mdata->flags & MODEKEY_CANEDIT)
 | 
			
		||||
			mdata->flags ^= MODEKEY_EDITMODE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (mdata->flags & MODEKEY_EDITMODE) {
 | 
			
		||||
		switch (key) {
 | 
			
		||||
		case '\003':
 | 
			
		||||
@@ -131,6 +138,8 @@ mode_key_lookup_vi(struct mode_key_data *mdata, int key)
 | 
			
		||||
	case 'k':
 | 
			
		||||
	case KEYC_UP:
 | 
			
		||||
		return (MODEKEYCMD_UP);
 | 
			
		||||
	case 'p':
 | 
			
		||||
		return (MODEKEYCMD_PASTE);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return (MODEKEYCMD_NONE);
 | 
			
		||||
@@ -173,6 +182,8 @@ mode_key_lookup_emacs(struct mode_key_data *mdata, int key)
 | 
			
		||||
		return (MODEKEYCMD_NEXTPAGE);
 | 
			
		||||
	case KEYC_ADDESC('f'):
 | 
			
		||||
		return (MODEKEYCMD_NEXTWORD);
 | 
			
		||||
	case '\031':
 | 
			
		||||
		return (MODEKEYCMD_PASTE);
 | 
			
		||||
	case KEYC_ADDESC('v'):
 | 
			
		||||
	case KEYC_PPAGE:
 | 
			
		||||
		return (MODEKEYCMD_PREVIOUSPAGE);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										30
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								status.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: status.c,v 1.79 2009-05-13 23:29:45 nicm Exp $ */
 | 
			
		||||
/* $Id: status.c,v 1.80 2009-05-14 19:36:56 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -673,9 +673,9 @@ status_prompt_redraw(struct client *c)
 | 
			
		||||
void
 | 
			
		||||
status_prompt_key(struct client *c, int key)
 | 
			
		||||
{
 | 
			
		||||
	char   *s, *first, *last;
 | 
			
		||||
	size_t	size, n, off, idx;
 | 
			
		||||
	char	word[64];
 | 
			
		||||
	struct paste_buffer	*pb;
 | 
			
		||||
	char   			*s, *first, *last, word[64];
 | 
			
		||||
	size_t			 size, n, off, idx;
 | 
			
		||||
 | 
			
		||||
	size = strlen(c->prompt_buffer);
 | 
			
		||||
	switch (mode_key_lookup(&c->prompt_mdata, key)) {
 | 
			
		||||
@@ -805,6 +805,28 @@ status_prompt_key(struct client *c, int key)
 | 
			
		||||
		c->prompt_index = strlen(c->prompt_buffer);
 | 
			
		||||
		c->flags |= CLIENT_STATUS;
 | 
			
		||||
		break;
 | 
			
		||||
	case MODEKEYCMD_PASTE:
 | 
			
		||||
		if ((pb = paste_get_top(&c->session->buffers)) == NULL)
 | 
			
		||||
			break;
 | 
			
		||||
		if ((last = strchr(pb->data, '\n')) == NULL)
 | 
			
		||||
			last = strchr(pb->data, '\0');
 | 
			
		||||
		n = last - pb->data;
 | 
			
		||||
 | 
			
		||||
		c->prompt_buffer = xrealloc(c->prompt_buffer, 1, size + n + 1);
 | 
			
		||||
		if (c->prompt_index == size) {
 | 
			
		||||
			memcpy(c->prompt_buffer + c->prompt_index, pb->data, n);
 | 
			
		||||
			c->prompt_index += n;
 | 
			
		||||
			c->prompt_buffer[c->prompt_index] = '\0';
 | 
			
		||||
		} else {
 | 
			
		||||
			memmove(c->prompt_buffer + c->prompt_index + n,
 | 
			
		||||
			    c->prompt_buffer + c->prompt_index,
 | 
			
		||||
			    size + 1 - c->prompt_index);
 | 
			
		||||
			memcpy(c->prompt_buffer + c->prompt_index, pb->data, n);
 | 
			
		||||
			c->prompt_index += n;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		c->flags |= CLIENT_STATUS;		
 | 
			
		||||
		break;
 | 
			
		||||
 	case MODEKEYCMD_CHOOSE:
 | 
			
		||||
		if (*c->prompt_buffer != '\0') {
 | 
			
		||||
			status_prompt_add_history(c);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: tmux.h,v 1.315 2009-05-14 16:56:23 nicm Exp $ */
 | 
			
		||||
/* $Id: tmux.h,v 1.316 2009-05-14 19:36:56 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -422,7 +422,7 @@ struct msg_resize_data {
 | 
			
		||||
 | 
			
		||||
/* Editing keys. */
 | 
			
		||||
enum mode_key_cmd {
 | 
			
		||||
	MODEKEYCMD_BACKSPACE,
 | 
			
		||||
	MODEKEYCMD_BACKSPACE = 0x1000,
 | 
			
		||||
	MODEKEYCMD_CHOOSE,
 | 
			
		||||
	MODEKEYCMD_CLEARSELECTION,
 | 
			
		||||
	MODEKEYCMD_COMPLETE,
 | 
			
		||||
@@ -435,6 +435,7 @@ enum mode_key_cmd {
 | 
			
		||||
	MODEKEYCMD_NEXTWORD,
 | 
			
		||||
	MODEKEYCMD_NONE,
 | 
			
		||||
	MODEKEYCMD_OTHERKEY,
 | 
			
		||||
	MODEKEYCMD_PASTE,
 | 
			
		||||
	MODEKEYCMD_PREVIOUSPAGE,
 | 
			
		||||
	MODEKEYCMD_PREVIOUSWORD,
 | 
			
		||||
	MODEKEYCMD_QUIT,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user