summaryrefslogtreecommitdiff
path: root/gramscii.c
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2019-07-22 13:54:48 +0100
committerKatolaZ <katolaz@freaknet.org>2019-07-22 13:54:48 +0100
commit557124afa12af33f8453f04beab1ebfbe1e7a593 (patch)
treeca39d73f22e29100ace697c5f492a485f3db7ca7 /gramscii.c
parentf73faa7a82282660413e4056486e452af61832c0 (diff)
change global movement commands -- g+[gGmhjkl]
Diffstat (limited to 'gramscii.c')
-rw-r--r--gramscii.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/gramscii.c b/gramscii.c
index 1a21350..0ca2291 100644
--- a/gramscii.c
+++ b/gramscii.c
@@ -273,6 +273,44 @@ void go_to(int where){
show_cursor();
}
+void handle_goto(){
+ char c;
+ c=getchar();
+ switch(c){
+ case 'h':
+ dir = DIR_L;
+ x = 0;
+ break;
+ case 'l':
+ dir = DIR_R;
+ x = WIDTH - 1;
+ break;
+ case 'j':
+ dir = DIR_D;
+ y = HEIGHT - 1;
+ break;
+ case 'k':
+ dir = DIR_U;
+ y = 0;
+ break;
+ case 'g':
+ dir = DIR_N;
+ go_to(HOME);
+ break;
+ case 'G':
+ dir = DIR_N;
+ go_to(END);
+ break;
+ case 'm':
+ dir = DIR_N;
+ go_to(MIDDLE);
+ break;
+ }
+ check_bound();
+ show_cursor();
+}
+
+
int move_around(char c){
switch(c){
@@ -297,16 +335,7 @@ int move_around(char c){
x += step;
break;
case 'g':
- dir = DIR_N;
- go_to(HOME);
- break;
- case 'G':
- dir = DIR_N;
- go_to(END);
- break;
- case 'm':
- dir = DIR_N;
- go_to(MIDDLE);
+ handle_goto();
break;
default:
return 0;