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

@@ -77,7 +77,7 @@ INC_FILES = $(wildcard include/*.h) \
$(wildcard include/smallc/*.h) \ $(wildcard include/smallc/*.h) \
$(wildcard include/smallc/sys/*.h) \ $(wildcard include/smallc/sys/*.h) \
$(wildcard include/arpa/*.h) $(wildcard include/arpa/*.h)
SHARE_FILES = share/re.help share/example/Makefile \ SHARE_FILES = share/re.help share/emg.keys share/example/Makefile \
share/example/ashello.S share/example/chello.c \ share/example/ashello.S share/example/chello.c \
share/example/blkjack.bas share/example/hilow.bas \ share/example/blkjack.bas share/example/hilow.bas \
share/example/stars.bas share/example/prime.scm \ share/example/stars.bas share/example/prime.scm \
@@ -179,6 +179,7 @@ cleanall: clean
rm -f games/lib/adventure.dat rm -f games/lib/adventure.dat
rm -f games/lib/cfscores rm -f games/lib/cfscores
rm -f share/re.help rm -f share/re.help
rm -f share/emg.keys
rm -f share/misc/more.help rm -f share/misc/more.help
rm -f etc/termcap etc/remote etc/phones rm -f etc/termcap etc/remote etc/phones
rm -rf share/unixbench rm -rf share/unixbench

View File

@@ -1,6 +1,11 @@
ChangeLog 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 March 16, 2014 : emg 1.5
------------------------ ------------------------
Add line number to the mode line. 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. 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 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 has since dropped the older headers, such as sgtty.h, and it is not worth
reimplementing these for OpenBSD, since OpenBSD maintains Mg. reimplementing these for OpenBSD since OpenBSD maintains Mg.
Tarballs can be found here: ====================================
http://devio.us/~bcallah/emg/ Brian Callahan <bcallah@openbsd.org>
Github repo, for patches:
https://github.com/ibara/emg

View File

@@ -21,6 +21,8 @@ int forwchar(int f, int n);
int backchar(int f, int n); int backchar(int f, int n);
int forwline(int f, int n); int forwline(int f, int n);
int backline(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 * 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); 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 * Set the mark in the current window to the value of "." in the window. No
* errors are possible. Bound to "M-.". * errors are possible. Bound to "M-.".

View File

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

View File

@@ -26,6 +26,7 @@ KEYTAB keytab[] = {
{CTRL | 'R', backsearch}, {CTRL | 'R', backsearch},
{CTRL | 'S', forwsearch}, {CTRL | 'S', forwsearch},
{CTRL | 'T', twiddle}, {CTRL | 'T', twiddle},
{CTRL | 'V', pagedown},
{CTRL | 'W', killregion}, {CTRL | 'W', killregion},
{CTRL | 'Y', yank}, {CTRL | 'Y', yank},
{CTLX | '(', ctlxlp}, {CTLX | '(', ctlxlp},
@@ -63,6 +64,7 @@ KEYTAB keytab[] = {
{META | 'R', sreplace}, {META | 'R', sreplace},
{META | 'S', forwsearch}, /* non-standard */ {META | 'S', forwsearch}, /* non-standard */
{META | 'U', upperword}, {META | 'U', upperword},
{META | 'V', pageup},
{META | 'W', copyregion}, {META | 'W', copyregion},
{META | 'Z', quickexit}, {META | 'Z', quickexit},
{META | 0x7F, delbword}, {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 backchar(); /* Move backward by characters */
extern int forwline(); /* Move forward by lines */ extern int forwline(); /* Move forward by lines */
extern int backline(); /* Move backward 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 gotobob(); /* Move to start of buffer */
extern int gotoeob(); /* Move to end of buffer */ extern int gotoeob(); /* Move to end of buffer */
extern int setfillcol(); /* Set fill column */ 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) Based on Ersatz Emacs (2000/09/14)
M- means to use the <ESC> key prior to using another key 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 ^P Previous line M-N End of paragraph
^A Front of line M-< or [HOME] Start of file ^A Front of line M-< or [HOME] Start of file
^E End of line M-> or [END] End 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 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 'D': cmd = backchar; break;
case 'H': cmd = gotobob; break; case 'H': cmd = gotobob; break;
case 'W': cmd = gotoeob; 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]"); default: mlwrite("\007[Key not bound]");
return (FALSE); return (FALSE);
} }