aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-02-25 16:05:43 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-02-25 16:05:43 +0000
commitaa0efc032ed4cb89368980b996a1b9a8d1a1a13e (patch)
tree669062403ff4e646729b3ce94a0bd64781a55a42 /main.c
parent[w3m-dev 03781] Debian Bug report logs - #181897: w3m submits query urls with... (diff)
downloadw3m-aa0efc032ed4cb89368980b996a1b9a8d1a1a13e.tar.gz
w3m-aa0efc032ed4cb89368980b996a1b9a8d1a1a13e.zip
[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 (limited to 'main.c')
-rw-r--r--main.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/main.c b/main.c
index 9a7582a..57e7ce4 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.212 2003/02/25 16:01:41 ukai Exp $ */
+/* $Id: main.c,v 1.213 2003/02/25 16:05:48 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -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);