diff options
author | KatolaZ <katolaz@freaknet.org> | 2019-07-22 13:54:48 +0100 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2019-07-22 13:54:48 +0100 |
commit | 557124afa12af33f8453f04beab1ebfbe1e7a593 (patch) | |
tree | ca39d73f22e29100ace697c5f492a485f3db7ca7 /gramscii.c | |
parent | f73faa7a82282660413e4056486e452af61832c0 (diff) |
change global movement commands -- g+[gGmhjkl]
Diffstat (limited to 'gramscii.c')
-rw-r--r-- | gramscii.c | 49 |
1 files changed, 39 insertions, 10 deletions
@@ -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; |