aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--NEWS1
-rw-r--r--display.c3
-rw-r--r--fm.h3
-rw-r--r--main.c8
-rw-r--r--proto.h3
-rw-r--r--terms.c64
7 files changed, 83 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 202a16f..5ca0ff7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2002-03-16 Fumitoshi UKAI <ukai@debian.or.jp>
+
+ * -title support
+ modified [w3m-dev-en 00710] contrib: unofficial "xterm title" patch, updated for w3m-0.3
+ by Moritz Barsnick <barsnick@gmx.net>
+ * NEWS: -title
+ * fm.h (displayTitleTerm): added
+ * proto.h (term_title): added
+ * main.c (fusage): add -title
+ (MAIN): add -title
+ (quitfm): term_title("")
+ * display.c (displayBuffer): term_title()
+ * terms.c (title_str): added
+ (TERM_INFO): added
+ (term_info): modified from mouse_term_info
+ (term_info_list): modified from xterm_mouse_term
+ add "screen"
+ (set_tty): check displayTitleTerm
+ (term_title): added
+
2002-03-16 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03132] Re: Reload image
@@ -3207,4 +3227,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.353 2002/03/15 16:35:46 ukai Exp $
+$Id: ChangeLog,v 1.354 2002/03/15 18:33:31 ukai Exp $
diff --git a/NEWS b/NEWS
index be79ae7..61f77e6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
w3m 0.4?
+* -title option: set buffer name to terminal title
* X-Face support: USE_XFACE, require uncompface
----------------------------------------------------------------
diff --git a/display.c b/display.c
index 38b708e..2a95716 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.21 2002/03/10 15:55:15 ukai Exp $ */
+/* $Id: display.c,v 1.22 2002/03/15 18:33:32 ukai Exp $ */
#include <signal.h>
#include "fm.h"
@@ -383,6 +383,7 @@ displayBuffer(Buffer *buf, int mode)
standout();
message(msg->ptr, buf->cursorX + buf->rootX, buf->cursorY);
standend();
+ term_title(buf->buffername);
refresh();
#ifdef USE_IMAGE
if (activeImage && displayImage && buf->img) {
diff --git a/fm.h b/fm.h
index 3decd14..e74c53a 100644
--- a/fm.h
+++ b/fm.h
@@ -1,4 +1,4 @@
-/* $Id: fm.h,v 1.55 2002/03/14 16:12:07 ukai Exp $ */
+/* $Id: fm.h,v 1.56 2002/03/15 18:33:32 ukai Exp $ */
/*
* w3m: WWW wo Miru utility
*
@@ -816,6 +816,7 @@ global int label_topline init(FALSE);
#ifdef NEXTPAGE_TOPLINE
global int nextpage_topline init(FALSE);
#endif
+global char *displayTitleTerm init(NULL);
global int displayLink init(FALSE);
global int retryAsHttp init(TRUE);
global int showLineNum init(FALSE);
diff --git a/main.c b/main.c
index cd7d7c0..38e7afc 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.88 2002/03/15 16:35:46 ukai Exp $ */
+/* $Id: main.c,v 1.89 2002/03/15 18:33:32 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -230,6 +230,7 @@ fusage(FILE * f, int err)
#endif
fprintf(f, " -W toggle wrap search mode\n");
fprintf(f, " -X don't use termcap init/deinit\n");
+ fprintf(f, " -title[=TERM] set buffer name to terminal title string\n");
fprintf(f, " -o opt=value assign value to config option\n");
fprintf(f, " -config file specify config file\n");
fprintf(f, " -help print this usage message\n");
@@ -659,6 +660,10 @@ MAIN(int argc, char **argv, char **envp)
squeezeBlankLine = TRUE;
else if (!strcmp("-X", argv[i]))
Do_not_use_ti_te = TRUE;
+ else if (!strcmp("-title", argv[i]))
+ displayTitleTerm = getenv("TERM");
+ else if (!strncmp("-title=", argv[i], 7))
+ displayTitleTerm = argv[i]+7;
else if (!strcmp("-o", argv[i])) {
if (++i >= argc || !strcmp(argv[i], "?")) {
show_params_p = 1;
@@ -2168,6 +2173,7 @@ qquitfm(void)
void
quitfm(void)
{
+ term_title(""); /* XXX */
#ifdef USE_IMAGE
if (activeImage)
termImage();
diff --git a/proto.h b/proto.h
index 876745e..28ca159 100644
--- a/proto.h
+++ b/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.38 2002/03/14 15:41:54 ukai Exp $ */
+/* $Id: proto.h,v 1.39 2002/03/15 18:33:32 ukai Exp $ */
/*
* This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended.
@@ -416,6 +416,7 @@ extern void term_noecho(void);
extern void term_raw(void);
extern void term_cooked(void);
extern void term_cbreak(void);
+extern void term_title(char *s);
extern void flush_tty(void);
extern void toggle_stand(void);
extern char getch(void);
diff --git a/terms.c b/terms.c
index a6e3fa9..cbdb020 100644
--- a/terms.c
+++ b/terms.c
@@ -1,4 +1,4 @@
-/* $Id: terms.c,v 1.28 2002/01/31 17:54:56 ukai Exp $ */
+/* $Id: terms.c,v 1.29 2002/03/15 18:33:32 ukai Exp $ */
/*
* An original curses library for EUC-kanji by Akinori ITO, December 1989
* revised by Akinori ITO, January 1995
@@ -42,6 +42,8 @@ void mouse_init(), mouse_end();
int mouseActive = 0;
#endif /* USE_MOUSE */
+static char *title_str = NULL;
+
static int tty;
#include "terms.h"
@@ -474,22 +476,34 @@ writestr(char *s)
#define MOVE(line,column) writestr(tgoto(T_cm,column,line));
#ifdef USE_MOUSE
-static struct mouse_term_info {
+#define TERM_INFO(name, title, mouse) name, title, mouse
+#else
+#define TERM_INFO(name, title, mouse) name, title
+#endif
+
+#define XTERM_TITLE "\033]0;w3m: %s\007"
+#define SCREEN_TITLE "\033k%s\033\134"
+
+static struct term_info {
char *term;
- int flag;
-} xterm_mouse_term[] = {
- {
- "xterm", NEED_XTERM_ON | NEED_XTERM_OFF}, {
- "kterm", NEED_XTERM_ON | NEED_XTERM_OFF}, {
- "rxvt", NEED_XTERM_ON | NEED_XTERM_OFF},
+ char *title_str;
+#ifdef USE_MOUSE
+ int mouse_flag;
+#endif
+} term_info_list[] = {
+ /* *INDENT-OFF* */
+ {TERM_INFO("xterm", XTERM_TITLE, (NEED_XTERM_ON|NEED_XTERM_OFF))},
+ {TERM_INFO("kterm", XTERM_TITLE, (NEED_XTERM_ON|NEED_XTERM_OFF))},
+ {TERM_INFO("rxvt", XTERM_TITLE, (NEED_XTERM_ON|NEED_XTERM_OFF))},
+ {TERM_INFO("Eterm", XTERM_TITLE, (NEED_XTERM_ON|NEED_XTERM_OFF))},
+ {TERM_INFO("screen", SCREEN_TITLE, 0)},
#ifdef __CYGWIN__
- {
- "cygwin", NEED_XTERM_ON},
+ {TERM_INFO("cygwin", NULL, NEED_XTERM_ON)},
#endif
- {
- NULL, 0}
+ {TERM_INFO(NULL, NULL, 0)}
+ /* *INDENT-ON * */
};
-#endif
+#undef TERM_INFO
int
set_tty(void)
@@ -510,13 +524,22 @@ set_tty(void)
init_win32_console_handle();
#endif
TerminalGet(tty, &d_ioval);
+ if (displayTitleTerm != NULL) {
+ struct term_info *p;
+ for (p = term_info_list; p->term != NULL; p++) {
+ if (!strncmp(displayTitleTerm, p->term, strlen(p->term))) {
+ title_str = p->title_str;
+ break;
+ }
+ }
+ }
#ifdef USE_MOUSE
{
char *term = getenv("TERM");
- struct mouse_term_info *p;
- for (p = xterm_mouse_term; p->term != NULL; p++) {
+ struct term_info *p;
+ for (p = term_info_list; p->term != NULL; p++) {
if (!strncmp(term, p->term, strlen(p->term))) {
- is_xterm = p->flag;
+ is_xterm = p->mouse_flag;
break;
}
}
@@ -1837,6 +1860,15 @@ term_cbreak(void)
term_noecho();
}
+void
+term_title(char *s)
+{
+ if (!fmInitialized)
+ return;
+ if (title_str != NULL)
+ fprintf(stderr, title_str, s);
+}
+
char
getch(void)
{