1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Ctrl-K also puts the deleted text to cutbuffer which can be recovered

with Ctrl-Y. /eval $U prints the cutbuffer.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@461 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-07-11 09:44:38 +00:00 committed by cras
parent 02495002e4
commit 767aadfb7f
3 changed files with 20 additions and 15 deletions

View File

@ -48,7 +48,7 @@ typedef struct {
static ENTRY_REDIRECT_REC *redir;
static char *savebuffer;
char *cutbuffer;
static int readtag, sigint_count = 0;
static time_t idle_time;
@ -199,15 +199,25 @@ void handle_key(int key)
case CTRL('u'):
/* Ctrl-U, clear line */
g_free_not_null(savebuffer);
savebuffer = g_strdup(gui_entry_get_text());
g_free_not_null(cutbuffer);
cutbuffer = g_strdup(gui_entry_get_text());
gui_entry_set_text("");
break;
case CTRL('k'):
/* C-K - erase the rest of the line */
c = gui_entry_get_pos();
g_free_not_null(cutbuffer);
cutbuffer = g_strdup(gui_entry_get_text()+c);
gui_entry_set_pos(strlen(gui_entry_get_text()));
gui_entry_erase(strlen(gui_entry_get_text()) - c);
break;
case CTRL('y'):
/* Ctrl-Y, write last ^U'd line */
if (savebuffer != NULL)
gui_entry_insert_text(savebuffer);
if (cutbuffer != NULL)
gui_entry_insert_text(cutbuffer);
break;
case 9:
key_pressed("Tab", NULL);
@ -232,13 +242,6 @@ void handle_key(int key)
}
break;
case CTRL('k'):
/* C-K - erase the rest of the line */
c = gui_entry_get_pos();
gui_entry_set_pos(strlen(gui_entry_get_text()));
gui_entry_erase(strlen(gui_entry_get_text()) - c);
break;
case 0:
/* Ctrl-space - ignore */
break;
@ -434,7 +437,7 @@ void gui_readline_init(void)
char *key, data[MAX_INT_STRLEN];
int n;
savebuffer = NULL;
cutbuffer = NULL;
redir = NULL;
idle_time = time(NULL);
readtag = g_input_add(0, G_INPUT_READ, (GInputFunction) readline, NULL);
@ -476,7 +479,7 @@ void gui_readline_init(void)
void gui_readline_deinit(void)
{
g_free_not_null(savebuffer);
g_free_not_null(cutbuffer);
g_source_remove(readtag);
key_unbind("completion", (SIGNAL_FUNC) sig_completion);

View File

@ -1,6 +1,8 @@
#ifndef __GUI_READLINE_H
#define __GUI_READLINE_H
extern char *cutbuffer;
void readline(void);
time_t get_idle_time(void);

View File

@ -43,7 +43,7 @@ static char *expando_inputline(void *server, void *item, int *free_ret)
/* FIXME: value of cutbuffer */
static char *expando_cutbuffer(void *server, void *item, int *free_ret)
{
return NULL;
return cutbuffer;
}
void gui_special_vars_init(void)