code cleanup, add moveitem function

This commit is contained in:
speedie 2023-05-22 16:35:57 +02:00
parent 06fe388033
commit 0258974bf0
4 changed files with 15 additions and 4 deletions

View file

@ -102,7 +102,6 @@ void movenext(Arg *arg) {
return;
sel = curr = next;
calcoffsets();
drawmenu();
}
@ -115,6 +114,17 @@ void moveprev(Arg *arg) {
drawmenu();
}
void moveitem(Arg *arg) {
for (int i = 0; i < arg->i; i++) {
if (sel && sel->right && (sel = sel->right) == next) {
curr = next;
calcoffsets();
}
}
drawmenu();
}
void movestart(Arg *arg) {
if (sel == matches) {
cursor = 0;

View file

@ -16,6 +16,7 @@ static void moveend(Arg *arg);
static void movestart(Arg *arg);
static void movenext(Arg *arg);
static void moveprev(Arg *arg);
static void moveitem(Arg *arg);
static void paste(Arg *arg);
static void restoresel(Arg *arg);
static void clear(Arg *arg);

View file

@ -335,8 +335,9 @@ static FuncList fl[] = {
{ "moveright", moveright },
{ "moveend", moveend },
{ "movestart", movestart },
{ "move", movenext },
{ "move", moveprev },
{ "movenext", movenext },
{ "moveprev", moveprev },
{ "moveitem", moveitem },
{ "paste", paste },
{ "pastesel", paste },
{ "restoresel", restoresel },

View file

@ -157,7 +157,6 @@ void match(void) {
for (i = 0; i < preselected; i++) {
if (sel && sel->right && (sel = sel->right) == next) {
curr = next;
calcoffsets();
}
}