commit f4dc5fb72b7ab2b925f0f5b604f7f28822d20f08
parent ed9d40c5174a9bb1cdfcb376e285fef09e8614c2
Author: ukai <ukai>
Date: Fri, 10 Jan 2003 16:23:52 +0000
[w3m-dev 03625] keymap key SEARCH string
* main.c (srch): accept command argument
(reMark): accept command argument
* Bonus/google.cgi: added
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
3 files changed, 51 insertions(+), 10 deletions(-)
diff --git a/Bonus/google.cgi b/Bonus/google.cgi
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+# ~/.w3m/urimethodmap
+# g: file:/cgi-bin/google.cgi?%s
+# google: file:/cgi-bin/google.cgi?%s
+
+$url = "http://www.google.com/";
+$_ = $ENV{"QUERY_STRING"};
+s@^g(oogle)?:@@ && s@^//@@ && s@/$@@;
+if ($_) {
+ s/\+/ /g;
+ s/%([\da-f][\da-f])/pack('C', hex($1))/egi;
+ s/[\000-\040\+:#?&%<>"\177-\377]/sprintf('%%%02X', unpack('C', $&))/eg;
+ $url .= "search?q=$_&hl=ja&lr=lang_ja&ie=EUC-JP";
+} else {
+ $input = "w3m-control: GOTO_LINK";
+}
+print <<EOF;
+w3m-control: GOTO $url
+w3m-control: DELETE_PREVBUF
+w3m-control: SEARCH \\[
+w3m-control: MOVE_RIGHT
+${input}
+
+EOF
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,12 @@
2003-01-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03625] keymap key SEARCH string
+ * main.c (srch): accept command argument
+ (reMark): accept command argument
+ * Bonus/google.cgi: added
+
+2003-01-11 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03622] Re: Error occured while reset
* file.c (uncompress_stream): child process initialized
* terms.c (close_tty): close unless stdin,out,err
diff --git a/main.c b/main.c
@@ -1651,19 +1651,25 @@ srch(int (*func) (Buffer *, char *), char *prompt)
{
char *str;
int result;
+ int disp = FALSE;
- str = inputStrHist(prompt, NULL, TextHist);
- if (str != NULL && *str == '\0')
- str = SearchString;
- if (str == NULL) {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
+ str = searchKeyData();
+ if (str == NULL || *str == '\0') {
+ str = inputStrHist(prompt, NULL, TextHist);
+ if (str != NULL && *str == '\0')
+ str = SearchString;
+ if (str == NULL) {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
+ }
+ disp = TRUE;
}
result = srchcore(str, func);
if (result & SR_FOUND)
clear_mark(Currentbuf->currentLine);
displayBuffer(Currentbuf, B_NORMAL);
- disp_srchresult(result, prompt, str);
+ if (disp)
+ disp_srchresult(result, prompt, str);
searchRoutine = func;
}
@@ -2634,10 +2640,13 @@ reMark(void)
if (!use_mark)
return;
- str = inputStrHist("(Mark)Regexp: ", MarkString, TextHist);
+ str = searchKeyData();
if (str == NULL || *str == '\0') {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
+ str = inputStrHist("(Mark)Regexp: ", MarkString, TextHist);
+ if (str == NULL || *str == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
+ }
}
if ((p = regexCompile(str, 1)) != NULL) {
disp_message(p, TRUE);