Add PgUp and PgDn scrolling to emg, release this as emg 1.6

Make sure emg.keys is installed.
This commit is contained in:
Brian Callahan
2014-05-29 14:31:58 -04:00
parent bbba8d6f95
commit 87489937bf
9 changed files with 48 additions and 12 deletions

View File

@@ -1,6 +1,11 @@
ChangeLog
=========
May 29, 2014 : emg 1.6
----------------------
emg is now part of the RetroBSD tree.
Add PgUp and PgDn scrolling.
March 16, 2014 : emg 1.5
------------------------
Add line number to the mode line.

View File

@@ -34,11 +34,8 @@ appreciate the history of this software.
As both Ersatz Emacs and Mg are Public Domain, emg is also Public Domain.
Versions of emg up to and including 1.2 also supported OpenBSD; OpenBSD
has since dropped the older headers, such as sgtty.h and it is not worth
reimplementing these for OpenBSD, since OpenBSD maintains Mg.
has since dropped the older headers, such as sgtty.h, and it is not worth
reimplementing these for OpenBSD since OpenBSD maintains Mg.
Tarballs can be found here:
http://devio.us/~bcallah/emg/
Github repo, for patches:
https://github.com/ibara/emg
====================================
Brian Callahan <bcallah@openbsd.org>

View File

@@ -21,6 +21,8 @@ int forwchar(int f, int n);
int backchar(int f, int n);
int forwline(int f, int n);
int backline(int f, int n);
int pagedown(int f, int n);
int pageup(int f, int n);
/*
* This routine, given a pointer to a LINE, and the current cursor goal
@@ -252,6 +254,28 @@ int backline(int f, int n)
return (TRUE);
}
/*
* PgDn. Scroll down (FORCE_ROWS - 1).
* Just forwline(f, (FORCE_ROWS -1))
* Bound to C-V
*/
int pagedown(int f, int n)
{
forwline(f, (FORCE_ROWS - 1));
return (TRUE);
}
/*
* PgUp. Scroll up (FORCE_ROWS - 1).
* Just backline(f, (FORCE_ROWS -1))
* Bound to M-V
*/
int pageup(int f, int n)
{
backline(f, (FORCE_ROWS - 1));
return (TRUE);
}
/*
* Set the mark in the current window to the value of "." in the window. No
* errors are possible. Bound to "M-.".

View File

@@ -647,7 +647,7 @@ void modeline(WINDOW *wp)
n = 2;
/* This is the version string. Do not forget to
* increment when releasing a new version. */
n += vtputs(" emg 1.5 ");
n += vtputs(" emg 1.6 ");
vtputc(lchar);
vtputc(lchar);
@@ -675,8 +675,8 @@ void modeline(WINDOW *wp)
n += 3;
}
len = snprintf(sl, sizeof(sl), " %d%% (%d,%d) ",
((wp->w_dotline +1) / bp->b_lines),
len = snprintf(sl, sizeof(sl), " %ld%% (%d,%d) ",
(long)((100*(wp->w_dotline + 1)) / curwp->w_bufp->b_lines),
(wp->w_dotline + 1), getccol(FALSE));
if (len < sizeof(sl) && len != -1)
n += vtputs(sl);

View File

@@ -26,6 +26,7 @@ KEYTAB keytab[] = {
{CTRL | 'R', backsearch},
{CTRL | 'S', forwsearch},
{CTRL | 'T', twiddle},
{CTRL | 'V', pagedown},
{CTRL | 'W', killregion},
{CTRL | 'Y', yank},
{CTLX | '(', ctlxlp},
@@ -63,6 +64,7 @@ KEYTAB keytab[] = {
{META | 'R', sreplace},
{META | 'S', forwsearch}, /* non-standard */
{META | 'U', upperword},
{META | 'V', pageup},
{META | 'W', copyregion},
{META | 'Z', quickexit},
{META | 0x7F, delbword},

View File

@@ -23,6 +23,8 @@ extern int gotoeol(); /* Move to end of line */
extern int backchar(); /* Move backward by characters */
extern int forwline(); /* Move forward by lines */
extern int backline(); /* Move backward by lines */
extern int pagedown(); /* PgDn */
extern int pageup(); /* PgUp */
extern int gotobob(); /* Move to start of buffer */
extern int gotoeob(); /* Move to end of buffer */
extern int setfillcol(); /* Set fill column */

View File

@@ -1,4 +1,4 @@
emg keybindings (March 16, 2014)
emg keybindings (May 29, 2014)
Based on Ersatz Emacs (2000/09/14)
M- means to use the <ESC> key prior to using another key
@@ -13,6 +13,7 @@ M- means to use the <ESC> key prior to using another key
^P Previous line M-N End of paragraph
^A Front of line M-< or [HOME] Start of file
^E End of line M-> or [END] End of file
^V or [PgDn] Scroll down M-V or [PgUp] Scroll up
M-G Go to line Arrow keys are active
------------------------------------------------------------------------------

View File

@@ -458,6 +458,10 @@ int extendedcmd(int f, int n)
case 'D': cmd = backchar; break;
case 'H': cmd = gotobob; break;
case 'W': cmd = gotoeob; break;
case '5': cmd = pageup; getctl(); break;
case '6': cmd = pagedown; getctl(); break;
case '7': cmd = gotobob; getctl(); break;
case '8': cmd = gotoeob; getctl(); break;
default: mlwrite("\007[Key not bound]");
return (FALSE);
}