commit c853d37eefabe23e2870a4a8a77248a6ce3483ca
parent 7b0cea98db98a4fdf58666eb46bdba47dc0ad936
Author: ukai <ukai>
Date: Fri, 23 Nov 2001 21:22:02 +0000
add label_topline
Diffstat:
5 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,11 @@
2001-11-24 Fumitoshi UKAI <ukai@debian.or.jp
+ * fm.h (label_topline): runtime option label_topline
+ * file.c (loadGeneralFile): ditto
+ * main.c (loadLink): ditto
+ * rc.c (CMT_LABEL_TOPLINE): ditto
+ * rc.c (params3): ditto
+
* fm.h (vi_prec_num): runtime option vi_prec_num
* main.c (pgFore): ditto
* main.c (pgBack): ditto
diff --git a/file.c b/file.c
@@ -1319,18 +1319,20 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
b->type = "text/plain";
if (pu.label) {
if (proc == loadHTMLBuffer) {
- Anchor *a;
+ Anchor *a;
#ifdef JP_CHARSET
- a = searchURLLabel(b, conv(pu.label, b->document_code, InnerCode)->ptr);
+ a = searchURLLabel(b, conv(pu.label, b->document_code, InnerCode)->ptr);
#else /* not JP_CHARSET */
- a = searchURLLabel(b, pu.label);
+ a = searchURLLabel(b, pu.label);
#endif /* not JP_CHARSET */
- if (a != NULL) {
+ if (a != NULL) {
gotoLine(b, a->start.line);
#ifdef LABEL_TOPLINE
- b->topLine = lineSkip(b, b->topLine,
- b->currentLine->linenumber - b->topLine->linenumber,
- FALSE);
+ if (label_topline)
+ b->topLine = lineSkip(b, b->topLine,
+ b->currentLine->linenumber
+ - b->topLine->linenumber,
+ FALSE);
#endif
b->pos = a->start.pos;
arrangeCursor(b);
diff --git a/fm.h b/fm.h
@@ -709,6 +709,9 @@ global int emacs_like_lineedit init(TRUE);
#ifdef VI_PREC_NUM
global int vi_prec_num init(TRUE);
#endif
+#ifdef LABEL_TOPLINE
+global int label_topline init(FALSE);
+#endif
global int displayLink init(FALSE);
global int retryAsHttp init(TRUE);
global int showLineNum init(FALSE);
diff --git a/main.c b/main.c
@@ -2374,9 +2374,10 @@ loadLink(char *url, char *target, char *referer, FormList * request)
if (al) {
gotoLine(Currentbuf, al->start.line);
#ifdef LABEL_TOPLINE
- Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
- Currentbuf->currentLine->linenumber - Currentbuf->topLine->linenumber,
- FALSE);
+ if (label_topline)
+ Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
+ Currentbuf->currentLine->linenumber - Currentbuf->topLine->linenumber,
+ FALSE);
#endif
Currentbuf->pos = al->start.pos;
arrangeCursor(Currentbuf);
@@ -2408,9 +2409,11 @@ gotoLabel(char *label)
pushBuffer(buf);
gotoLine(Currentbuf, al->start.line);
#ifdef LABEL_TOPLINE
- Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
- Currentbuf->currentLine->linenumber - Currentbuf->topLine->linenumber,
- FALSE);
+ if (label_topline)
+ Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
+ Currentbuf->currentLine->linenumber
+ - Currentbuf->topLine->linenumber,
+ FALSE);
#endif
Currentbuf->pos = al->start.pos;
arrangeCursor(Currentbuf);
diff --git a/rc.c b/rc.c
@@ -95,6 +95,9 @@ static int rc_initialized = 0;
#ifdef VI_PREC_NUM
#define CMT_VI_PREC_NUM "vi風の数値プレフィクス"
#endif
+#ifdef LABEL_TOPLINE
+#define CMT_LABEL_TOPLINE "ラベルに移動する時に行頭になるようにする"
+#endif
#define CMT_SHOW_NUM "行番号を表示する"
#define CMT_MIMETYPES "利用するmime.types"
#define CMT_MAILCAP "利用するmailcap"
@@ -199,6 +202,9 @@ static int rc_initialized = 0;
#ifdef VI_PREC_NUM
#define CMT_VI_PREC_NUM "vi-like numeric prefix"
#endif
+#ifdef LABEL_TOPLINE
+#define CMT_LABEL_TOPLINE "move cursor to top line when going to label"
+#endif
#define CMT_SHOW_NUM "Show line number"
#define CMT_MIMETYPES "mime.types files"
#define CMT_MAILCAP "mailcap files"
@@ -403,7 +409,10 @@ struct param_ptr params3[] =
{"emacs_like_lineedit", P_INT, PI_ONOFF, (void *) &emacs_like_lineedit, CMT_EMACS_LIKE_LINEEDIT, NULL },
#endif
#ifdef VI_PREC_NUM
- {"vi_prec_num", P_INT, PI_ONOFF, (void *) &vi_prec_num, CMT_VI_PREC_NUM },
+ {"vi_prec_num", P_INT, PI_ONOFF, (void *) &vi_prec_num, CMT_VI_PREC_NUM, NULL },
+#endif
+#ifdef LABEL_TOPLINE
+ {"label_topline", P_INT, PI_ONOFF, (void *) &label_topline, CMT_LABEL_TOPLINE, NULL },
#endif
{"wrap_search", P_INT, PI_ONOFF, (void *) &WrapDefault, CMT_WRAP, NULL},
{"ignorecase_search", P_INT, PI_ONOFF, (void *) &IgnoreCase, CMT_IGNORE_CASE, NULL},