diff options
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | TODO | 4 | ||||
| -rw-r--r-- | config.h | 16 | ||||
| -rw-r--r-- | gramscii.c | 20 | 
4 files changed, 28 insertions, 15 deletions
| @@ -3,6 +3,7 @@  include config.mk  SRC = gramscii.c +INCLUDES = config.h  all: options gramscii @@ -14,6 +15,6 @@ options:  	@echo "-+-+-+-+-+-+-+-+-+-+-"  -gramscii: +gramscii: $(SRC) $(INCLUDES)  	$(CC) $(CFLAGS) -o $@ $(SRC) @@ -1,5 +1,4 @@ -+ optimize redraws (i.e., avoid to redraw if possible) -- move configs in config.h ++ optimize redraws (redraw only the modified rectangle)  - change screen management (i.e., dynamic array of lines)  - add action multiplier (e.g., "7h" moves left by 7 cols)  - add scripting mode option ("-s"?) @@ -25,6 +24,7 @@  - catch SIGWINCH and react appropriately (after scroll is     enabled)  - auto-arrow 'A' (automatic end-char) +* move configs in config.h  * get screen geometry  * allow the use of [ENTER] to confirm arrow, boxes (useful    for scripting) diff --git a/config.h b/config.h new file mode 100644 index 0000000..d38488b --- /dev/null +++ b/config.h @@ -0,0 +1,16 @@ +/* Config options */ + +/** MARKERS -- the first character is the default one **/ +/* markers for horizontal lines */ +char hlines[]  = {"-~=#*@._ "}; +/* markers for vertical lines */ +char vlines[]  = {"|H#*@:;i "}; +/* markers for corners */ +char corners[] = {"+'H#*@.\"`"}; +/* markers for arrow start points */ +char st_marks[] = {"+o-|<>^v*"}; +/* markers for arrow endpoints */ +char end_marks[] = {">+o-|<^v*"}; + +/** LONG_STEP (movements through uppercase HJKL) **/ +#define LONG_STEP 5 @@ -12,6 +12,8 @@  #include <string.h>  #include <sys/ioctl.h> +#include "config.h" +  #define MOVE   0x00  #define BOX    0x01  #define ARROW  0x02 @@ -40,7 +42,6 @@  #define ARR_U     '^'  #define ARR_D     'v' -  #define HOME   0x01  #define END    0x02  #define MIDDLE 0x04 @@ -51,7 +52,7 @@  #define MIN(x,y)  (x) < (y) ? (x) : (y)  #define MAX(x,y)  (x) > (y) ? (x) : (y) -#define DEBUG 1 +/** #define DEBUG 1 **/  char **screen;  int WIDTH, HEIGHT; @@ -64,11 +65,6 @@ int step;  int force_new;  char cursor;  char corner; -char hlines[]  = {"-~=#@._ "}; -char vlines[]  = {"|H#@:;i "}; -char corners[] = {"+'H#@.\""}; -char st_marks[] = {"+o-|<>^v"}; -char end_marks[] = {">+o-|<^v"};  int hlines_sz= sizeof(hlines) -1;  int vlines_sz= sizeof(vlines) -1; @@ -308,22 +304,22 @@ void handle_goto(){  int move_around(char c){  	switch(c){ -		case 'H': step = 5;/** FALLTHROUGH **/ +		case 'H': step = LONG_STEP;/** FALLTHROUGH **/  		case 'h':  			dir = DIR_L;  			x -= step;  			break; -		case 'J': step = 5;/** FALLTHROUGH **/ +		case 'J': step = LONG_STEP;/** FALLTHROUGH **/  		case 'j':  			dir = DIR_D;  			y += step;  			break; -		case 'K': step = 5;/** FALLTHROUGH **/ +		case 'K': step = LONG_STEP;/** FALLTHROUGH **/  		case 'k':  			dir = DIR_U;  			y -= step;  			break; -		case 'L': step = 5;/** FALLTHROUGH **/ +		case 'L': step = LONG_STEP;/** FALLTHROUGH **/  		case 'l':  			dir = DIR_R;  			x += step; @@ -687,7 +683,7 @@ void load_file(){  void new_file(){  	check_modified();  	erase_screen(); -	go_to(MIDDLE); +	go_to(HOME);  	redraw();  	fname[0] = '\0';  	modified=0; | 
