mirror of https://github.com/MidnightCommander/mc
Ticket #2393 (no put removed text into clipboard)
no more put removed text into clipboard. when doing CK_InputKillWord, CK_InputBackwardKillWord Signed-off-by: Ilia Maslakov <il.smind@gmail.com> * WInput routines: get rid of one-line functions. * added CK_InputClearLine handler. Now CK_InputClearLine - clear command line, CK_InputKillLine - clear command line from cursor to the EOL. Signed-off-by: Andrew Borodin <aborodin@vmail.ru> Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
parent
52ea643784
commit
458cf7cf55
|
@ -253,6 +253,7 @@
|
|||
#define CK_InputKillRegion 4016
|
||||
#define CK_InputKillSave 4017
|
||||
#define CK_InputYank 4018
|
||||
#define CK_InputCopyRegion 4019
|
||||
#define CK_InputKillLine 4020
|
||||
#define CK_InputHistoryPrev 4021
|
||||
#define CK_InputHistoryNext 4022
|
||||
|
|
|
@ -491,7 +491,8 @@ static name_keymap_t command_names[] = {
|
|||
{ "InputHistoryNext", CK_InputHistoryNext },
|
||||
{ "InputHistoryShow", CK_InputHistoryShow },
|
||||
{ "InputComplete", CK_InputComplete },
|
||||
{ "InputXStore", CK_InputKillSave },
|
||||
{ "InputXCut", CK_InputKillSave },
|
||||
{ "InputXStore", CK_InputCopyRegion },
|
||||
{ "InputXPaste", CK_InputPaste },
|
||||
{ "InputClearLine", CK_InputClearLine },
|
||||
{ "InputLeftHighlight", CK_InputLeftHighlight },
|
||||
|
|
90
src/widget.c
90
src/widget.c
|
@ -1788,30 +1788,6 @@ backward_word (WInput * in)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
key_left (WInput * in)
|
||||
{
|
||||
backward_char (in);
|
||||
}
|
||||
|
||||
static void
|
||||
key_ctrl_left (WInput * in)
|
||||
{
|
||||
backward_word (in);
|
||||
}
|
||||
|
||||
static void
|
||||
key_right (WInput * in)
|
||||
{
|
||||
forward_char (in);
|
||||
}
|
||||
|
||||
static void
|
||||
key_ctrl_right (WInput * in)
|
||||
{
|
||||
forward_word (in);
|
||||
}
|
||||
|
||||
static void
|
||||
backward_delete (WInput * in)
|
||||
{
|
||||
|
@ -1878,7 +1854,6 @@ kill_word (WInput * in)
|
|||
new_point = in->point;
|
||||
in->point = old_point;
|
||||
|
||||
copy_region (in, old_point, new_point);
|
||||
delete_region (in, old_point, new_point);
|
||||
in->need_push = 1;
|
||||
in->charpoint = 0;
|
||||
|
@ -1895,36 +1870,10 @@ back_kill_word (WInput * in)
|
|||
new_point = in->point;
|
||||
in->point = old_point;
|
||||
|
||||
copy_region (in, old_point, new_point);
|
||||
delete_region (in, old_point, new_point);
|
||||
in->need_push = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
set_mark (WInput * in)
|
||||
{
|
||||
input_mark_cmd (in, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
kill_save (WInput * in)
|
||||
{
|
||||
copy_region (in, in->mark, in->point);
|
||||
}
|
||||
|
||||
static void
|
||||
kill_region (WInput * in)
|
||||
{
|
||||
kill_save (in);
|
||||
delete_region (in, in->point, in->mark);
|
||||
}
|
||||
|
||||
static void
|
||||
clear_region (WInput * in)
|
||||
{
|
||||
delete_region (in, in->point, in->mark);
|
||||
}
|
||||
|
||||
static void
|
||||
yank (WInput * in)
|
||||
{
|
||||
|
@ -1949,6 +1898,17 @@ kill_line (WInput * in)
|
|||
in->charpoint = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
clear_line (WInput * in)
|
||||
{
|
||||
in->need_push = 1;
|
||||
in->buffer[0] = '\0';
|
||||
in->point = 0;
|
||||
in->mark = 0;
|
||||
in->highlight = FALSE;
|
||||
in->charpoint = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ins_from_clip (WInput * in)
|
||||
{
|
||||
|
@ -2075,19 +2035,19 @@ input_execute_cmd (WInput * in, unsigned long command)
|
|||
break;
|
||||
case CK_InputMoveLeft:
|
||||
case CK_InputLeftHighlight:
|
||||
key_left (in);
|
||||
backward_char (in);
|
||||
break;
|
||||
case CK_InputWordLeft:
|
||||
case CK_InputWordLeftHighlight:
|
||||
key_ctrl_left (in);
|
||||
backward_word (in);
|
||||
break;
|
||||
case CK_InputMoveRight:
|
||||
case CK_InputRightHighlight:
|
||||
key_right (in);
|
||||
forward_char (in);
|
||||
break;
|
||||
case CK_InputWordRight:
|
||||
case CK_InputWordRightHighlight:
|
||||
key_ctrl_right (in);
|
||||
forward_word (in);
|
||||
break;
|
||||
case CK_InputBackwardChar:
|
||||
backward_char (in);
|
||||
|
@ -2132,16 +2092,25 @@ input_execute_cmd (WInput * in, unsigned long command)
|
|||
back_kill_word (in);
|
||||
break;
|
||||
case CK_InputSetMark:
|
||||
set_mark (in);
|
||||
input_mark_cmd (in, TRUE);
|
||||
break;
|
||||
case CK_InputKillRegion:
|
||||
kill_region (in);
|
||||
delete_region (in, in->point, in->mark);
|
||||
break;
|
||||
case CK_InputKillLine:
|
||||
/* clear command line from cursor to the EOL */
|
||||
kill_line (in);
|
||||
break;
|
||||
case CK_InputClearLine:
|
||||
clear_region (in);
|
||||
/* clear command line */
|
||||
clear_line (in);
|
||||
break;
|
||||
case CK_InputCopyRegion:
|
||||
copy_region (in, in->mark, in->point);
|
||||
break;
|
||||
case CK_InputKillSave:
|
||||
kill_save (in);
|
||||
copy_region (in, in->mark, in->point);
|
||||
delete_region (in, in->point, in->mark);
|
||||
break;
|
||||
case CK_InputYank:
|
||||
yank (in);
|
||||
|
@ -2149,9 +2118,6 @@ input_execute_cmd (WInput * in, unsigned long command)
|
|||
case CK_InputPaste:
|
||||
ins_from_clip (in);
|
||||
break;
|
||||
case CK_InputKillLine:
|
||||
kill_line (in);
|
||||
break;
|
||||
case CK_InputHistoryPrev:
|
||||
hist_prev (in);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue