diff --git a/Makefile b/Makefile index 125ec2d..030221d 100644 --- a/Makefile +++ b/Makefile @@ -77,7 +77,7 @@ INC_FILES = $(wildcard include/*.h) \ $(wildcard include/smallc/*.h) \ $(wildcard include/smallc/sys/*.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/blkjack.bas share/example/hilow.bas \ share/example/stars.bas share/example/prime.scm \ @@ -179,6 +179,7 @@ cleanall: clean rm -f games/lib/adventure.dat rm -f games/lib/cfscores rm -f share/re.help + rm -f share/emg.keys rm -f share/misc/more.help rm -f etc/termcap etc/remote etc/phones rm -rf share/unixbench diff --git a/src/cmd/emg/ChangeLog b/src/cmd/emg/ChangeLog index 9c41af6..c5d10c8 100644 --- a/src/cmd/emg/ChangeLog +++ b/src/cmd/emg/ChangeLog @@ -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. diff --git a/src/cmd/emg/README b/src/cmd/emg/README index 1bde8f3..b6e1015 100644 --- a/src/cmd/emg/README +++ b/src/cmd/emg/README @@ -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 diff --git a/src/cmd/emg/basic.c b/src/cmd/emg/basic.c index ca7d30f..75290ea 100644 --- a/src/cmd/emg/basic.c +++ b/src/cmd/emg/basic.c @@ -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-.". diff --git a/src/cmd/emg/display.c b/src/cmd/emg/display.c index 721425d..dfe9c0a 100644 --- a/src/cmd/emg/display.c +++ b/src/cmd/emg/display.c @@ -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); diff --git a/src/cmd/emg/ebind.h b/src/cmd/emg/ebind.h index a047139..35836dd 100644 --- a/src/cmd/emg/ebind.h +++ b/src/cmd/emg/ebind.h @@ -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}, diff --git a/src/cmd/emg/efunc.h b/src/cmd/emg/efunc.h index 0531b3c..00bf3ff 100644 --- a/src/cmd/emg/efunc.h +++ b/src/cmd/emg/efunc.h @@ -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 */ diff --git a/src/cmd/emg/emg.keys b/src/cmd/emg/emg.keys index 6677f1b..9ab44fd 100644 --- a/src/cmd/emg/emg.keys +++ b/src/cmd/emg/emg.keys @@ -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 key prior to using another key @@ -13,6 +13,7 @@ M- means to use the 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 ------------------------------------------------------------------------------ diff --git a/src/cmd/emg/main.c b/src/cmd/emg/main.c index 880c410..fd48cf1 100644 --- a/src/cmd/emg/main.c +++ b/src/cmd/emg/main.c @@ -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); }