File src/datatypes.h changed (mode: 100644) (index 90d86fe..36f803e) |
... |
... |
InfoHistory; |
68 |
68 |
|
|
69 |
69 |
typedef struct |
typedef struct |
70 |
70 |
{ |
{ |
71 |
|
int line; /* line number of the place where the link is */ |
|
72 |
|
int col; /* column number ----||---- */ |
|
|
71 |
|
unsigned line; /* line number of the place where the link is */ |
|
72 |
|
unsigned col; /* column number ----||---- */ |
73 |
73 |
int breakpos; /* col number, where the links breaks to next line */ |
int breakpos; /* col number, where the links breaks to next line */ |
74 |
74 |
int type; /* type of link: 0 - * menu::, |
int type; /* type of link: 0 - * menu::, |
75 |
75 |
1 - * Comment: menu. |
1 - * Comment: menu. |
|
... |
... |
extern SearchAgain searchagain; |
123 |
123 |
|
|
124 |
124 |
/* an array of references for info */ |
/* an array of references for info */ |
125 |
125 |
extern HyperObject *hyperobjects; |
extern HyperObject *hyperobjects; |
126 |
|
extern int hyperobjectcount; |
|
|
126 |
|
extern unsigned hyperobjectcount; |
127 |
127 |
/* an array of indirect entries [1 to n] */ |
/* an array of indirect entries [1 to n] */ |
128 |
128 |
extern Indirect *indirect; |
extern Indirect *indirect; |
129 |
129 |
/* number of indirect entries */ |
/* number of indirect entries */ |
130 |
|
extern int IndirectEntries; |
|
|
130 |
|
extern unsigned IndirectEntries; |
131 |
131 |
/* an array of tag table entries [1 to n] */ |
/* an array of tag table entries [1 to n] */ |
132 |
132 |
extern TagTable *tag_table; |
extern TagTable *tag_table; |
133 |
133 |
/* offset of the first node in info file */ |
/* offset of the first node in info file */ |
|
... |
... |
extern long FirstNodeOffset; |
135 |
135 |
/* name of the first node in info file */ |
/* name of the first node in info file */ |
136 |
136 |
extern char FirstNodeName[256]; |
extern char FirstNodeName[256]; |
137 |
137 |
/* number of tag table entries */ |
/* number of tag table entries */ |
138 |
|
extern int TagTableEntries; |
|
|
138 |
|
extern unsigned TagTableEntries; |
139 |
139 |
/* maximum dimensions of screen */ |
/* maximum dimensions of screen */ |
140 |
|
extern int maxx, maxy; |
|
|
140 |
|
extern unsigned int maxx, maxy; |
141 |
141 |
extern InfoHistory infohistory; |
extern InfoHistory infohistory; |
142 |
142 |
/* position to by set when moving via history */ |
/* position to by set when moving via history */ |
143 |
143 |
extern int npos; |
extern int npos; |
File src/initializelinks.c changed (mode: 100644) (index 3055a1c..7be051e) |
... |
... |
handlenote: |
487 |
487 |
*************************************************************************/ |
*************************************************************************/ |
488 |
488 |
/* make sure that we don't handle notes, which fit in the second line */ |
/* make sure that we don't handle notes, which fit in the second line */ |
489 |
489 |
/* Signed-unsigned issues FIXME */ |
/* Signed-unsigned issues FIXME */ |
490 |
|
if ((long)(notestart - buf) < strlen(line1)) |
|
|
490 |
|
if (notestart < buf + strlen(line1)) |
491 |
491 |
{ |
{ |
492 |
492 |
/* we can handle only those, who are in the first line, |
/* we can handle only those, who are in the first line, |
493 |
493 |
* or who are split up into two lines */ |
* or who are split up into two lines */ |
|
... |
... |
handlenote: |
513 |
513 |
end + 1, NodenameLen); |
end + 1, NodenameLen); |
514 |
514 |
hyperobjects[hyperobjectcount].node[NodenameLen] = 0; |
hyperobjects[hyperobjectcount].node[NodenameLen] = 0; |
515 |
515 |
hyperobjects[hyperobjectcount].type = 2; |
hyperobjects[hyperobjectcount].type = 2; |
516 |
|
if (notestart + 7 - buf < strlen(line1)) |
|
|
516 |
|
if (notestart + 7 < buf + strlen(line1)) |
517 |
517 |
{ |
{ |
518 |
518 |
hyperobjects[hyperobjectcount].line = line; |
hyperobjects[hyperobjectcount].line = line; |
519 |
519 |
hyperobjects[hyperobjectcount].col = calculate_len(buf, notestart + 7); |
hyperobjects[hyperobjectcount].col = calculate_len(buf, notestart + 7); |
520 |
520 |
/* if the note highlight fits int first line */ |
/* if the note highlight fits int first line */ |
521 |
|
if (tmp - buf < strlen(line1)) |
|
|
521 |
|
if (tmp < buf + strlen(line1)) |
522 |
522 |
{ |
{ |
523 |
523 |
/* we don't need to break highlighting |
/* we don't need to break highlighting |
524 |
524 |
* into several lines */ |
* into several lines */ |
|
... |
... |
handlenote: |
536 |
536 |
hyperobjects[hyperobjectcount].line = line + 1; |
hyperobjects[hyperobjectcount].line = line + 1; |
537 |
537 |
hyperobjects[hyperobjectcount].col = |
hyperobjects[hyperobjectcount].col = |
538 |
538 |
calculate_len(buf + strlen(line1), notestart + 7); |
calculate_len(buf + strlen(line1), notestart + 7); |
539 |
|
if (tmp - buf < strlen(line1)) /* as above */ |
|
|
539 |
|
if (tmp < buf + strlen(line1)) /* as above */ |
540 |
540 |
hyperobjects[hyperobjectcount].breakpos = -1; |
hyperobjects[hyperobjectcount].breakpos = -1; |
541 |
541 |
else if ((hyperobjects[hyperobjectcount].breakpos = |
else if ((hyperobjects[hyperobjectcount].breakpos = |
542 |
542 |
strlen(line1) - |
strlen(line1) - |
|
... |
... |
handlenote: |
565 |
565 |
strlen(hyperobjects[hyperobjectcount].node); |
strlen(hyperobjects[hyperobjectcount].node); |
566 |
566 |
hyperobjects[hyperobjectcount].filelen = |
hyperobjects[hyperobjectcount].filelen = |
567 |
567 |
strlen(hyperobjects[hyperobjectcount].file); |
strlen(hyperobjects[hyperobjectcount].file); |
568 |
|
if (notestart + 7 - buf < strlen(line1)) |
|
|
568 |
|
if (notestart + 7 < buf + strlen(line1)) |
569 |
569 |
{ |
{ |
570 |
570 |
hyperobjects[hyperobjectcount].line = line; |
hyperobjects[hyperobjectcount].line = line; |
571 |
571 |
hyperobjects[hyperobjectcount].col = |
hyperobjects[hyperobjectcount].col = |
572 |
572 |
calculate_len(buf, notestart + 7) - 1; |
calculate_len(buf, notestart + 7) - 1; |
573 |
573 |
/* if the note highlight fits int first line */ |
/* if the note highlight fits int first line */ |
574 |
|
if (tmp - buf < strlen(line1)) |
|
|
574 |
|
if (tmp < buf + strlen(line1)) |
575 |
575 |
{ |
{ |
576 |
576 |
/* we don't need to break highlighting into |
/* we don't need to break highlighting into |
577 |
577 |
* several lines */ |
* several lines */ |
|
... |
... |
handlenote: |
589 |
589 |
hyperobjects[hyperobjectcount].line = line + 1; |
hyperobjects[hyperobjectcount].line = line + 1; |
590 |
590 |
hyperobjects[hyperobjectcount].col = |
hyperobjects[hyperobjectcount].col = |
591 |
591 |
calculate_len(buf + strlen(line1), notestart + 7) - 1; |
calculate_len(buf + strlen(line1), notestart + 7) - 1; |
592 |
|
if (tmp - buf < strlen(line1)) /* as above */ |
|
|
592 |
|
if (tmp < buf + strlen(line1)) /* as above */ |
593 |
593 |
hyperobjects[hyperobjectcount].breakpos = -1; |
hyperobjects[hyperobjectcount].breakpos = -1; |
594 |
594 |
else if ((hyperobjects[hyperobjectcount].breakpos = |
else if ((hyperobjects[hyperobjectcount].breakpos = |
595 |
595 |
strlen(line1) |
strlen(line1) |
|
... |
... |
handlenote: |
646 |
646 |
end + 1, NodenameLen); |
end + 1, NodenameLen); |
647 |
647 |
hyperobjects[hyperobjectcount].node[NodenameLen] = 0; |
hyperobjects[hyperobjectcount].node[NodenameLen] = 0; |
648 |
648 |
hyperobjects[hyperobjectcount].type = 3; |
hyperobjects[hyperobjectcount].type = 3; |
649 |
|
if (start - buf < strlen(line1)) |
|
|
649 |
|
if (start < buf + strlen(line1)) |
650 |
650 |
{ |
{ |
651 |
651 |
hyperobjects[hyperobjectcount].line = line; |
hyperobjects[hyperobjectcount].line = line; |
652 |
652 |
hyperobjects[hyperobjectcount].col = |
hyperobjects[hyperobjectcount].col = |
653 |
653 |
calculate_len(buf, start); |
calculate_len(buf, start); |
654 |
|
if (dot - buf < strlen(line1)) |
|
|
654 |
|
if (dot < buf + strlen(line1)) |
655 |
655 |
{ |
{ |
656 |
656 |
/* if the note highlight fits in first line |
/* if the note highlight fits in first line |
657 |
657 |
* we don't need to break highlighting into |
* we don't need to break highlighting into |
|
... |
... |
handle_no_file_note_label: |
710 |
710 |
strlen(hyperobjects[hyperobjectcount].node); |
strlen(hyperobjects[hyperobjectcount].node); |
711 |
711 |
hyperobjects[hyperobjectcount].filelen = |
hyperobjects[hyperobjectcount].filelen = |
712 |
712 |
strlen(hyperobjects[hyperobjectcount].file); |
strlen(hyperobjects[hyperobjectcount].file); |
713 |
|
if (start - buf < strlen(line1)) |
|
|
713 |
|
if (start < buf + strlen(line1)) |
714 |
714 |
{ |
{ |
715 |
715 |
hyperobjects[hyperobjectcount].line = line; |
hyperobjects[hyperobjectcount].line = line; |
716 |
716 |
hyperobjects[hyperobjectcount].col = |
hyperobjects[hyperobjectcount].col = |
717 |
717 |
calculate_len(buf, start); |
calculate_len(buf, start); |
718 |
|
if (dot - buf < strlen(line1)) |
|
|
718 |
|
if (dot < buf + strlen(line1)) |
719 |
719 |
{ |
{ |
720 |
720 |
/* if the note highlight fits in first line |
/* if the note highlight fits in first line |
721 |
721 |
* we don't need to break highlighting into |
* we don't need to break highlighting into |
File src/mainfunction.c changed (mode: 100644) (index 774bb8f..d7a995d) |
... |
... |
work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) |
47 |
47 |
static WorkRVal rval = |
static WorkRVal rval = |
48 |
48 |
{0, 0}; |
{0, 0}; |
49 |
49 |
FILE *mypipe; |
FILE *mypipe; |
50 |
|
int i, fileoffset, j; |
|
|
50 |
|
int fileoffset; |
51 |
51 |
int indirectstart = -1; |
int indirectstart = -1; |
52 |
52 |
int cursorchanged = 0; |
int cursorchanged = 0; |
53 |
53 |
int key = 0; |
int key = 0; |
|
... |
... |
work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) |
76 |
76 |
#endif /* getmaxyx */ |
#endif /* getmaxyx */ |
77 |
77 |
/* free memory allocated previously by hypertext links */ |
/* free memory allocated previously by hypertext links */ |
78 |
78 |
freelinks(); |
freelinks(); |
79 |
|
for (i = 1; i < Lines; i++) /* initialize node-links for every line */ |
|
|
79 |
|
for (unsigned i = 1; i < Lines; i++) /* initialize node-links for every line */ |
80 |
80 |
{ |
{ |
81 |
81 |
initializelinks(Message[i], Message[i + 1], i); |
initializelinks(Message[i], Message[i + 1], i); |
82 |
82 |
} |
} |
|
... |
... |
work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) |
203 |
203 |
*/ |
*/ |
204 |
204 |
{ |
{ |
205 |
205 |
int digit_val = 1; |
int digit_val = 1; |
206 |
|
for (i = 0; token[i] != 0; i++) |
|
|
206 |
|
for (unsigned i = 0; token[i] != 0; i++) |
207 |
207 |
{ |
{ |
208 |
208 |
if (!isdigit(token[i])) |
if (!isdigit(token[i])) |
209 |
209 |
digit_val = 0; |
digit_val = 0; |
|
... |
... |
work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) |
243 |
243 |
mypipe = popen(token, "w"); /* open mypipe */ |
mypipe = popen(token, "w"); /* open mypipe */ |
244 |
244 |
if (mypipe != NULL) |
if (mypipe != NULL) |
245 |
245 |
{ |
{ |
246 |
|
for (i = 1; i <= Lines; i++) /* and flush the msg to stdin */ |
|
|
246 |
|
for (unsigned i = 1; i <= Lines; i++) /* and flush the msg to stdin */ |
247 |
247 |
fprintf(mypipe, "%s", Message[i]); |
fprintf(mypipe, "%s", Message[i]); |
248 |
248 |
pclose(mypipe); |
pclose(mypipe); |
249 |
249 |
getchar(); |
getchar(); |
|
... |
... |
work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) |
316 |
316 |
|
|
317 |
317 |
/* Calculate current info file offset... */ |
/* Calculate current info file offset... */ |
318 |
318 |
fileoffset = 0; |
fileoffset = 0; |
319 |
|
for (i = 1; i <= pos + 1; i++) /* count the length of curnode */ |
|
|
319 |
|
for (unsigned i = 1; i <= pos + 1; i++) /* count the length of curnode */ |
320 |
320 |
fileoffset += strlen(Message[i]); |
fileoffset += strlen(Message[i]); |
321 |
321 |
fileoffset += strlen(Type); /* add also header length */ |
fileoffset += strlen(Type); /* add also header length */ |
322 |
322 |
|
|
|
... |
... |
work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) |
333 |
333 |
long tokenpos; |
long tokenpos; |
334 |
334 |
long starttokenpos; |
long starttokenpos; |
335 |
335 |
long filelen; |
long filelen; |
336 |
|
for (j = indirectstart; j <= IndirectEntries; j++) |
|
|
336 |
|
for (int j = indirectstart; j <= (int) IndirectEntries; j++) |
337 |
337 |
{ |
{ |
338 |
338 |
fd = openinfo(indirect[j].filename, 1); /* get file |
fd = openinfo(indirect[j].filename, 1); /* get file |
339 |
339 |
* length. */ |
* length. */ |
|
... |
... |
work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) |
368 |
368 |
{ /* local scope for tmpvar */ |
{ /* local scope for tmpvar */ |
369 |
369 |
int tmpvar = 0; |
int tmpvar = 0; |
370 |
370 |
tag_table[0].offset = 0; |
tag_table[0].offset = 0; |
371 |
|
for (i = TagTableEntries; i >= 1; i--) |
|
|
371 |
|
for (unsigned i = TagTableEntries; i >= 1; i--) |
372 |
372 |
{ |
{ |
373 |
373 |
if ((tag_table[i].offset > tag_table[tmpvar].offset) && |
if ((tag_table[i].offset > tag_table[tmpvar].offset) && |
374 |
374 |
((tag_table[i].offset - indirect[j].offset + FirstNodeOffset) <= tokenpos)) |
((tag_table[i].offset - indirect[j].offset + FirstNodeOffset) <= tokenpos)) |
|
... |
... |
work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) |
462 |
462 |
{ /* local scope for tmpvar */ |
{ /* local scope for tmpvar */ |
463 |
463 |
int tmpvar = 0; |
int tmpvar = 0; |
464 |
464 |
tag_table[0].offset = 0; |
tag_table[0].offset = 0; |
465 |
|
for (i = TagTableEntries; i >= 1; i--) |
|
|
465 |
|
for (unsigned i = TagTableEntries; i >= 1; i--) |
466 |
466 |
{ |
{ |
467 |
467 |
if ((tag_table[i].offset > tag_table[tmpvar].offset) && |
if ((tag_table[i].offset > tag_table[tmpvar].offset) && |
468 |
468 |
(tag_table[i].offset <= tokenpos)) |
(tag_table[i].offset <= tokenpos)) |
|
... |
... |
work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos) |
582 |
582 |
|
|
583 |
583 |
} |
} |
584 |
584 |
/* scan for the token in the following lines. */ |
/* scan for the token in the following lines. */ |
585 |
|
for (i = pos + 1; i < Lines; i++) |
|
|
585 |
|
for (unsigned i = pos + 1; i < Lines; i++) |
586 |
586 |
{ |
{ |
587 |
587 |
tmp = xmalloc(strlen(Message[i]) + strlen(Message[i + 1]) + 2); |
tmp = xmalloc(strlen(Message[i]) + strlen(Message[i + 1]) + 2); |
588 |
588 |
/* |
/* |
|
... |
... |
skip_search: |
648 |
648 |
curs_set(0); |
curs_set(0); |
649 |
649 |
noecho(); |
noecho(); |
650 |
650 |
attrset(normal); |
attrset(normal); |
651 |
|
for (i = 1; i <= TagTableEntries; i++) |
|
|
651 |
|
for (unsigned i = 1; i <= TagTableEntries; i++) |
652 |
652 |
{ |
{ |
653 |
653 |
/* if the name was found in the tag table */ |
/* if the name was found in the tag table */ |
654 |
654 |
if (strcmp(token, tag_table[i].nodename) == 0) |
if (strcmp(token, tag_table[i].nodename) == 0) |
|
... |
... |
skip_search: |
820 |
820 |
* look if there's a cursor(link) pos available above, |
* look if there's a cursor(link) pos available above, |
821 |
821 |
* and if it is visible now. |
* and if it is visible now. |
822 |
822 |
*/ |
*/ |
823 |
|
for (i = cursor - 1; i >= 0; i--) |
|
|
823 |
|
for (int i = cursor - 1; i >= 0; i--) |
824 |
824 |
{ |
{ |
825 |
825 |
if ((hyperobjects[i].line >= pos) && |
if ((hyperobjects[i].line >= pos) && |
826 |
826 |
(hyperobjects[i].line < pos +(maxy - 1))) |
(hyperobjects[i].line < pos +(maxy - 1))) |
|
... |
... |
skip_search: |
840 |
840 |
if (pos > 1) /* lower the nodepos */ |
if (pos > 1) /* lower the nodepos */ |
841 |
841 |
pos--; |
pos--; |
842 |
842 |
/* and scan for a hyperlink in the new line */ |
/* and scan for a hyperlink in the new line */ |
843 |
|
for (i = 0; i < hyperobjectcount; i++) |
|
|
843 |
|
for (unsigned i = 0; i < hyperobjectcount; i++) |
844 |
844 |
{ |
{ |
845 |
845 |
if (hyperobjects[i].line == pos) |
if (hyperobjects[i].line == pos) |
846 |
846 |
{ |
{ |
|
... |
... |
skip_search: |
919 |
919 |
{ |
{ |
920 |
920 |
cursorchanged = 0; /* works similar to keys.up */ |
cursorchanged = 0; /* works similar to keys.up */ |
921 |
921 |
if (cursor < hyperobjectcount) |
if (cursor < hyperobjectcount) |
922 |
|
for (i = cursor + 1; i < hyperobjectcount; i++) |
|
|
922 |
|
for (unsigned i = cursor + 1; i < hyperobjectcount; i++) |
923 |
923 |
{ |
{ |
924 |
924 |
if ((hyperobjects[i].line >= pos) && |
if ((hyperobjects[i].line >= pos) && |
925 |
925 |
(hyperobjects[i].line < pos +(maxy - 2))) |
(hyperobjects[i].line < pos +(maxy - 2))) |
|
... |
... |
skip_search: |
936 |
936 |
{ |
{ |
937 |
937 |
if (pos <= Lines -(maxy - 2)) |
if (pos <= Lines -(maxy - 2)) |
938 |
938 |
pos++; |
pos++; |
939 |
|
for (i = cursor + 1; i < hyperobjectcount; i++) |
|
|
939 |
|
for (unsigned i = cursor + 1; i < hyperobjectcount; i++) |
940 |
940 |
{ |
{ |
941 |
941 |
if ((hyperobjects[i].line >= pos) && |
if ((hyperobjects[i].line >= pos) && |
942 |
942 |
(hyperobjects[i].line < pos +(maxy - 2))) |
(hyperobjects[i].line < pos +(maxy - 2))) |
|
... |
... |
skip_search: |
1071 |
1071 |
{ |
{ |
1072 |
1072 |
MEVENT mouse; |
MEVENT mouse; |
1073 |
1073 |
int done = 0; |
int done = 0; |
|
1074 |
|
|
1074 |
1075 |
getmouse(&mouse); |
getmouse(&mouse); |
|
1076 |
|
if (mouse.x<0 || mouse.y<0) /* should never happen, according to curses docs */ |
|
1077 |
|
continue; |
|
1078 |
|
|
|
1079 |
|
/* copy to unsigned vars to avoid all kinds of signed/unsigned comparison unpleasantness below */ |
|
1080 |
|
unsigned mouse_x = mouse.x; |
|
1081 |
|
unsigned mouse_y = mouse.x; |
|
1082 |
|
|
1075 |
1083 |
if (mouse.bstate == BUTTON1_CLICKED) |
if (mouse.bstate == BUTTON1_CLICKED) |
1076 |
1084 |
{ |
{ |
1077 |
|
if ((mouse.y > 0) &&(mouse.y < maxy - 1)) |
|
|
1085 |
|
if ((mouse_y > 0) &&(mouse_y < maxy - 1)) |
1078 |
1086 |
{ |
{ |
1079 |
|
for (i = cursor; i > 0; i--) |
|
|
1087 |
|
for (int i = cursor; i > 0; i--) |
1080 |
1088 |
{ |
{ |
1081 |
|
if (hyperobjects[i].line == mouse.y + pos - 1) |
|
|
1089 |
|
if (hyperobjects[i].line == mouse_y + pos - 1) |
1082 |
1090 |
{ |
{ |
1083 |
|
if (hyperobjects[i].col <= mouse.x - 1) |
|
|
1091 |
|
if (hyperobjects[i].col <= mouse_x - 1) |
1084 |
1092 |
{ |
{ |
1085 |
|
if (hyperobjects[i].col + strlen(hyperobjects[i].node) + strlen(hyperobjects[i].file) >= mouse.x - 1) |
|
|
1093 |
|
if (hyperobjects[i].col + strlen(hyperobjects[i].node) + strlen(hyperobjects[i].file) >= mouse_x - 1) |
1086 |
1094 |
{ |
{ |
1087 |
1095 |
if (hyperobjects[i].type < HIGHLIGHT) |
if (hyperobjects[i].type < HIGHLIGHT) |
1088 |
1096 |
{ |
{ |
|
... |
... |
skip_search: |
1095 |
1103 |
} |
} |
1096 |
1104 |
} |
} |
1097 |
1105 |
if (!done) |
if (!done) |
1098 |
|
for (i = cursor; i < hyperobjectcount; i++) |
|
|
1106 |
|
for (unsigned i = cursor; i < hyperobjectcount; i++) |
1099 |
1107 |
{ |
{ |
1100 |
|
if (hyperobjects[i].line == mouse.y + pos - 1) |
|
|
1108 |
|
if (hyperobjects[i].line == mouse_y + pos - 1) |
1101 |
1109 |
{ |
{ |
1102 |
|
if (hyperobjects[i].col <= mouse.x - 1) |
|
|
1110 |
|
if (hyperobjects[i].col <= mouse_x - 1) |
1103 |
1111 |
{ |
{ |
1104 |
|
if (hyperobjects[i].col + strlen(hyperobjects[i].node) + strlen(hyperobjects[i].file) >= mouse.x - 1) |
|
|
1112 |
|
if (hyperobjects[i].col + strlen(hyperobjects[i].node) + strlen(hyperobjects[i].file) >= mouse_x - 1) |
1105 |
1113 |
{ |
{ |
1106 |
1114 |
if (hyperobjects[i].type < HIGHLIGHT) |
if (hyperobjects[i].type < HIGHLIGHT) |
1107 |
1115 |
{ |
{ |
|
... |
... |
skip_search: |
1113 |
1121 |
} |
} |
1114 |
1122 |
} |
} |
1115 |
1123 |
} |
} |
1116 |
|
} /* end: if (mouse.y not on top/bottom line) */ |
|
1117 |
|
else if (mouse.y == 0) |
|
|
1124 |
|
} /* end: if (mouse_y not on top/bottom line) */ |
|
1125 |
|
else if (mouse_y == 0) |
1118 |
1126 |
ungetch(keys.up_1); |
ungetch(keys.up_1); |
1119 |
|
else if (mouse.y == maxy - 1) |
|
|
1127 |
|
else if (mouse_y == maxy - 1) |
1120 |
1128 |
ungetch(keys.down_1); |
ungetch(keys.down_1); |
1121 |
1129 |
} /* end: button clicked */ |
} /* end: button clicked */ |
1122 |
1130 |
if (mouse.bstate == BUTTON1_DOUBLE_CLICKED) |
if (mouse.bstate == BUTTON1_DOUBLE_CLICKED) |
1123 |
1131 |
{ |
{ |
1124 |
|
if ((mouse.y > 0) &&(mouse.y < maxy - 1)) |
|
|
1132 |
|
if ((mouse_y > 0) &&(mouse_y < maxy - 1)) |
1125 |
1133 |
{ |
{ |
1126 |
|
for (i = cursor; i >= 0; i--) |
|
|
1134 |
|
for (int i = cursor; i >= 0; i--) |
1127 |
1135 |
{ |
{ |
1128 |
|
if (hyperobjects[i].line == mouse.y + pos - 1) |
|
|
1136 |
|
if (hyperobjects[i].line == mouse_y + pos - 1) |
1129 |
1137 |
{ |
{ |
1130 |
|
if (hyperobjects[i].col <= mouse.x - 1) |
|
|
1138 |
|
if (hyperobjects[i].col <= mouse_x - 1) |
1131 |
1139 |
{ |
{ |
1132 |
|
if (hyperobjects[i].col + strlen(hyperobjects[i].node) + strlen(hyperobjects[i].file) >= mouse.x - 1) |
|
|
1140 |
|
if (hyperobjects[i].col + strlen(hyperobjects[i].node) + strlen(hyperobjects[i].file) >= mouse_x - 1) |
1133 |
1141 |
{ |
{ |
1134 |
1142 |
if (hyperobjects[i].type < HIGHLIGHT) |
if (hyperobjects[i].type < HIGHLIGHT) |
1135 |
1143 |
{ |
{ |
|
... |
... |
skip_search: |
1142 |
1150 |
} |
} |
1143 |
1151 |
} |
} |
1144 |
1152 |
if (!done) |
if (!done) |
1145 |
|
for (i = cursor; i < hyperobjectcount; i++) |
|
|
1153 |
|
for (unsigned i = cursor; i < hyperobjectcount; i++) |
1146 |
1154 |
{ |
{ |
1147 |
|
if (hyperobjects[i].line == mouse.y + pos - 1) |
|
|
1155 |
|
if (hyperobjects[i].line == mouse_y + pos - 1) |
1148 |
1156 |
{ |
{ |
1149 |
|
if (hyperobjects[i].col <= mouse.x - 1) |
|
|
1157 |
|
if (hyperobjects[i].col <= mouse_x - 1) |
1150 |
1158 |
{ |
{ |
1151 |
|
if (hyperobjects[i].col + strlen(hyperobjects[i].node) + strlen(hyperobjects[i].file) >= mouse.x - 1) |
|
|
1159 |
|
if (hyperobjects[i].col + strlen(hyperobjects[i].node) + strlen(hyperobjects[i].file) >= mouse_x - 1) |
1152 |
1160 |
{ |
{ |
1153 |
1161 |
if (hyperobjects[i].type < HIGHLIGHT) |
if (hyperobjects[i].type < HIGHLIGHT) |
1154 |
1162 |
{ |
{ |
|
... |
... |
skip_search: |
1162 |
1170 |
} |
} |
1163 |
1171 |
if (done) |
if (done) |
1164 |
1172 |
ungetch(keys.followlink_1); |
ungetch(keys.followlink_1); |
1165 |
|
} /* end: if (mouse.y not on top/bottom line) */ |
|
1166 |
|
else if (mouse.y == 0) |
|
|
1173 |
|
} /* end: if (mouse_y not on top/bottom line) */ |
|
1174 |
|
else if (mouse_y == 0) |
1167 |
1175 |
ungetch(keys.pgup_1); |
ungetch(keys.pgup_1); |
1168 |
|
else if (mouse.y == maxy - 1) |
|
|
1176 |
|
else if (mouse_y == maxy - 1) |
1169 |
1177 |
ungetch(keys.pgdn_1); |
ungetch(keys.pgdn_1); |
1170 |
1178 |
} /* end: button doubleclicked */ |
} /* end: button doubleclicked */ |
1171 |
1179 |
} |
} |
|
... |
... |
skip_search: |
1190 |
1198 |
void |
void |
1191 |
1199 |
next_infomenu() |
next_infomenu() |
1192 |
1200 |
{ |
{ |
1193 |
|
int i; |
|
1194 |
1201 |
if (hyperobjectcount == 0) |
if (hyperobjectcount == 0) |
1195 |
1202 |
{ |
{ |
1196 |
1203 |
infomenu = -1; |
infomenu = -1; |
1197 |
1204 |
return; |
return; |
1198 |
1205 |
} |
} |
1199 |
|
for (i = infomenu + 1; i < hyperobjectcount; i++) |
|
|
1206 |
|
for (unsigned i = infomenu + 1; i < hyperobjectcount; i++) |
1200 |
1207 |
{ |
{ |
1201 |
1208 |
if (hyperobjects[i].type <= 1) /* menu item */ |
if (hyperobjects[i].type <= 1) /* menu item */ |
1202 |
1209 |
{ |
{ |
|
... |
... |
next_infomenu() |
1210 |
1217 |
void |
void |
1211 |
1218 |
rescan_cursor() |
rescan_cursor() |
1212 |
1219 |
{ |
{ |
1213 |
|
int i; |
|
1214 |
|
for (i = 0; i < hyperobjectcount; i++) |
|
|
1220 |
|
for (unsigned i = 0; i < hyperobjectcount; i++) |
1215 |
1221 |
{ |
{ |
1216 |
1222 |
if ((hyperobjects[i].line >= pos) && |
if ((hyperobjects[i].line >= pos) && |
1217 |
1223 |
(hyperobjects[i].line < pos +(maxy - 2))) |
(hyperobjects[i].line < pos +(maxy - 2))) |
File src/manual.c changed (mode: 100644) (index c5a1423..aaca687) |
... |
... |
void printmanual(char **Message, long Lines); |
56 |
56 |
/* line by line stored manual */ |
/* line by line stored manual */ |
57 |
57 |
char **manual = 0; |
char **manual = 0; |
58 |
58 |
/* number of lines in manual */ |
/* number of lines in manual */ |
59 |
|
int ManualLines = 0; |
|
|
59 |
|
unsigned ManualLines = 0; |
60 |
60 |
int selected = -1; /* number of selected link(offset in 'manuallinks', |
int selected = -1; /* number of selected link(offset in 'manuallinks', |
61 |
61 |
bellow) */ |
bellow) */ |
62 |
|
int manualpos = 0; /* number of the first line, which is painted on |
|
|
62 |
|
unsigned manualpos = 0; /* number of the first line, which is painted on |
63 |
63 |
screen */ |
screen */ |
64 |
64 |
|
|
65 |
|
int manualcol = 0; /* the first displayed column of manpage-- |
|
|
65 |
|
unsigned manualcol = 0; /* the first displayed column of manpage-- |
66 |
66 |
for moving the screen left/right */ |
for moving the screen left/right */ |
67 |
67 |
|
|
68 |
68 |
int manual_aftersearch = 0; /* this is set if man page is now after search |
int manual_aftersearch = 0; /* this is set if man page is now after search |
|
... |
... |
int manualhistorylength = 0; |
94 |
94 |
/* this structure describes a hyperlink in manual viewer */ |
/* this structure describes a hyperlink in manual viewer */ |
95 |
95 |
typedef struct |
typedef struct |
96 |
96 |
{ /* struct for hypertext references */ |
{ /* struct for hypertext references */ |
97 |
|
int line; /* line of the manpage, where the reference is */ |
|
|
97 |
|
unsigned int line; /* line of the manpage, where the reference is */ |
98 |
98 |
/* column of that line */ |
/* column of that line */ |
99 |
|
int col; |
|
|
99 |
|
unsigned int col; |
100 |
100 |
/* name of the reference */ |
/* name of the reference */ |
101 |
101 |
char *name; |
char *name; |
102 |
102 |
/* section of the reference */ |
/* section of the reference */ |
|
... |
... |
manuallink; |
111 |
111 |
manuallink *manuallinks = 0; |
manuallink *manuallinks = 0; |
112 |
112 |
|
|
113 |
113 |
/* number of found manual references in man page */ |
/* number of found manual references in man page */ |
114 |
|
int ManualLinks = 0; |
|
|
114 |
|
unsigned ManualLinks = 0; |
115 |
115 |
|
|
116 |
116 |
/* semaphore for checking if it's a history(left arrow) call */ |
/* semaphore for checking if it's a history(left arrow) call */ |
117 |
117 |
int historical = 0; |
int historical = 0; |
|
... |
... |
void |
121 |
121 |
/* free buffers allocated by current man page */ |
/* free buffers allocated by current man page */ |
122 |
122 |
manual_free_buffers() |
manual_free_buffers() |
123 |
123 |
{ |
{ |
124 |
|
int i; |
|
|
124 |
|
unsigned int i; |
125 |
125 |
/* first free previously allocated memory */ |
/* first free previously allocated memory */ |
126 |
126 |
/* for the manual itself... */ |
/* for the manual itself... */ |
127 |
127 |
if (manual) |
if (manual) |
|
... |
... |
manualwork() |
907 |
907 |
/* key, which contains the value entered by user */ |
/* key, which contains the value entered by user */ |
908 |
908 |
int key = 0; |
int key = 0; |
909 |
909 |
/* tmp values */ |
/* tmp values */ |
910 |
|
int i, selectedchanged; |
|
|
910 |
|
int selectedchanged; |
911 |
911 |
int statusline = FREE; |
int statusline = FREE; |
912 |
912 |
#ifdef getmaxyx |
#ifdef getmaxyx |
913 |
913 |
/* if ncurses, get maxx and maxy */ |
/* if ncurses, get maxx and maxy */ |
|
... |
... |
manualwork() |
1030 |
1030 |
if (token) |
if (token) |
1031 |
1031 |
{ |
{ |
1032 |
1032 |
int digit_val = 1; |
int digit_val = 1; |
1033 |
|
for (i = 0; token[i] != 0; i++) |
|
|
1033 |
|
for (unsigned i = 0; token[i] != 0; i++) |
1034 |
1034 |
{ |
{ |
1035 |
1035 |
if (!isdigit(token[i])) |
if (!isdigit(token[i])) |
1036 |
1036 |
digit_val = 0; |
digit_val = 0; |
|
... |
... |
manualwork() |
1080 |
1080 |
if (mypipe != NULL) |
if (mypipe != NULL) |
1081 |
1081 |
{ |
{ |
1082 |
1082 |
/* and flush the msg to stdin */ |
/* and flush the msg to stdin */ |
1083 |
|
for (i = 0; i < ManualLines; i++) |
|
|
1083 |
|
for (unsigned i = 0; i < ManualLines; i++) |
1084 |
1084 |
fprintf(mypipe, "%s", manual[i]); |
fprintf(mypipe, "%s", manual[i]); |
1085 |
1085 |
pclose(mypipe); |
pclose(mypipe); |
1086 |
1086 |
} |
} |
|
... |
... |
manualwork() |
1156 |
1156 |
goto skip_search; |
goto skip_search; |
1157 |
1157 |
} |
} |
1158 |
1158 |
/* and search for it in all subsequential lines */ |
/* and search for it in all subsequential lines */ |
1159 |
|
for (i = manualpos + 1; i < ManualLines - 1; i++) |
|
|
1159 |
|
for (unsigned i = manualpos + 1; i < ManualLines - 1; i++) |
1160 |
1160 |
{ |
{ |
1161 |
1161 |
char *tmp; |
char *tmp; |
1162 |
1162 |
tmp = xmalloc(strlen(manual[i]) + strlen(manual[i + 1]) + 10); |
tmp = xmalloc(strlen(manual[i]) + strlen(manual[i + 1]) + 10); |
|
... |
... |
skip_search: |
1232 |
1232 |
* scan for a next visible one, which is above the |
* scan for a next visible one, which is above the |
1233 |
1233 |
* current. |
* current. |
1234 |
1234 |
*/ |
*/ |
1235 |
|
for (i = selected - 1; i >= 0; i--) |
|
|
1235 |
|
for (int i = selected - 1; i >= 0; i--) |
1236 |
1236 |
{ |
{ |
1237 |
1237 |
if ((manuallinks[i].line >= manualpos) && |
if ((manuallinks[i].line >= manualpos) && |
1238 |
1238 |
(manuallinks[i].line < manualpos +(maxy - 1))) |
(manuallinks[i].line < manualpos +(maxy - 1))) |
|
... |
... |
skip_search: |
1250 |
1250 |
if (manualpos >= 1) |
if (manualpos >= 1) |
1251 |
1251 |
manualpos--; |
manualpos--; |
1252 |
1252 |
/* and scan for selected again :) */ |
/* and scan for selected again :) */ |
1253 |
|
for (i = 0; i < ManualLinks; i++) |
|
|
1253 |
|
for (unsigned i = 0; i < ManualLinks; i++) |
1254 |
1254 |
{ |
{ |
1255 |
1255 |
if (manuallinks[i].line == manualpos) |
if (manuallinks[i].line == manualpos) |
1256 |
1256 |
{ |
{ |
|
... |
... |
skip_search: |
1264 |
1264 |
if ((key == keys.end_1) || |
if ((key == keys.end_1) || |
1265 |
1265 |
(key == keys.end_2)) |
(key == keys.end_2)) |
1266 |
1266 |
{ |
{ |
1267 |
|
manualpos = ManualLines -(maxy - 1); |
|
1268 |
|
if (manualpos < 0) |
|
|
1267 |
|
if (ManualLines < maxy - 1) |
1269 |
1268 |
manualpos = 0; |
manualpos = 0; |
|
1269 |
|
else |
|
1270 |
|
manualpos = ManualLines -(maxy - 1); |
|
1271 |
|
|
1270 |
1272 |
selected = ManualLinks - 1; |
selected = ManualLinks - 1; |
1271 |
1273 |
} |
} |
1272 |
1274 |
/*=====================================================*/ |
/*=====================================================*/ |
1273 |
1275 |
if ((key == keys.nextnode_1) || |
if ((key == keys.nextnode_1) || |
1274 |
1276 |
(key == keys.nextnode_2)) |
(key == keys.nextnode_2)) |
1275 |
1277 |
{ |
{ |
1276 |
|
for (i = manualpos + 1; i < ManualLines; i++) |
|
|
1278 |
|
for (unsigned i = manualpos + 1; i < ManualLines; i++) |
1277 |
1279 |
{ |
{ |
1278 |
1280 |
if (manual[i][1] == 8) |
if (manual[i][1] == 8) |
1279 |
1281 |
{ |
{ |
|
... |
... |
skip_search: |
1286 |
1288 |
if ((key == keys.prevnode_1) || |
if ((key == keys.prevnode_1) || |
1287 |
1289 |
(key == keys.prevnode_2)) |
(key == keys.prevnode_2)) |
1288 |
1290 |
{ |
{ |
1289 |
|
for (i = manualpos - 1; i > 0; i--) |
|
|
1291 |
|
for (unsigned i = manualpos - 1; i > 0; i--) |
1290 |
1292 |
{ |
{ |
1291 |
1293 |
if (manual[i][1] == 8) |
if (manual[i][1] == 8) |
1292 |
1294 |
{ |
{ |
|
... |
... |
skip_search: |
1344 |
1346 |
if ((key == keys.down_1) || (key == keys.down_2)) |
if ((key == keys.down_1) || (key == keys.down_2)) |
1345 |
1347 |
{ |
{ |
1346 |
1348 |
selectedchanged = 0; |
selectedchanged = 0; |
1347 |
|
if (selected < ManualLinks) |
|
1348 |
|
for (i = selected + 1; i < ManualLinks; i++) |
|
|
1349 |
|
for (unsigned i = selected + 1; i < ManualLinks; i++) |
|
1350 |
|
{ |
|
1351 |
|
if ((manuallinks[i].line >= manualpos) && |
|
1352 |
|
(manuallinks[i].line < manualpos +(maxy - 2))) |
|
1353 |
|
{ |
|
1354 |
|
selected = i; |
|
1355 |
|
selectedchanged = 1; |
|
1356 |
|
break; |
|
1357 |
|
} |
|
1358 |
|
} |
|
1359 |
|
if (!selectedchanged) |
|
1360 |
|
{ |
|
1361 |
|
if (manualpos < ManualLines -(maxy - 1)) |
|
1362 |
|
manualpos++; |
|
1363 |
|
for (unsigned i = selected + 1; i < ManualLinks; i++) |
1349 |
1364 |
{ |
{ |
1350 |
1365 |
if ((manuallinks[i].line >= manualpos) && |
if ((manuallinks[i].line >= manualpos) && |
1351 |
1366 |
(manuallinks[i].line < manualpos +(maxy - 2))) |
(manuallinks[i].line < manualpos +(maxy - 2))) |
|
... |
... |
skip_search: |
1355 |
1370 |
break; |
break; |
1356 |
1371 |
} |
} |
1357 |
1372 |
} |
} |
1358 |
|
if (!selectedchanged) |
|
1359 |
|
{ |
|
1360 |
|
if (manualpos < ManualLines -(maxy - 1)) |
|
1361 |
|
manualpos++; |
|
1362 |
|
if (selected < ManualLinks) |
|
1363 |
|
for (i = selected + 1; i < ManualLinks; i++) |
|
1364 |
|
{ |
|
1365 |
|
if ((manuallinks[i].line >= manualpos) && |
|
1366 |
|
(manuallinks[i].line < manualpos +(maxy - 2))) |
|
1367 |
|
{ |
|
1368 |
|
selected = i; |
|
1369 |
|
selectedchanged = 1; |
|
1370 |
|
break; |
|
1371 |
|
} |
|
1372 |
|
} |
|
1373 |
1373 |
} |
} |
1374 |
1374 |
} |
} |
1375 |
1375 |
/*=====================================================*/ |
/*=====================================================*/ |
|
... |
... |
skip_search: |
1448 |
1448 |
MEVENT mouse; |
MEVENT mouse; |
1449 |
1449 |
int done = 0; |
int done = 0; |
1450 |
1450 |
getmouse(&mouse); |
getmouse(&mouse); |
|
1451 |
|
if (mouse.x<0 || mouse.y<0) /* should never happen, according to curses docs */ |
|
1452 |
|
continue; |
|
1453 |
|
|
|
1454 |
|
/* copy to unsigned vars to avoid all kinds of signed/unsigned comparison unpleasantness below */ |
|
1455 |
|
unsigned mouse_x = mouse.x; |
|
1456 |
|
unsigned mouse_y = mouse.x; |
|
1457 |
|
|
1451 |
1458 |
if (mouse.bstate == BUTTON1_CLICKED) |
if (mouse.bstate == BUTTON1_CLICKED) |
1452 |
1459 |
{ |
{ |
1453 |
|
if ((mouse.y > 0) &&(mouse.y < maxy - 1)) |
|
|
1460 |
|
if ((mouse_y > 0) &&(mouse_y < maxy - 1)) |
1454 |
1461 |
{ |
{ |
1455 |
|
for (i = selected; i >= 0; i--) |
|
|
1462 |
|
for (int i = selected; i >= 0; i--) |
1456 |
1463 |
{ |
{ |
1457 |
|
if (manuallinks[i].line == mouse.y + manualpos - 1) |
|
|
1464 |
|
if (manuallinks[i].line == mouse_y + manualpos - 1) |
1458 |
1465 |
{ |
{ |
1459 |
|
if (manuallinks[i].col <= mouse.x - 1) |
|
|
1466 |
|
if (manuallinks[i].col <= mouse_x - 1) |
1460 |
1467 |
{ |
{ |
1461 |
|
if (manuallinks[i].col + strlen(manuallinks[i].name) >= mouse.x - 1) |
|
|
1468 |
|
if (manuallinks[i].col + strlen(manuallinks[i].name) >= mouse_x - 1) |
1462 |
1469 |
{ |
{ |
1463 |
1470 |
selected = i; |
selected = i; |
1464 |
1471 |
done = 1; |
done = 1; |
|
... |
... |
skip_search: |
1468 |
1475 |
} |
} |
1469 |
1476 |
} |
} |
1470 |
1477 |
if (!done) |
if (!done) |
1471 |
|
for (i = selected; i < ManualLinks; i++) |
|
|
1478 |
|
for (unsigned i = selected; i < ManualLinks; i++) |
1472 |
1479 |
{ |
{ |
1473 |
|
if (manuallinks[i].line == mouse.y + manualpos - 1) |
|
|
1480 |
|
if (manuallinks[i].line == mouse_y + manualpos - 1) |
1474 |
1481 |
{ |
{ |
1475 |
|
if (manuallinks[i].col <= mouse.x - 1) |
|
|
1482 |
|
if (manuallinks[i].col <= mouse_x - 1) |
1476 |
1483 |
{ |
{ |
1477 |
|
if (manuallinks[i].col + strlen(manuallinks[i].name) >= mouse.x - 1) |
|
|
1484 |
|
if (manuallinks[i].col + strlen(manuallinks[i].name) >= mouse_x - 1) |
1478 |
1485 |
{ |
{ |
1479 |
1486 |
selected = i; |
selected = i; |
1480 |
1487 |
done = 1; |
done = 1; |
|
... |
... |
skip_search: |
1484 |
1491 |
} |
} |
1485 |
1492 |
} |
} |
1486 |
1493 |
} /* end: mouse not on top/bottom line */ |
} /* end: mouse not on top/bottom line */ |
1487 |
|
if (mouse.y == 0) |
|
|
1494 |
|
if (mouse_y == 0) |
1488 |
1495 |
ungetch(keys.up_1); |
ungetch(keys.up_1); |
1489 |
|
if (mouse.y == maxy - 1) |
|
|
1496 |
|
if (mouse_y == maxy - 1) |
1490 |
1497 |
ungetch(keys.down_1); |
ungetch(keys.down_1); |
1491 |
1498 |
} /* end: button_clicked */ |
} /* end: button_clicked */ |
1492 |
1499 |
if (mouse.bstate == BUTTON1_DOUBLE_CLICKED) |
if (mouse.bstate == BUTTON1_DOUBLE_CLICKED) |
1493 |
1500 |
{ |
{ |
1494 |
|
if ((mouse.y > 0) &&(mouse.y < maxy - 1)) |
|
|
1501 |
|
if ((mouse_y > 0) &&(mouse_y < maxy - 1)) |
1495 |
1502 |
{ |
{ |
1496 |
|
for (i = selected; i >= 0; i--) |
|
|
1503 |
|
for (int i = selected; i >= 0; i--) |
1497 |
1504 |
{ |
{ |
1498 |
|
if (manuallinks[i].line == mouse.y + manualpos - 1) |
|
|
1505 |
|
if (manuallinks[i].line == mouse_y + manualpos - 1) |
1499 |
1506 |
{ |
{ |
1500 |
|
if (manuallinks[i].col <= mouse.x - 1) |
|
|
1507 |
|
if (manuallinks[i].col <= mouse_x - 1) |
1501 |
1508 |
{ |
{ |
1502 |
|
if (manuallinks[i].col + strlen(manuallinks[i].name) >= mouse.x - 1) |
|
|
1509 |
|
if (manuallinks[i].col + strlen(manuallinks[i].name) >= mouse_x - 1) |
1503 |
1510 |
{ |
{ |
1504 |
1511 |
selected = i; |
selected = i; |
1505 |
1512 |
done = 1; |
done = 1; |
|
... |
... |
skip_search: |
1509 |
1516 |
} |
} |
1510 |
1517 |
} |
} |
1511 |
1518 |
if (!done) |
if (!done) |
1512 |
|
for (i = selected; i < ManualLinks; i++) |
|
|
1519 |
|
for (unsigned i = selected; i < ManualLinks; i++) |
1513 |
1520 |
{ |
{ |
1514 |
|
if (manuallinks[i].line == mouse.y + manualpos - 1) |
|
|
1521 |
|
if (manuallinks[i].line == mouse_y + manualpos - 1) |
1515 |
1522 |
{ |
{ |
1516 |
|
if (manuallinks[i].col <= mouse.x - 1) |
|
|
1523 |
|
if (manuallinks[i].col <= mouse_x - 1) |
1517 |
1524 |
{ |
{ |
1518 |
|
if (manuallinks[i].col + strlen(manuallinks[i].name) >= mouse.x - 1) |
|
|
1525 |
|
if (manuallinks[i].col + strlen(manuallinks[i].name) >= mouse_x - 1) |
1519 |
1526 |
{ |
{ |
1520 |
1527 |
selected = i; |
selected = i; |
1521 |
1528 |
done = 1; |
done = 1; |
|
... |
... |
skip_search: |
1527 |
1534 |
if (done) |
if (done) |
1528 |
1535 |
ungetch(keys.followlink_1); |
ungetch(keys.followlink_1); |
1529 |
1536 |
} /* end: mouse not at top/bottom line */ |
} /* end: mouse not at top/bottom line */ |
1530 |
|
if (mouse.y == 0) |
|
|
1537 |
|
if (mouse_y == 0) |
1531 |
1538 |
ungetch(keys.pgup_1); |
ungetch(keys.pgup_1); |
1532 |
|
if (mouse.y == maxy - 1) |
|
|
1539 |
|
if (mouse_y == maxy - 1) |
1533 |
1540 |
ungetch(keys.pgdn_1); |
ungetch(keys.pgdn_1); |
1534 |
1541 |
} /* end: button doubleclicked */ |
} /* end: button doubleclicked */ |
1535 |
1542 |
} |
} |
|
... |
... |
void |
1555 |
1562 |
/* scan for some hyperlink, available on current screen */ |
/* scan for some hyperlink, available on current screen */ |
1556 |
1563 |
rescan_selected() |
rescan_selected() |
1557 |
1564 |
{ |
{ |
1558 |
|
int i; |
|
1559 |
|
for (i = 0; i < ManualLinks; i++) |
|
|
1565 |
|
for (unsigned i = 0; i < ManualLinks; i++) |
1560 |
1566 |
{ |
{ |
1561 |
1567 |
if ((manuallinks[i].line >= manualpos) && |
if ((manuallinks[i].line >= manualpos) && |
1562 |
1568 |
(manuallinks[i].line < manualpos +(maxy - 1))) |
(manuallinks[i].line < manualpos +(maxy - 1))) |
|
... |
... |
char *getmancolumn(char *man, int mancol) |
1584 |
1590 |
void |
void |
1585 |
1591 |
showmanualscreen() |
showmanualscreen() |
1586 |
1592 |
{ |
{ |
1587 |
|
int i; |
|
1588 |
1593 |
#ifdef getmaxyx |
#ifdef getmaxyx |
1589 |
1594 |
/* refresh maxy, maxx values */ |
/* refresh maxy, maxx values */ |
1590 |
1595 |
getmaxyx(stdscr, maxy, maxx); |
getmaxyx(stdscr, maxy, maxx); |
1591 |
1596 |
#endif |
#endif |
1592 |
1597 |
attrset(normal); |
attrset(normal); |
1593 |
1598 |
/* print all visible text lines */ |
/* print all visible text lines */ |
1594 |
|
for (i = manualpos;(i < manualpos +(maxy - 2)) &&(i < ManualLines); i++) |
|
|
1599 |
|
for (unsigned i = manualpos;(i < manualpos +(maxy - 2)) &&(i < ManualLines); i++) |
1595 |
1600 |
{ |
{ |
1596 |
|
int len = strlen(manual[i]); |
|
|
1601 |
|
size_t len = strlen(manual[i]); |
1597 |
1602 |
if (len) |
if (len) |
1598 |
1603 |
manual[i][len - 1] = ' '; |
manual[i][len - 1] = ' '; |
1599 |
1604 |
/* if we have something to display */ |
/* if we have something to display */ |
|
... |
... |
add_highlights() |
1734 |
1739 |
{ |
{ |
1735 |
1740 |
int i; |
int i; |
1736 |
1741 |
/* scan through the visible objects */ |
/* scan through the visible objects */ |
1737 |
|
for (i = 0; i < ManualLinks; i++) |
|
|
1742 |
|
for (i = 0; (unsigned) i < ManualLinks; i++) |
1738 |
1743 |
{ |
{ |
1739 |
1744 |
/* if the object is on the current screen */ |
/* if the object is on the current screen */ |
1740 |
1745 |
if ((manuallinks[i].line >= manualpos) && |
if ((manuallinks[i].line >= manualpos) && |
|
... |
... |
add_highlights() |
1754 |
1759 |
int x, y, ltline = manuallinks[i].line - 1; |
int x, y, ltline = manuallinks[i].line - 1; |
1755 |
1760 |
/* find the line, where starts the split link */ |
/* find the line, where starts the split link */ |
1756 |
1761 |
char *tmpstr = strdup(manual[ltline]); |
char *tmpstr = strdup(manual[ltline]); |
1757 |
|
int ltlinelen; |
|
|
1762 |
|
size_t ltlinelen; |
1758 |
1763 |
char *newlinemark; |
char *newlinemark; |
1759 |
1764 |
/* remove boldfaces&italics */ |
/* remove boldfaces&italics */ |
1760 |
1765 |
strip_manual(tmpstr); |
strip_manual(tmpstr); |