summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/main.c b/main.c
index 288c799..ed892b2 100644
--- a/main.c
+++ b/main.c
@@ -262,6 +262,24 @@ void draw(void *ctx) {
int motion(TxtLoc *lp, u32 c) {
TxtLoc l = *lp;
TxtLoc last_loc = l;
+ for (;;) {
+ switch (c) {
+ case '0':
+ if (!count) goto loop;
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ count = (count % 100000000) * 10 + c - '0';
+ break;
+ case KEY_ESC:
+ count = 0;
+ return 0;
+ default:
+ goto loop;
+ }
+ draw(NULL);
+ vui_blit();
+ c = vui_key();
+ }
loop:
switch (c) {
case KEY_LEFT:
@@ -490,16 +508,6 @@ int main(int argc, const char **argv) {
cur = txt_delete_c(cnext(cur));
mode = 1;
break;
- case '0':
- if (!count) {
- motion(&cur, c);
- break;
- }
- /* fallthrough */
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- count = (count % 100000000) * 10 + c - '0';
- break;
case 'M': {
TxtLoc start = prev_par(cur);
TxtLoc end = next_par(cur);