add function for clear that also puts you in insert mode

This commit is contained in:
speedie 2023-03-26 20:34:41 +02:00
parent 04b46313ef
commit fa82afad48
3 changed files with 21 additions and 0 deletions

View file

@ -83,6 +83,7 @@ static Key keys[] = {
{ 0, CONTROL, XK_k, restoresel, {0} }, { 0, CONTROL, XK_k, restoresel, {0} },
{ 0, CONTROL|SHIFT, XK_h, viewhist, {0} }, { 0, CONTROL|SHIFT, XK_h, viewhist, {0} },
{ 0, 0, XK_d, clear, {0} }, { 0, 0, XK_d, clear, {0} },
{ 0, 0, XK_c, clearins, {0} },
{ 0, 0, XK_Escape, quit, {0} }, { 0, 0, XK_Escape, quit, {0} },
{ 0, 0, XK_Home, movestart, {0} }, { 0, 0, XK_Home, movestart, {0} },
{ 0, 0, XK_End, moveend, {0} }, { 0, 0, XK_End, moveend, {0} },

View file

@ -322,6 +322,25 @@ clear(const Arg *arg)
drawmenu(); drawmenu();
} }
void
clearins(const Arg *arg)
{
insert(NULL, 0 - cursor);
curMode = 1;
allowkeys = 0;
if (!curMode) {
strcpy(modetext, normtext);
} else {
strcpy(modetext, instext);
}
if (hidemode) strcpy(modetext, "");
drawmenu();
}
void void
quit(const Arg *arg) quit(const Arg *arg)
{ {

View file

@ -17,6 +17,7 @@ static void moveprev(const Arg *arg);
static void paste(const Arg *arg); static void paste(const Arg *arg);
static void restoresel(const Arg *arg); static void restoresel(const Arg *arg);
static void clear(const Arg *arg); static void clear(const Arg *arg);
static void clearins(const Arg *arg);
static void viewhist(const Arg *arg); static void viewhist(const Arg *arg);
static void moveword(const Arg *arg); static void moveword(const Arg *arg);
static void deleteword(const Arg *arg); static void deleteword(const Arg *arg);