summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pamment <apamment@yandex.com>2019-01-05 07:42:15 +1000
committerAndrew Pamment <apamment@yandex.com>2019-01-05 07:42:15 +1000
commitf58852950fcce8e3f99281995982fe7fbdf22905 (patch)
treea308b7bcac2a9d9ea85aa19dabc8addb44bce49a
parent59a471e7e8e8500667b1f79d658643d7607dd896 (diff)
add area jump to file sub/dirsHEADmaster
-rw-r--r--src/files.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/files.c b/src/files.c
index adb92ea..d4472fa 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1486,6 +1486,7 @@ void choose_subdir() {
int selected = 0;
char c;
struct ptr_vector subs;
+ int area_jump = 0;
init_ptr_vector(&subs);
struct file_directory *dir = user_dir(gUser);
@@ -1525,6 +1526,7 @@ void choose_subdir() {
c = s_getchar();
if (c == 66) {
// down
+ area_jump = 0;
if (selected + 1 >= start + 22) {
start += 22;
if (start >= list_tmp) {
@@ -1544,6 +1546,7 @@ void choose_subdir() {
}
} else if (c == 65) {
// up
+ area_jump = 0;
if (selected - 1 < start) {
start -= 22;
if (start < 0) {
@@ -1563,6 +1566,7 @@ void choose_subdir() {
}
} else if (c == 75) {
// END KEY
+ area_jump = 0;
selected = list_tmp - 1;
start = list_tmp - 22;
if (start < 0) {
@@ -1571,6 +1575,7 @@ void choose_subdir() {
redraw = 1;
} else if (c == 72) {
// HOME KEY
+ area_jump = 0;
selected = 0;
start = 0;
redraw = 1;
@@ -1579,6 +1584,7 @@ void choose_subdir() {
s_getchar();
}
// PAGE UP
+ area_jump = 0;
selected = selected - 22;
if (selected < 0) {
selected = 0;
@@ -1590,6 +1596,7 @@ void choose_subdir() {
s_getchar();
}
// PAGE DOWN
+ area_jump = 0;
selected = selected + 22;
if (selected >= list_tmp) {
selected = list_tmp - 1;
@@ -1601,6 +1608,14 @@ void choose_subdir() {
} else if (c == 13) {
gUser->cur_file_sub = sub_tmp[selected]->index;
break;
+ } else if (c >= '0' || c <= '9') {
+ area_jump = area_jump * 10 + (c - '0');
+ selected = area_jump;
+ if (selected >= list_tmp) {
+ selected = list_tmp - 1;
+ }
+ start = selected;
+ redraw = 1;
}
}
@@ -1624,6 +1639,7 @@ void choose_directory() {
int selected = 0;
char c;
struct ptr_vector dirs;
+ int area_jump = 0;
init_ptr_vector(&dirs);
for (i = 0; i < ptr_vector_len(&conf.file_directories); i++) {
@@ -1662,6 +1678,7 @@ void choose_directory() {
c = s_getchar();
if (c == 66) {
// down
+ area_jump = 0;
if (selected + 1 >= start + 22) {
start += 22;
if (start >= list_tmp) {
@@ -1681,6 +1698,7 @@ void choose_directory() {
}
} else if (c == 65) {
// up
+ area_jump = 0;
if (selected - 1 < start) {
start -= 22;
if (start < 0) {
@@ -1700,6 +1718,7 @@ void choose_directory() {
}
} else if (c == 75) {
// END KEY
+ area_jump = 0;
selected = list_tmp - 1;
start = list_tmp - 22;
if (start < 0) {
@@ -1708,6 +1727,7 @@ void choose_directory() {
redraw = 1;
} else if (c == 72) {
// HOME KEY
+ area_jump = 0;
selected = 0;
start = 0;
redraw = 1;
@@ -1716,6 +1736,7 @@ void choose_directory() {
s_getchar();
}
// PAGE UP
+ area_jump = 0;
selected = selected - 22;
if (selected < 0) {
selected = 0;
@@ -1727,6 +1748,7 @@ void choose_directory() {
s_getchar();
}
// PAGE DOWN
+ area_jump = 0;
selected = selected + 22;
if (selected >= list_tmp) {
selected = list_tmp - 1;
@@ -1739,6 +1761,14 @@ void choose_directory() {
gUser->cur_file_dir = dir_tmp[selected]->index;
gUser->cur_file_sub = 0;
break;
+ } else if (c >= '0' || c <= '9') {
+ area_jump = area_jump * 10 + (c - '0');
+ selected = area_jump;
+ if (selected >= list_tmp) {
+ selected = list_tmp - 1;
+ }
+ start = selected;
+ redraw = 1;
}
}