Files
w3m/scripts/w3mhelp.cgi.in
Fumitoshi UKAI 61c2c2de18 [w3m-dev 03667] fold patch
* anchor.c (reAnchorPos): rewrite
	(reAnchorWord): delete reseq_anchor()
	(reAnchorAny): use l->size
			delete reseq_anchor()
* backend.c (internal_get): pass TRUE to saveBuffer
* buffer.c (newBuffer): delete n->linelen
	(reshapeBuffer): rewrite
* display.c (displayBuffer): FoldLine
	(redrawLine): l->bpos
	(cursorUp0): added
	(cursorUp): rewrite
	(cursorDown0): added
	(cursowDown): rewrite
	(cursorRight): check l->next
			l->bwidth
	(cursorLeft): l->prev && l->bpos
			l->bwidth
	(arrangeCursor): buf->currentLine->bwidth
		buf->cursorX
* etc.c (checkType): **oporp
			rewrite
	(calcPosition): realColumn allocated by New_reuse
* file.c (addnewline): add nlines arg
	(propBuffer): deleted
	(colorBuffer): deleted
	(readHeader): propBuffer
		FOLD_BUFFER_WIDTH
	(HTMLlineproc2body): rewrite
	(addnewline2): added
	(addnewline): rewrite
	(loadBuffer): propBuffer, colorBuffer
	(saveBuffer): cont arg
	(getNextPage): rewrite
* fm.h (LINELEN): 256
	(FNLEN): deleted
	(Line): add size, bpos, bwidth
	(Buffer): delete linelen
	(INIT_BUFFER_WIDTH): check showLineNum
	(FOLD_BUFFER_WIDTH): added
	(FoldLine): added
* funcname.tab (RESHAPE): added
* main.c (do_dump): pass FALSE to saveBuffer
	(nscroll): rewrite
	(clear_mark): l->size
	(shiftvisualpos): rewrite
	(pipeBuf): pass TRUE to saveBuffer
	(linebeg): check line->prev && line->bpos
	(linend): check line->next, line->next->bpos
	(editScr): pass TRUE to saveBuffer
	(svBuf): pass TRUE to saveBuffer
	(vmSrc): pass TRUE to saveBuffer
	(reshape): added
	(curlno): rewrite
* mimehead.c (LINELEN): deleted
* proto.h (reshape): added
	(saveBuffer): add cont arg
	(cursorUp0): added
	(cursorDown0): added
	(checkType): change type oprop, ocolor, delete check_color, len
* rc.c (CMT_FOLD_LINE): added
	(params1): add fold_line
	(sync_with_option): check PagerMax
* search.c (set_mark): l->size
	(forwardSearch): rewrite
	(backwardSearch): rewrite
* doc/README.func (RESHAPE): added
* doc-jp/README.func (RESHAPE): added
* scripts/w3mhelp.cgi.in (Buffer operation): add reshape
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
2003-01-23 18:37:18 +00:00

256 lines
6.2 KiB
Plaintext

#!@PERL@
# $Id: w3mhelp.cgi.in,v 1.24 2003/01/23 18:37:22 ukai Exp $
if ( $^O =~ /^(ms)?(dos|win(32|nt)?)/i ) {
$CYGPATH = 1;
}
$helpdir = "@HELP_DIR@";
if ($CYGPATH) {
$helpdir = &cygwin_pathconv($helpdir);
}
unshift(@INC, $helpdir);
@docdirs = split(" ", "@DOCDIRS@");
require "w3mhelp-funcname.pl";
require "w3mhelp-funcdesc.en.pl";
$lang = 'en';
%htmlesc = (
'<', '&lt;',
'>', '&gt;',
'&', '&amp;'
);
$RC_DIR = '@RC_DIR@';
$RC_DIR =~ s/^~/$ENV{'HOME'}/;
if ($CYGPATH) {
$RC_DIR = &cygwin_pathconv("$RC_DIR");
}
$keymap = "$RC_DIR/keymap";
$version = '*unknown*';
if (defined($ENV{'QUERY_STRING'})) {
print "QUERY_STRING=$ENV{'QUERY_STRING'}\n";
if ($ENV{'QUERY_STRING'} =~ /(^|&)version=([^&]*)/) {
$version = $2;
$version =~ s/\+|%([0-9A-Fa-f][0-9A-Fa-f])/$& eq '+' ? ' ' : pack('C', hex($1))/ge;
$version =~ s/w3m\///;
}
if ($ENV{'QUERY_STRING'} =~ /(^|&)lang=([^&]*)/) {
local($tlang) = $2;
$tlang =~ s/\+|%([0-9A-Fa-f][0-9A-Fa-f])/$& eq '+' ? ' ' : pack('C', hex($1))/ge;
$tlang =~ tr/A-Z/a-z/;
if ($tlang !~ /^[a-z][a-z]$/) {
$tlang = 'en';
}
print "tlang=$tlang\n";
eval {require "w3mhelp-funcdesc.$tlang.pl";};
if (defined(%funcdesc)) {
$lang = $tlang;
}
}
}
%f = %keyfunc;
%keyfunc = ();
while (($key, $fname) = each %f) {
$key = &norm_key($key);
$keyfunc{$key} = $fname;
}
if (-f $keymap) {
open(KEYMAP, "< $keymap") || die "cannot open keymap: $keymap, $!";
&load_keymap(*KEYMAP, $func);
close(KEYMAP);
}
local (%funckeydesc, $key, $fname, $desc);
%funcname = (%funcname, %buf_funcname, %lineedit_funcname);
%funcdesc = (%funcdesc, %buf_funcdesc, %lineedit_funcdesc);
while (($fname, $desc) = each %funcdesc) {
$funckeydesc{$funcname{$fname}} = "$desc\n";
}
while (($key, $fname) = each %keyfunc) {
$funckeydesc{$funcname{$fname}} .= "$key,";
}
while (($key, $fname) = each %buf_keyfunc) {
$funckeydesc{$funcname{$fname}} .= "$key,";
}
while (($key, $fname) = each %lineedit_keyfunc) {
$funckeydesc{$funcname{$fname}} .= "$key,";
}
print <<HEADING;
Content-Type: text/html
<HTML>
<HEAD>
<TITLE>w3m help page</TITLE>
</HEAD>
<BODY>
<CENTER>
*******
<A HREF="http://w3m.sourceforge.net/">w3m</A>
(WWW-wo-Miru) Version $version by
<A HREF="mailto:aito\@fw.ipsj.or.jp">A.ITO</A> ********<BR>
***** Key assign table *****
</CENTER>
HEADING
$q_version = $version;
$q_version =~ s/[^A-Za-z0-9_\$\.\-]/sprintf('%%%02X', ord($&))/ge;
$script = "<A HREF=\"$ENV{'SCRIPT_NAME'}?version=$q_version&amp;lang=";
# doc:en_English doc-jp:ja_Japanese
for $otherlang (@docdirs) {
local(@d) = split(/[:_]/, $otherlang);
if ($d[1] ne $lang) {
$d[1] =~ s/[^A-Za-z0-9_\$\.\-]/sprintf('%%%02X', ord($&))/ge;
print $script, $d[1], "\">$d[2] version</A><BR>\n";
}
}
&show_keymap("Page/Cursor motion",
split(" ", "pgFore pgBack movR movL movD movU
movR1 movL1 movD1 movU1 ldown1 lup1
shiftl shiftr col1L col1R linbeg linend ctrCsrH ctrCsrV
goLine goLineF goLineL movRW movLW
topA lastA nextA prevA movlistMn
nextR nextL nextD nextU nextRD nextLU
undoPos redoPos"));
&show_keymap("Hyperlink operation",
split(" ", "followA tabA svA followI svI submitForm
curURL peekURL peekIMG pginfo curlno chkURL chkWORD chkNMID
rFrame extbrz linkbrz linkLst listMn linkMn accessKey"));
&show_keymap("File/Stream operation",
split(" ", "goURL gorURL tabURL tabrURL ldfile readsh pipesh
pipeBuf"));
&show_keymap("Buffer operation",
split(" ", "backBf nextBf prevBf selMn selBuf vwSrc svSrc svBuf
editBf editScr reload reshape rdrwSc dispI stopI"));
&show_keymap("Tab operation",
split(" ", "newT closeT nextT prevT tabMn tabR tabL"));
&show_keymap("Bookmark operation",
split(" ", "ldBmark adBmark"));
&show_keymap("Search",
split(" ", "srchfor srchbak srchnxt srchprv isrchfor isrchbak"));
&show_keymap("Dictionary look-up",
split(" ", "dictword dictwordat"));
&show_keymap("Mark operation",
split(" ", "_mark nextMk prevMk reMark"));
&show_keymap("Miscellany",
split(" ", "mainMn ldhelp ldOpt dispVer cooLst ldHist ldDL
msgs msToggle wrapToggle execCmd setAlarm setOpt setEnv defKey
reinit execsh susp qquitfm quitfm"));
&show_keymap("Buffer selection mode",
split(" ", "buffer_next buffer_prev buffer_delete buffer_go"));
&show_keymap("Line-edit mode",
split(" ", "lineedit_forward lineedit_back lineedit_backspace
lineedit_delete lineedit_kill_after lineedit_kill_before
lineedit_top lineedit_bottom lineedit_prev lineedit_next
lineedit_editor lineedit_complete lineedit_accept"));
print <<PAGE;
<HR>
</BODY>
</HTML>
PAGE
exit 0;
sub load_keymap {
local(*FH) = shift;
local($func) = @_;
while (<FH>) {
/^#/ && next;
s/^\s*keymap\s+// || next;
s/^(\"(\\\"|[^\"])+\"|\'(\\\'|[^\'])+\'|\S+)\s+(\S+)\s*// || next;
($key, $fname) = ($1, $4);
($data = $_) && next;
$fname =~ tr/a-z/A-Z/;
defined($funcdesc{$fname}) || next;
$key =~ s/^["'](.*)["']$/$1/;
$key = &norm_key($key);
$keyfunc{$key} = $fname;
}
}
sub norm_key {
local($_) = @_;
s/(ESC|SPC|TAB|DEL|UP|DOWN|RIGHT|LEFT)/\U$1/i;
s/\\(.)/$1/g;
s/(^|\s+|-)\^(.)/${1}C-$2/g;
s/(^|\s+|-)(C-\[|M-)/${1}ESC-/g;
if (/^ESC-\[/) {
/^ESC-\[A$/ && return "UP";
/^ESC-\[B$/ && return "DOWN";
/^ESC-\[C$/ && return "RIGHT";
/^ESC-\[D$/ && return "LEFT";
}
s/(^|\s+|-)ESC-\[/$1\^\[\[/g;
s/(^|\s+|-)ESC-\^(.)/${1}ESC-C-$2/g;
s/(^|\s+|-)(ESC-)?C-[iI]/$1${2}TAB/g;
s/(^|\s+|-)(ESC-)?C-\?/$1${2}DEL/g;
return $_;
}
sub show_keymap {
local($head, @list) = @_;
local($fid);
local($attr) = " WIDTH=140";
if (defined($title{$head})) {
$head = $title{$head};
$head =~ s/[<>&]/$htmlesc{$&}/ge;
}
print <<PAGE;
<H2>$head</H2>
<table cellpadding=0>
PAGE
foreach $fid (@list) {
local ($desc, $keys) = split("\n", $funckeydesc{$fid}, 2);
$keys =~ s/,$//;
$keys = '<NOT ASSIGNED>' if ($keys eq '');
$keys =~ s/[<>&]/$htmlesc{$&}/ge;
$desc =~ s/[<>&]/$htmlesc{$&}/ge;
print <<PAGE;
<TR><TD$attr>$keys<TD>$desc
PAGE
$attr = "";
}
print "</table>\n";
}
sub cygwin_pathconv {
local($_) = @_;
local(*CYGPATH);
open(CYGPATH, '-|') || exec('cygpath', '-w', $_);
$_ = <CYGPATH>;
close(CYGPATH);
s/\r?\n$//;
s!\\!/!g;
s!/$!!;
return $_;
}