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; return;
sel = curr = next; sel = curr = next;
calcoffsets();
drawmenu(); drawmenu();
} }
@ -115,6 +114,17 @@ void moveprev(Arg *arg) {
drawmenu(); 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) { void movestart(Arg *arg) {
if (sel == matches) { if (sel == matches) {
cursor = 0; cursor = 0;

View file

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

View file

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

View file

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