commit dee723f4621153283393e927d4e9445c29024223
parent 78c6b1dc268ad513818c4492765c2fc980f6fb32
Author: ukai <ukai>
Date: Tue, 25 Feb 2003 16:05:43 +0000
[w3m-dev 03782] real linenumber for EDIT and EDIT_SCREEN
* main.c (cur_real_linenumber): added
(editBf): use cur_real_linenumber instead of CUR_LINENUMBER
(editScr): ditto
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,12 @@
2003-02-26 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03782] real linenumber for EDIT and EDIT_SCREEN
+ * main.c (cur_real_linenumber): added
+ (editBf): use cur_real_linenumber instead of CUR_LINENUMBER
+ (editScr): ditto
+
+2003-02-26 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03781] Debian Bug report logs - #181897: w3m submits query urls with "extra"
* main.c (_followForm): remove tailling '?'
diff --git a/main.c b/main.c
@@ -2500,6 +2500,23 @@ linend(void)
displayBuffer(Currentbuf, B_NORMAL);
}
+static int
+cur_real_linenumber(Buffer *buf)
+{
+ Line *l, *cur = buf->currentLine;
+ int n;
+
+ if (!cur)
+ return 1;
+ n = cur->real_linenumber ? cur->real_linenumber : 1;
+ for (l = buf->firstLine; l && l != cur && l->real_linenumber == 0;
+ l = l->next) { /* header */
+ if (l->bpos == 0)
+ n++;
+ }
+ return n;
+}
+
/* Run editor on the current buffer */
void
editBf(void)
@@ -2518,7 +2535,8 @@ editBf(void)
cmd = unquote_mailcap(Currentbuf->edit, Currentbuf->real_type, fn,
checkHeader(Currentbuf, "Content-Type:"), NULL);
else
- cmd = myEditor(Editor, shell_quote(fn), CUR_LINENUMBER(Currentbuf));
+ cmd = myEditor(Editor, shell_quote(fn),
+ cur_real_linenumber(Currentbuf));
fmTerm();
system(cmd->ptr);
fmInit();
@@ -2543,7 +2561,8 @@ editScr(void)
saveBuffer(Currentbuf, f, TRUE);
fclose(f);
fmTerm();
- system(myEditor(Editor, tmpf, CUR_LINENUMBER(Currentbuf))->ptr);
+ system(myEditor(Editor, shell_quote(tmpf),
+ cur_real_linenumber(Currentbuf))->ptr);
fmInit();
unlink(tmpf);
displayBuffer(Currentbuf, B_FORCE_REDRAW);