mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-26 04:30:27 +01:00
users/11419: zle copy-region-as-kill <string>
adds text to the kill ring
This commit is contained in:
parent
0d101890d0
commit
c6dfb2999d
7 changed files with 92 additions and 49 deletions
|
|
@ -337,14 +337,21 @@ killregion(UNUSED(char **args))
|
|||
|
||||
/**/
|
||||
int
|
||||
copyregionaskill(UNUSED(char **args))
|
||||
copyregionaskill(char **args)
|
||||
{
|
||||
if (mark > zlell)
|
||||
mark = zlell;
|
||||
if (mark > zlecs)
|
||||
cut(zlecs, mark - zlecs, 0);
|
||||
else
|
||||
cut(mark, zlecs - mark, 1);
|
||||
if (*args) {
|
||||
int len;
|
||||
ZLE_STRING_T line = stringaszleline(*args, 0, &len, NULL, NULL);
|
||||
cuttext(line, len, -1);
|
||||
free(line);
|
||||
} else {
|
||||
if (mark > zlell)
|
||||
mark = zlell;
|
||||
if (mark > zlecs)
|
||||
cut(zlecs, mark - zlecs, 0);
|
||||
else
|
||||
cut(mark, zlecs - mark, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue