diff options
author | Tatsuya Kinoshita <tats@debian.org> | 2020-09-01 10:35:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 10:35:53 +0000 |
commit | 2fb3ed9defd5a435b3257a8dda308028505c7731 (patch) | |
tree | a424bfa6c09522eac476fa7ea71bdfeb365a51c7 | |
parent | Update ChangeLog (diff) | |
parent | Removed an unnecessary variable declaration (diff) | |
download | w3m-2fb3ed9defd5a435b3257a8dda308028505c7731.tar.gz w3m-2fb3ed9defd5a435b3257a8dda308028505c7731.zip |
Merge pull request #148 from bptato/master
New commands for moving cursor on screen
Diffstat (limited to '')
-rw-r--r-- | doc-de/README.func | 3 | ||||
-rw-r--r-- | doc/README.func | 3 | ||||
-rw-r--r-- | main.c | 50 | ||||
-rw-r--r-- | proto.h | 5 | ||||
-rw-r--r-- | scripts/w3mhelp.cgi.in | 2 |
5 files changed, 53 insertions, 10 deletions
diff --git a/doc-de/README.func b/doc-de/README.func index 036ae9d..cb175db 100644 --- a/doc-de/README.func +++ b/doc-de/README.func @@ -12,6 +12,9 @@ CLOSE_TAB Schließe Reiter CLOSE_TAB_MOUSE Schließe Reiter bei Mauszeiger COMMAND Rufe w3m Funktion(en) auf COOKIE Cookie-Liste ansehen +CURSOR_TOP Cursor auf die höchste Zeile bewegen +CURSOR_MIDDLE Cursor auf die mittlere Zeile bewegen +CURSOR_BOTTOM Cursor auf die unterste Zeile bewegen DEFAULT_CHARSET Ändere die Voreinstellung für die Zeichenkodierung DEFINE_KEY Definiere eine Verbindung zwischen einer Tastenkombination und einem Kommando DELETE_PREVBUF Lösche vorherigen Puffer (hauptsächlich für lokale CGI-Skripte) diff --git a/doc/README.func b/doc/README.func index 0430855..3bdec74 100644 --- a/doc/README.func +++ b/doc/README.func @@ -12,6 +12,9 @@ CLOSE_TAB Close tab CLOSE_TAB_MOUSE Close tab at mouse pointer COMMAND Invoke w3m function(s) COOKIE View cookie list +CURSOR_TOP Move cursor to the top line on the screen +CURSOR_MIDDLE Move cursor to the middle line on the screen +CURSOR_BOTTOM Move cursor to the bottom line on the screen DEFAULT_CHARSET Change the default character encoding DEFINE_KEY Define a binding between a key stroke combination and a command DELETE_PREVBUF Delete previous buffer (mainly for local CGI-scripts) @@ -871,7 +871,7 @@ main(int argc, char **argv, char **envp) #ifdef USE_M17N wtf_init(DocumentCharset, DisplayCharset); /* if (w3m_dump) - * WcOption.pre_conv = WC_TRUE; + * WcOption.pre_conv = WC_TRUE; */ #endif @@ -882,7 +882,7 @@ main(int argc, char **argv, char **envp) char *image_url = conv_from_system(getimage_args[0]); char *base_url = conv_from_system(getimage_args[1]); ParsedURL base_pu; - + parseURL2(base_url, &base_pu, NULL); image_source = getimage_args[2]; newbuf = loadGeneralFile(image_url, &base_pu, NULL, 0, NULL); @@ -978,7 +978,7 @@ main(int argc, char **argv, char **envp) SearchHeader = search_header; DefaultType = default_type; char *url; - + url = load_argv[i]; if (getURLScheme(&url) == SCM_MISSING && !ArgvIsURL) url = file_to_url(load_argv[i]); @@ -1579,7 +1579,7 @@ SigPipe(SIGNAL_ARG) } #endif -/* +/* * Command functions: These functions are called with a keystroke. */ @@ -2354,9 +2354,9 @@ DEFUN(movR1, MOVE_RIGHT1, "Cursor right. With edge touched, slide") } /* movLW, movRW */ -/* +/* * From: Takashi Nishimoto <g96p0935@mse.waseda.ac.jp> Date: Mon, 14 Jun - * 1999 09:29:56 +0900 + * 1999 09:29:56 +0900 */ #if defined(USE_M17N) && defined(USE_UNICODE) #define nextChar(s, l) do { (s)++; } while ((s) < (l)->len && (l)->propBuf[s] & PC_WCHAR2) @@ -2373,7 +2373,7 @@ is_wordchar(wc_uint32 c) { return wc_is_ucs_alnum(c); } -#else +#else #define nextChar(s, l) (s)++ #define prevChar(s, l) (s)-- #define getChar(p) ((int)*(p)) @@ -3057,7 +3057,7 @@ handleMailto(char *url) return 1; } #endif - + /* invoke external mailer */ if (MailtoOptions == MAILTO_OPTIONS_USE_MAILTO_URL) { to = Strnew_charp(html_unquote(url)); @@ -6893,3 +6893,37 @@ DEFUN(redoPos, REDO, "Cancel the last undo") for (i = 0; i < PREC_NUM && b->next; i++, b = b->next) ; resetPos(b); } + +DEFUN(cursorTop, CURSOR_TOP, "Move cursor to the top of the screen") +{ + if (Currentbuf->firstLine == NULL) + return; + Currentbuf->currentLine = lineSkip(Currentbuf, Currentbuf->topLine, + 0, FALSE); + arrangeLine(Currentbuf); + displayBuffer(Currentbuf, B_NORMAL); +} + +DEFUN(cursorMiddle, CURSOR_MIDDLE, "Move cursor to the middle of the screen") +{ + int offsety; + if (Currentbuf->firstLine == NULL) + return; + offsety = (Currentbuf->LINES - 1) / 2; + Currentbuf->currentLine = currentLineSkip(Currentbuf, Currentbuf->topLine, + offsety, FALSE); + arrangeLine(Currentbuf); + displayBuffer(Currentbuf, B_NORMAL); +} + +DEFUN(cursorBottom, CURSOR_BOTTOM, "Move cursor to the bottom of the screen") +{ + int offsety; + if (Currentbuf->firstLine == NULL) + return; + offsety = Currentbuf->LINES - 1; + Currentbuf->currentLine = currentLineSkip(Currentbuf, Currentbuf->topLine, + offsety, FALSE); + arrangeLine(Currentbuf); + displayBuffer(Currentbuf, B_NORMAL); +} @@ -1,5 +1,5 @@ /* $Id: proto.h,v 1.104 2010/07/25 09:55:05 htrb Exp $ */ -/* +/* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. * @@ -156,6 +156,9 @@ extern Anchor *list_menu(Buffer *buf); #endif extern void undoPos(void); extern void redoPos(void); +extern void cursorTop(void); +extern void cursorMiddle(void); +extern void cursorBottom(void); extern int currentLn(Buffer *buf); extern void tmpClearBuffer(Buffer *buf); diff --git a/scripts/w3mhelp.cgi.in b/scripts/w3mhelp.cgi.in index 11f9b68..55358f8 100644 --- a/scripts/w3mhelp.cgi.in +++ b/scripts/w3mhelp.cgi.in @@ -140,7 +140,7 @@ print "<P><A HREF=\"$keymap\">$head</A>\n"; goLine goLineF goLineL movRW movLW topA lastA nextA prevA movlistMn nextR nextL nextD nextU nextRD nextLU - undoPos redoPos")); + undoPos redoPos cursorTop cursorMiddle cursorBottom")); &show_keymap('Hyperlink Operations', split(" ", "followA tabA svA followI svI submitForm |