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 | |
parent | f73faa7a82282660413e4056486e452af61832c0 (diff) |
change global movement commands -- g+[gGmhjkl]
-rw-r--r-- | TODO | 25 | ||||
-rw-r--r-- | gramscii.c | 49 |
2 files changed, 54 insertions, 20 deletions
@@ -1,27 +1,32 @@ + optimize redraws (i.e., avoid to redraw if possible) - move configs in config.h - add Makefile -- auto-arrow 'A' (automatic end-char) -- change screen management (i.e., use an array of lines) +- change screen management (i.e., dynamic array of lines) +- get screen geometry +- add action multiplier (e.g., "7h" moves left by 7 cols) +- use [ENTER] to confirm arrow, boxes, and text (useful for scripting) +- add scripting mode option ("-s"?) +- add screen geometry option (-g 25x80?) - read file at point - parse control characters - parse arrows (text-mode will allow movements as well) -- implement CTRL+G as abort (aside ESC) -- change "g" command: - - g-g (goto top-left) - - g-G (goto bottom-right) - - g-m (goto middle) - - g-[hjkl] (goto leftmost, bottom, top, rightmost) +- (?) implement CTRL+G as abort (aside ESC) +- add crop command (c) + visual selection - - crop + - crop-to - yank/put * fill * delete - undo (by storing lines changed across insert/remove operations) - manage special chars (DEL/CANC) during text insert (also do not print unmanaged chars!) -- get screen geometry - allow scrolling (both vertical and horizontal) +- auto-arrow 'A' (automatic end-char) +* change "g" command: + - g-g (goto top-left) + - g-G (goto bottom-right) + - g-m (goto middle) + - g-[hjkl] (goto leftmost, bottom, top, rightmost) * move style commands in a separate function (and allow style change in all the modes...) * add "vis" (for visual) in mode strings @@ -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; |