New commands for moving to the top, middle and bottom of buffer

This commit is contained in:
bptato
2020-08-31 18:02:07 +02:00
parent 14aae92000
commit 9916eadf24
5 changed files with 55 additions and 10 deletions
+3
View File
@@ -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)
+3
View File
@@ -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)
+44 -8
View File
@@ -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,39 @@ 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")
{
int offsety;
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);
}
+4 -1
View File
@@ -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);
+1 -1
View File
@@ -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"));
&show_keymap('Hyperlink Operations',
split(" ", "followA tabA svA followI svI submitForm