forked from speedie/spmenu
code cleanup, add moveitem function
This commit is contained in:
parent
06fe388033
commit
0258974bf0
12
libs/arg.c
12
libs/arg.c
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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 },
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue