summaryrefslogtreecommitdiff
path: root/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/screen.c b/screen.c
index 28d2318..0ef1f69 100644
--- a/screen.c
+++ b/screen.c
@@ -301,6 +301,24 @@ void handle_goto(FILE *fc, char global){
go_to(MIDDLE);
} else step = 0;
break;
+ case '\'':
+ c = tolower(fgetc(fc));
+ if (global) {
+ dir = DIR_N;
+ if (isalpha(c) && mark_map[c - 'a']){
+ x = marks[c - 'a'].x;
+ y = marks[c - 'a'].y;
+#ifdef DEBUG
+ fprintf(stderr, "going to valid mark '%c' (%d, %d)\n", c, x, y);
+#endif
+ }
+#ifdef DEBUG
+ else
+ fprintf(stderr, "invalid mark '%c'\n", c);
+#endif
+ } else step = 0;
+ break;
+
}
#ifdef DEBUG
@@ -435,20 +453,23 @@ void init_screen(){
for (i=0; i<HEIGHT; i++){
alloc_line(&(screen.l[i]));
}
+ /* init markers */
hlines_sz= sizeof(hlines) -1;
vlines_sz= sizeof(vlines) -1;
corners_sz = sizeof(corners) -1;
stmarks_sz = sizeof(st_marks) - 1;
endmarks_sz = sizeof(st_marks) - 1;
reset_styles();
+ /* init undo ring */
cutbuf.sz = 0;
cutbuf.l = NULL;
cutbuf.num = 0;
-
undo = NULL;
undo_sz = 0;
undo_cur = -2;
undo_lst = -2;
+ /* init pos marks */
+ memset(mark_map, 0, 26 * sizeof(char));
}
void find_nonblank_rect(int *x1, int *y1, int *x2, int *y2){
@@ -507,4 +528,18 @@ void crop_to_nonblank(){
redraw();
}
+/** position marks **/
+void mark_pos(FILE *fc){
+
+ char c;
+ c = tolower(fgetc(fc));
+ if (isalpha(c)){
+ marks[c - 'a'].x = x;
+ marks[c - 'a'].y = y;
+ mark_map[c - 'a'] = 1;
+#ifdef DEBUG
+ fprintf(stderr, "marking pos (%d, %d) as '%c'\n", x, y, c);
+#endif
+ }
+}