mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 07:16:23 -05:00
Revise keycode encoding.
Gather APROP and CFENCE conditional code.
This commit is contained in:
parent
22bbd0417c
commit
c4fab606d1
49
bind.c
49
bind.c
@ -29,10 +29,7 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
|
|
||||||
#if APROP
|
|
||||||
static int buildlist( char *mstring) ;
|
static int buildlist( char *mstring) ;
|
||||||
#endif
|
|
||||||
|
|
||||||
static void cmdstr( int c, char *seq) ;
|
static void cmdstr( int c, char *seq) ;
|
||||||
static unsigned int getckey( int mflag) ;
|
static unsigned int getckey( int mflag) ;
|
||||||
static unsigned int stock( char *keyname) ;
|
static unsigned int stock( char *keyname) ;
|
||||||
@ -208,7 +205,6 @@ BINDABLE( unbindkey) {
|
|||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if APROP
|
|
||||||
/*
|
/*
|
||||||
* does source include sub?
|
* does source include sub?
|
||||||
*
|
*
|
||||||
@ -235,23 +231,20 @@ static boolean strinc( const char *source, const char *sub) {
|
|||||||
|
|
||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* describe bindings
|
/* describe bindings
|
||||||
* bring up a fake buffer and list the key bindings
|
* bring up a fake buffer and list the key bindings
|
||||||
* into it with view mode
|
* into it with view mode
|
||||||
*/
|
*/
|
||||||
int desbind( int f, int n) {
|
BINDABLE( desbind) {
|
||||||
#if APROP
|
|
||||||
return buildlist( "") ;
|
return buildlist( "") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apropos (List functions that match a substring) */
|
/* Apropos (List functions that match a substring) */
|
||||||
int apro( int f, int n) {
|
BINDABLE( apro) {
|
||||||
char *mstring ; /* string to match cmd names to */
|
char *mstring ; /* string to match cmd names to */
|
||||||
int status ; /* status return */
|
|
||||||
|
|
||||||
status = newmlarg( &mstring, "apropos: ", 0) ;
|
int status = newmlarg( &mstring, "apropos: ", 0) ;
|
||||||
if( status == TRUE) {
|
if( status == TRUE) {
|
||||||
status = buildlist( mstring) ;
|
status = buildlist( mstring) ;
|
||||||
free( mstring) ;
|
free( mstring) ;
|
||||||
@ -267,7 +260,6 @@ int apro( int f, int n) {
|
|||||||
* char *mstring; match string if a partial list, "" matches all
|
* char *mstring; match string if a partial list, "" matches all
|
||||||
*/
|
*/
|
||||||
static int buildlist( char *mstring) {
|
static int buildlist( char *mstring) {
|
||||||
#endif
|
|
||||||
struct window *wp; /* scanning pointer to windows */
|
struct window *wp; /* scanning pointer to windows */
|
||||||
kbind_p ktp; /* pointer into the command table */
|
kbind_p ktp; /* pointer into the command table */
|
||||||
nbind_p nptr;/* pointer into the name binding table */
|
nbind_p nptr;/* pointer into the name binding table */
|
||||||
@ -275,7 +267,8 @@ static int buildlist( char *mstring) {
|
|||||||
char outseq[80]; /* output buffer for keystroke sequence */
|
char outseq[80]; /* output buffer for keystroke sequence */
|
||||||
|
|
||||||
/* split the current window to make room for the binding list */
|
/* split the current window to make room for the binding list */
|
||||||
if (splitwind(FALSE, 1) == FALSE)
|
if( wheadp->w_wndp == NULL /* One window */
|
||||||
|
&& splitwind( FALSE, 1) == FALSE) /* Split it */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* and get a buffer for it */
|
/* and get a buffer for it */
|
||||||
@ -288,7 +281,7 @@ static int buildlist( char *mstring) {
|
|||||||
/* let us know this is in progress */
|
/* let us know this is in progress */
|
||||||
mlwrite("(Building binding list)");
|
mlwrite("(Building binding list)");
|
||||||
|
|
||||||
/* disconect the current buffer */
|
/* disconnect the current buffer */
|
||||||
if (--curbp->b_nwnd == 0) { /* Last use. */
|
if (--curbp->b_nwnd == 0) { /* Last use. */
|
||||||
curbp->b_dotp = curwp->w_dotp;
|
curbp->b_dotp = curwp->w_dotp;
|
||||||
curbp->b_doto = curwp->w_doto;
|
curbp->b_doto = curwp->w_doto;
|
||||||
@ -313,12 +306,11 @@ static int buildlist( char *mstring) {
|
|||||||
for( nptr = names ; nptr->n_func != NULL ; nptr++) {
|
for( nptr = names ; nptr->n_func != NULL ; nptr++) {
|
||||||
int cpos ; /* current position to use in outseq */
|
int cpos ; /* current position to use in outseq */
|
||||||
|
|
||||||
#if APROP
|
|
||||||
/* if we are executing an apropos command..... */
|
/* if we are executing an apropos command..... */
|
||||||
/* and current string doesn't include the search string */
|
/* and current string doesn't include the search string */
|
||||||
if( *mstring && strinc( bind_name( nptr), mstring) == FALSE)
|
if( *mstring && strinc( bind_name( nptr), mstring) == FALSE)
|
||||||
continue ;
|
continue ;
|
||||||
#endif
|
|
||||||
/* add in the command name */
|
/* add in the command name */
|
||||||
mystrscpy( outseq, bind_name( nptr), sizeof outseq) ;
|
mystrscpy( outseq, bind_name( nptr), sizeof outseq) ;
|
||||||
cpos = strlen(outseq);
|
cpos = strlen(outseq);
|
||||||
@ -424,7 +416,7 @@ static void cmdstr( int c, char *seq) {
|
|||||||
|
|
||||||
/* apply ^X sequence if needed */
|
/* apply ^X sequence if needed */
|
||||||
if (c & CTLX) {
|
if (c & CTLX) {
|
||||||
if( ctlxc & CONTROL)
|
if( ctlxc & CTRL)
|
||||||
*ptr++ = '^' ;
|
*ptr++ = '^' ;
|
||||||
|
|
||||||
*ptr++ = ctlxc & 0x1FFFFF ;
|
*ptr++ = ctlxc & 0x1FFFFF ;
|
||||||
@ -437,7 +429,7 @@ static void cmdstr( int c, char *seq) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* apply control sequence if needed */
|
/* apply control sequence if needed */
|
||||||
if (c & CONTROL) {
|
if (c & CTRL) {
|
||||||
*ptr++ = '^';
|
*ptr++ = '^';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,24 +440,9 @@ static void cmdstr( int c, char *seq) {
|
|||||||
*ptr = 0; /* terminate the string */
|
*ptr = 0; /* terminate the string */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This function looks a key binding up in the binding table
|
|
||||||
*
|
|
||||||
* int c; key to find what is bound to it
|
|
||||||
*/
|
|
||||||
kbind_p getkeybind( unsigned c) {
|
|
||||||
kbind_p ktp ;
|
|
||||||
|
|
||||||
for( ktp = keytab ; ktp->k_code != 0 ; ktp++)
|
|
||||||
if (ktp->k_code == c)
|
|
||||||
break ;
|
|
||||||
|
|
||||||
return ktp ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *getfname( unsigned keycode, char *failmsg) {
|
static const char *getfname( unsigned keycode, char *failmsg) {
|
||||||
/* takes a key code and gets the name of the function bound to it */
|
/* takes a key code and gets the name of the function bound to it */
|
||||||
kbind_p kbp = getkeybind( keycode) ;
|
kbind_p kbp = getkeybinding( keycode) ;
|
||||||
if( kbp->k_code == 0)
|
if( kbp->k_code == 0)
|
||||||
return failmsg ;
|
return failmsg ;
|
||||||
|
|
||||||
@ -506,11 +483,11 @@ static unsigned int stock( char *keyname) {
|
|||||||
|
|
||||||
/* a control char? */
|
/* a control char? */
|
||||||
if (*keyname == '^' && *(keyname + 1) != 0) {
|
if (*keyname == '^' && *(keyname + 1) != 0) {
|
||||||
c |= CONTROL;
|
c |= CTRL;
|
||||||
++keyname;
|
++keyname;
|
||||||
}
|
}
|
||||||
if (*keyname < 32) {
|
if (*keyname < 32) {
|
||||||
c |= CONTROL;
|
c |= CTRL;
|
||||||
*keyname += 'A';
|
*keyname += 'A';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
bind.h
20
bind.h
@ -3,23 +3,17 @@
|
|||||||
|
|
||||||
#include "names.h"
|
#include "names.h"
|
||||||
|
|
||||||
#define APROP 1 /* Add code for Apropos command */
|
/* Bindable uEMACS functions */
|
||||||
|
BINDABLE( apro) ;
|
||||||
/* uEMACS functions */
|
BINDABLE( bindtokey) ;
|
||||||
#if APROP
|
BINDABLE( desbind) ;
|
||||||
int apro( int f, int n) ;
|
BINDABLE( deskey) ;
|
||||||
#endif
|
BINDABLE( help) ;
|
||||||
|
BINDABLE( unbindkey) ;
|
||||||
int help( int f, int n) ;
|
|
||||||
int deskey( int f, int n) ;
|
|
||||||
int bindtokey( int f, int n) ;
|
|
||||||
int unbindkey( int f, int n) ;
|
|
||||||
int desbind( int f, int n) ;
|
|
||||||
|
|
||||||
int startup( const char *fname) ;
|
int startup( const char *fname) ;
|
||||||
|
|
||||||
/* find a key to function association in the key to function mapping table */
|
/* find a key to function association in the key to function mapping table */
|
||||||
kbind_p getkeybind( unsigned keycode) ; /* by key code */
|
|
||||||
const char *transbind( char *skey) ; /* by string representation of key */
|
const char *transbind( char *skey) ; /* by string representation of key */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Must define one of
|
/* Must define one of
|
||||||
USG | BSD
|
USG | BSD
|
||||||
*/
|
*/
|
||||||
#define USG 1
|
#define USG 1
|
||||||
|
|
||||||
@ -13,12 +13,7 @@
|
|||||||
#define SCROLLCODE 1 /* scrolling code P.K. */
|
#define SCROLLCODE 1 /* scrolling code P.K. */
|
||||||
#define ENVFUNC 1
|
#define ENVFUNC 1
|
||||||
|
|
||||||
#define NSTRING 128 /* # of bytes, string buffers */
|
#define NSTRING 128 /* # of bytes, string buffers */
|
||||||
|
|
||||||
#define CONTROL 0x01000000 /* Control flag, or'ed in */
|
|
||||||
#define META 0x02000000 /* Meta flag, or'ed in */
|
|
||||||
#define CTLX 0x04000000 /* ^X flag, or'ed in */
|
|
||||||
#define SPEC 0x08000000 /* special key (function keys) */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -93,7 +93,6 @@
|
|||||||
|
|
||||||
/* Configuration options */
|
/* Configuration options */
|
||||||
|
|
||||||
#define CFENCE 1 /* fench matching in CMODE */
|
|
||||||
#define VISMAC 0 /* update display during keyboard macros */
|
#define VISMAC 0 /* update display during keyboard macros */
|
||||||
|
|
||||||
#ifndef AUTOCONF
|
#ifndef AUTOCONF
|
||||||
|
96
execute.c
96
execute.c
@ -8,7 +8,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
#include "bind.h"
|
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
@ -203,17 +202,106 @@ static void fmatch( int ch) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if CFENCE
|
||||||
|
/*
|
||||||
|
* the cursor is moved to a matching fence
|
||||||
|
*
|
||||||
|
* int f, n; not used
|
||||||
|
*/
|
||||||
|
BINDABLE( getfence) {
|
||||||
|
struct line *oldlp; /* original line pointer */
|
||||||
|
int oldoff; /* and offset */
|
||||||
|
int sdir; /* direction of search (1/-1) */
|
||||||
|
int count; /* current fence level count */
|
||||||
|
char ch; /* fence type to match against */
|
||||||
|
char ofence; /* open fence */
|
||||||
|
char c; /* current character in scan */
|
||||||
|
|
||||||
|
/* save the original cursor position */
|
||||||
|
oldlp = curwp->w_dotp;
|
||||||
|
oldoff = curwp->w_doto;
|
||||||
|
|
||||||
|
/* get the current character */
|
||||||
|
if (oldoff == llength(oldlp))
|
||||||
|
ch = '\n';
|
||||||
|
else
|
||||||
|
ch = lgetc(oldlp, oldoff);
|
||||||
|
|
||||||
|
/* setup proper matching fence */
|
||||||
|
switch (ch) {
|
||||||
|
case '(':
|
||||||
|
ofence = ')';
|
||||||
|
sdir = FORWARD;
|
||||||
|
break;
|
||||||
|
case '{':
|
||||||
|
ofence = '}';
|
||||||
|
sdir = FORWARD;
|
||||||
|
break;
|
||||||
|
case '[':
|
||||||
|
ofence = ']';
|
||||||
|
sdir = FORWARD;
|
||||||
|
break;
|
||||||
|
case ')':
|
||||||
|
ofence = '(';
|
||||||
|
sdir = REVERSE;
|
||||||
|
break;
|
||||||
|
case '}':
|
||||||
|
ofence = '{';
|
||||||
|
sdir = REVERSE;
|
||||||
|
break;
|
||||||
|
case ']':
|
||||||
|
ofence = '[';
|
||||||
|
sdir = REVERSE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
TTbeep();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* scan until we find a match, or reach the end of file */
|
||||||
|
count = 1 ;
|
||||||
|
do {
|
||||||
|
if( boundry( curwp->w_dotp, curwp->w_doto, sdir)) {
|
||||||
|
/* at buffer limit, no match to be found */
|
||||||
|
/* restore the current position */
|
||||||
|
curwp->w_dotp = oldlp ;
|
||||||
|
curwp->w_doto = oldoff ;
|
||||||
|
TTbeep() ;
|
||||||
|
return FALSE ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( sdir == FORWARD)
|
||||||
|
forwchar( FALSE, 1) ;
|
||||||
|
else
|
||||||
|
backchar( FALSE, 1) ;
|
||||||
|
|
||||||
|
/* if no eol */
|
||||||
|
if( curwp->w_doto != llength(curwp->w_dotp)) {
|
||||||
|
c = curwbyte() ;
|
||||||
|
if( c == ch)
|
||||||
|
++count ;
|
||||||
|
else if( c == ofence)
|
||||||
|
--count ;
|
||||||
|
}
|
||||||
|
} while( count > 0) ;
|
||||||
|
|
||||||
|
/* we have a match, move the sucker */
|
||||||
|
curwp->w_flag |= WFMOVE ;
|
||||||
|
return TRUE ;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the general command execution routine. It handles the fake binding
|
* This is the general command execution routine. It handles the fake binding
|
||||||
* of all the keys to "self-insert". It also clears out the "thisflag" word,
|
* of all the keys to "self-insert". It also clears out the "thisflag" word,
|
||||||
* and arranges to move it to the "lastflag", so that the next command can
|
* and arranges to move it to the "lastflag", so that the next command can
|
||||||
* look at it. Return the status of command.
|
* look at it. Return the status of command.
|
||||||
*/
|
*/
|
||||||
int execute( int c, int f, int n) {
|
int execute( unsigned c, int f, int n) {
|
||||||
int status ;
|
int status ;
|
||||||
|
|
||||||
/* if the keystroke is a bound function...do it */
|
/* if the keystroke is a bound function...do it */
|
||||||
kbind_p ktp = getkeybind( c) ;
|
kbind_p ktp = getkeybinding( c) ;
|
||||||
if( ktp->k_code != 0) {
|
if( ktp->k_code != 0) {
|
||||||
thisflag = 0 ;
|
thisflag = 0 ;
|
||||||
assert( ktp->k_nbp != NULL) ;
|
assert( ktp->k_nbp != NULL) ;
|
||||||
@ -342,7 +430,7 @@ void kbd_loop( void) {
|
|||||||
fnp_t execfunc ;
|
fnp_t execfunc ;
|
||||||
|
|
||||||
if( c == newc
|
if( c == newc
|
||||||
&& (ktp = getkeybind( c))->k_code == c
|
&& (ktp = getkeybinding( c))->k_code == c
|
||||||
&& (execfunc = ktp->k_nbp->k_func) != insert_newline
|
&& (execfunc = ktp->k_nbp->k_func) != insert_newline
|
||||||
&& execfunc != insert_tab)
|
&& execfunc != insert_tab)
|
||||||
newc = getcmd() ;
|
newc = getcmd() ;
|
||||||
|
21
execute.h
21
execute.h
@ -1,5 +1,20 @@
|
|||||||
extern int gasave ; /* global ASAVE size */
|
/* execute.h -- */
|
||||||
extern int gacount ; /* count until next ASAVE */
|
|
||||||
|
|
||||||
int execute( int c, int f, int n) ;
|
#define CFENCE 1 /* fence matching in CMODE */
|
||||||
|
|
||||||
|
|
||||||
|
#include "names.h" /* key code */
|
||||||
|
|
||||||
|
|
||||||
|
extern int gasave ; /* global ASAVE size */
|
||||||
|
extern int gacount ; /* count until next ASAVE */
|
||||||
|
|
||||||
|
|
||||||
|
int execute( unsigned keycode, int f, int n) ;
|
||||||
void kbd_loop( void) ;
|
void kbd_loop( void) ;
|
||||||
|
|
||||||
|
#if CFENCE
|
||||||
|
BINDABLE( getfence) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* end of execute.h */
|
||||||
|
38
input.c
38
input.c
@ -41,12 +41,12 @@ kbdstate kbdmode = STOP ; /* current keyboard macro mode */
|
|||||||
int lastkey = 0 ; /* last keystoke */
|
int lastkey = 0 ; /* last keystoke */
|
||||||
int kbdrep = 0 ; /* number of repetitions */
|
int kbdrep = 0 ; /* number of repetitions */
|
||||||
|
|
||||||
int metac = CONTROL | '[' ; /* current meta character */
|
int metac = CTRL | '[' ; /* current meta character */
|
||||||
int ctlxc = CONTROL | 'X' ; /* current control X prefix char */
|
int ctlxc = CTRL | 'X' ; /* current control X prefix char */
|
||||||
int reptc = CONTROL | 'U' ; /* current universal repeat char */
|
int reptc = CTRL | 'U' ; /* current universal repeat char */
|
||||||
int abortc = CONTROL | 'G' ; /* current abort command char */
|
int abortc = CTRL | 'G' ; /* current abort command char */
|
||||||
|
|
||||||
const int nlc = CONTROL | 'J' ; /* end of input char */
|
const int nlc = CTRL | 'J' ; /* end of input char */
|
||||||
|
|
||||||
|
|
||||||
void ue_system( const char *cmd) {
|
void ue_system( const char *cmd) {
|
||||||
@ -145,11 +145,11 @@ int newmlargt( char **outbufref, const char *prompt, int size) {
|
|||||||
/*
|
/*
|
||||||
* ectoc:
|
* ectoc:
|
||||||
* expanded character to character
|
* expanded character to character
|
||||||
* collapse the CONTROL and SPEC flags back into an ascii code
|
* collapse the CTRL and SPEC flags back into an ascii code
|
||||||
*/
|
*/
|
||||||
int ectoc( int c) {
|
int ectoc( int c) {
|
||||||
if( c & CONTROL)
|
if( c & CTRL)
|
||||||
c ^= CONTROL | 0x40 ;
|
c ^= CTRL | 0x40 ;
|
||||||
|
|
||||||
if( c & SPEC)
|
if( c & SPEC)
|
||||||
c &= 255 ;
|
c &= 255 ;
|
||||||
@ -325,7 +325,7 @@ int tgetc(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* GET1KEY: Get one keystroke. The only prefixs legal here are the SPEC
|
/* GET1KEY: Get one keystroke. The only prefixs legal here are the SPEC
|
||||||
and CONTROL prefixes. */
|
and CTRL prefixes. */
|
||||||
int get1key( void) {
|
int get1key( void) {
|
||||||
int c ;
|
int c ;
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ int get1key( void) {
|
|||||||
c = tgetc();
|
c = tgetc();
|
||||||
|
|
||||||
if( (c >= 0x00 && c <= 0x1F) || c == 0x7F) /* C0 control -> C- */
|
if( (c >= 0x00 && c <= 0x1F) || c == 0x7F) /* C0 control -> C- */
|
||||||
c ^= CONTROL | 0x40 ;
|
c ^= CTRL | 0x40 ;
|
||||||
|
|
||||||
return c ;
|
return c ;
|
||||||
}
|
}
|
||||||
@ -377,7 +377,7 @@ int getcmd(void)
|
|||||||
if (c == 128+27) /* CSI */
|
if (c == 128+27) /* CSI */
|
||||||
goto handle_CSI;
|
goto handle_CSI;
|
||||||
/* process META prefix */
|
/* process META prefix */
|
||||||
if (c == (CONTROL | '[')) {
|
if (c == (CTRL | '[')) {
|
||||||
c = get1key();
|
c = get1key();
|
||||||
#if VT220
|
#if VT220
|
||||||
if (c == '[' || c == 'O') { /* CSI P.K. */
|
if (c == '[' || c == 'O') { /* CSI P.K. */
|
||||||
@ -416,7 +416,7 @@ handle_CSI:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if VT220
|
#if VT220
|
||||||
if (c == (CONTROL | '[')) {
|
if (c == (CTRL | '[')) {
|
||||||
cmask = META;
|
cmask = META;
|
||||||
goto proc_metac;
|
goto proc_metac;
|
||||||
}
|
}
|
||||||
@ -424,14 +424,14 @@ handle_CSI:
|
|||||||
if( islower( c)) /* Force to upper */
|
if( islower( c)) /* Force to upper */
|
||||||
c = flipcase( c) ;
|
c = flipcase( c) ;
|
||||||
else if( c >= 0x00 && c <= 0x1F) /* control key */
|
else if( c >= 0x00 && c <= 0x1F) /* control key */
|
||||||
c = CONTROL | (c + '@');
|
c = CTRL | (c + '@');
|
||||||
return META | c;
|
return META | c;
|
||||||
}
|
}
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
else if (c == metac) {
|
else if (c == metac) {
|
||||||
c = get1key();
|
c = get1key();
|
||||||
#if VT220
|
#if VT220
|
||||||
if (c == (CONTROL | '[')) {
|
if (c == (CTRL | '[')) {
|
||||||
cmask = META;
|
cmask = META;
|
||||||
goto proc_metac;
|
goto proc_metac;
|
||||||
}
|
}
|
||||||
@ -439,7 +439,7 @@ handle_CSI:
|
|||||||
if( islower( c)) /* Force to upper */
|
if( islower( c)) /* Force to upper */
|
||||||
c = flipcase( c) ;
|
c = flipcase( c) ;
|
||||||
else if( c >= 0x00 && c <= 0x1F) /* control key */
|
else if( c >= 0x00 && c <= 0x1F) /* control key */
|
||||||
c = CONTROL | (c + '@');
|
c = CTRL | (c + '@');
|
||||||
return META | c;
|
return META | c;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -452,7 +452,7 @@ handle_CSI:
|
|||||||
if (c == ctlxc) {
|
if (c == ctlxc) {
|
||||||
c = get1key();
|
c = get1key();
|
||||||
#if VT220
|
#if VT220
|
||||||
if (c == (CONTROL | '[')) {
|
if (c == (CTRL | '[')) {
|
||||||
cmask = CTLX;
|
cmask = CTLX;
|
||||||
goto proc_metac;
|
goto proc_metac;
|
||||||
}
|
}
|
||||||
@ -460,7 +460,7 @@ handle_CSI:
|
|||||||
if (c >= 'a' && c <= 'z') /* Force to upper */
|
if (c >= 'a' && c <= 'z') /* Force to upper */
|
||||||
c -= 0x20;
|
c -= 0x20;
|
||||||
if (c >= 0x00 && c <= 0x1F) /* control key */
|
if (c >= 0x00 && c <= 0x1F) /* control key */
|
||||||
c = CONTROL | (c + '@');
|
c = CTRL | (c + '@');
|
||||||
return CTLX | c;
|
return CTLX | c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,8 +554,8 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If it is a <ret>, change it to a <NL> */
|
/* If it is a <ret>, change it to a <NL> */
|
||||||
if( c == (CONTROL | 'M'))
|
if( c == (CTRL | 'M'))
|
||||||
c = CONTROL | 0x40 | '\n' ;
|
c = CTRL | 0x40 | '\n' ;
|
||||||
|
|
||||||
if( c == eolchar) {
|
if( c == eolchar) {
|
||||||
/* if they hit the line terminator, wrap it up */
|
/* if they hit the line terminator, wrap it up */
|
||||||
|
150
names.c
150
names.c
@ -19,6 +19,7 @@
|
|||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "eval.h"
|
#include "eval.h"
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
|
#include "execute.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "isearch.h"
|
#include "isearch.h"
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
@ -31,58 +32,54 @@
|
|||||||
#include "word.h"
|
#include "word.h"
|
||||||
|
|
||||||
|
|
||||||
#define CTL_ CONTROL
|
|
||||||
|
|
||||||
const name_bind names[] = {
|
const name_bind names[] = {
|
||||||
{" abort-command", ctrlg, CTL_ | 'G'} ,
|
{" abort-command", ctrlg, CTRL | 'G'} ,
|
||||||
{" add-global-mode", setgmode, META | 'M'} ,
|
{" add-global-mode", setgmode, META | 'M'} ,
|
||||||
{" add-mode", setemode, CTLX | 'M'} ,
|
{" add-mode", setemode, CTLX | 'M'} ,
|
||||||
#if APROP
|
|
||||||
{" apropos", apro, META | 'A'} ,
|
{" apropos", apro, META | 'A'} ,
|
||||||
#endif
|
{" backward-character", (fnp_t) backchar, CTRL | 'B'} ,
|
||||||
{" backward-character", (fnp_t) backchar, CTL_ | 'B'} ,
|
|
||||||
{" begin-macro", ctlxlp, CTLX | '('} ,
|
{" begin-macro", ctlxlp, CTLX | '('} ,
|
||||||
{" beginning-of-file", (fnp_t) gotobob, META | '<'} ,
|
{" beginning-of-file", (fnp_t) gotobob, META | '<'} ,
|
||||||
{" beginning-of-line", (fnp_t) gotobol, CTL_ | 'A'} ,
|
{" beginning-of-line", (fnp_t) gotobol, CTRL | 'A'} ,
|
||||||
{" bind-to-key", bindtokey, META | 'K'} ,
|
{" bind-to-key", bindtokey, META | 'K'} ,
|
||||||
{" buffer-position", showcpos, CTLX | '='} ,
|
{" buffer-position", showcpos, CTLX | '='} ,
|
||||||
{"!case-region-lower", lowerregion, CTLX | CTL_ | 'L'} ,
|
{"!case-region-lower", lowerregion, CTLX | CTRL | 'L'} ,
|
||||||
{"!case-region-upper", upperregion, CTLX | CTL_ | 'U'} ,
|
{"!case-region-upper", upperregion, CTLX | CTRL | 'U'} ,
|
||||||
{"!case-word-capitalize", capword, META | 'C'} ,
|
{"!case-word-capitalize", capword, META | 'C'} ,
|
||||||
{"!case-word-lower", lowerword, META | 'L'} ,
|
{"!case-word-lower", lowerword, META | 'L'} ,
|
||||||
{"!case-word-upper", upperword, META | 'U'} ,
|
{"!case-word-upper", upperword, META | 'U'} ,
|
||||||
{" change-file-name", filename, CTLX | 'N'} ,
|
{" change-file-name", filename, CTLX | 'N'} ,
|
||||||
{" change-screen-size", newsize, META | CTL_ | 'D'} , /* M^S */
|
{" change-screen-size", newsize, META | CTRL | 'D'} , /* M^S */
|
||||||
{" change-screen-width", newwidth, META | CTL_ | 'T'} ,
|
{" change-screen-width", newwidth, META | CTRL | 'T'} ,
|
||||||
{" clear-and-redraw", redraw, CTL_ | 'L'} ,
|
{" clear-and-redraw", redraw, CTRL | 'L'} ,
|
||||||
{" clear-message-line", clrmes, 0} ,
|
{" clear-message-line", clrmes, 0} ,
|
||||||
{" copy-region", copyregion, META | 'W'} ,
|
{" copy-region", copyregion, META | 'W'} ,
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
{" count-words", wordcount, META | CTL_ | 'C'} ,
|
{" count-words", wordcount, META | CTRL | 'C'} ,
|
||||||
#endif
|
#endif
|
||||||
{" ctlx-prefix", cex, CTL_ | 'X'} ,
|
{" ctlx-prefix", cex, CTRL | 'X'} ,
|
||||||
{"!delete-blank-lines", deblank, CTLX | CTL_ | 'O'} ,
|
{"!delete-blank-lines", deblank, CTLX | CTRL | 'O'} ,
|
||||||
{" delete-buffer", killbuffer, CTLX | 'K'} ,
|
{" delete-buffer", killbuffer, CTLX | 'K'} ,
|
||||||
{" delete-global-mode", delgmode, META | CTL_ | 'M'} ,
|
{" delete-global-mode", delgmode, META | CTRL | 'M'} ,
|
||||||
{" delete-mode", delmode, CTLX | CTL_ | 'M'} ,
|
{" delete-mode", delmode, CTLX | CTRL | 'M'} ,
|
||||||
{"!delete-next-character", forwdel, CTL_ | 'D'} ,
|
{"!delete-next-character", forwdel, CTRL | 'D'} ,
|
||||||
{"!delete-next-word", delfword, META | 'D'} ,
|
{"!delete-next-word", delfword, META | 'D'} ,
|
||||||
{" delete-other-windows", onlywind, CTLX | '1'} ,
|
{" delete-other-windows", onlywind, CTLX | '1'} ,
|
||||||
{"!delete-previous-character", backdel, CTL_ | 'H'} , /* ^? */
|
{"!delete-previous-character", backdel, CTRL | 'H'} , /* ^? */
|
||||||
{"!delete-previous-word", delbword, META | CTL_ | 'H'} , /* M^? */
|
{"!delete-previous-word", delbword, META | CTRL | 'H'} , /* M^? */
|
||||||
{" delete-window", delwind, CTLX | '0'} ,
|
{" delete-window", delwind, CTLX | '0'} ,
|
||||||
{" describe-bindings", desbind, 0} ,
|
{" describe-bindings", desbind, 0} ,
|
||||||
{" describe-key", deskey, CTLX | '?'} ,
|
{" describe-key", deskey, CTLX | '?'} ,
|
||||||
#if AEDIT
|
#if AEDIT
|
||||||
{"!detab-line", detab, CTLX | CTL_ | 'D'} , /* X^A */
|
{"!detab-line", detab, CTLX | CTRL | 'D'} , /* X^A */
|
||||||
#endif
|
#endif
|
||||||
{" end-macro", ctlxrp, CTLX | ')'} ,
|
{" end-macro", ctlxrp, CTLX | ')'} ,
|
||||||
{" end-of-file", (fnp_t) gotoeob, META | '>'} ,
|
{" end-of-file", (fnp_t) gotoeob, META | '>'} ,
|
||||||
{" end-of-line", (fnp_t) gotoeol, CTL_ | 'E'} ,
|
{" end-of-line", (fnp_t) gotoeol, CTRL | 'E'} ,
|
||||||
#if AEDIT
|
#if AEDIT
|
||||||
{"!entab-line", entab, CTLX | CTL_ | 'E'} ,
|
{"!entab-line", entab, CTLX | CTRL | 'E'} ,
|
||||||
#endif
|
#endif
|
||||||
{" exchange-point-and-mark", (fnp_t) swapmark, CTLX | CTL_ | 'X'} ,
|
{" exchange-point-and-mark", (fnp_t) swapmark, CTLX | CTRL | 'X'} ,
|
||||||
{" execute-buffer", execbuf, 0} ,
|
{" execute-buffer", execbuf, 0} ,
|
||||||
{" execute-command-line", execcmd, 0} ,
|
{" execute-command-line", execcmd, 0} ,
|
||||||
{" execute-file", execfile, 0} ,
|
{" execute-file", execfile, 0} ,
|
||||||
@ -129,22 +126,22 @@ const name_bind names[] = {
|
|||||||
{" execute-macro-9", cbuf9, 0} ,
|
{" execute-macro-9", cbuf9, 0} ,
|
||||||
{" execute-named-command", namedcmd, META | 'X'} ,
|
{" execute-named-command", namedcmd, META | 'X'} ,
|
||||||
#if PROC
|
#if PROC
|
||||||
{" execute-procedure", execproc, META | CTL_ | 'E'} ,
|
{" execute-procedure", execproc, META | CTRL | 'E'} ,
|
||||||
#endif
|
#endif
|
||||||
{" execute-program", execprg, CTLX | '$'} ,
|
{" execute-program", execprg, CTLX | '$'} ,
|
||||||
{" exit-emacs", quit, CTLX | CTL_ | 'C'} ,
|
{" exit-emacs", quit, CTLX | CTRL | 'C'} ,
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
{"!fill-paragraph", fillpara, META | 'Q'} ,
|
{"!fill-paragraph", fillpara, META | 'Q'} ,
|
||||||
#endif
|
#endif
|
||||||
{"!filter-buffer", filter_buffer, CTLX | '#'} ,
|
{"!filter-buffer", filter_buffer, CTLX | '#'} ,
|
||||||
{" find-file", filefind, CTLX | CTL_ | 'F'} ,
|
{" find-file", filefind, CTLX | CTRL | 'F'} ,
|
||||||
{" forward-character", (fnp_t) forwchar, CTL_ | 'F'} ,
|
{" forward-character", (fnp_t) forwchar, CTRL | 'F'} ,
|
||||||
{" goto-line", gotoline, META | 'G'} ,
|
{" goto-line", gotoline, META | 'G'} ,
|
||||||
#if CFENCE
|
#if CFENCE
|
||||||
{" goto-matching-fence", getfence, META | CTL_ | 'F'} ,
|
{" goto-matching-fence", getfence, META | CTRL | 'F'} ,
|
||||||
#endif
|
#endif
|
||||||
{" grow-window", enlargewind, CTLX | 'Z'} , /* X^ */
|
{" grow-window", enlargewind, CTLX | 'Z'} , /* X^ */
|
||||||
{"!handle-tab", insert_tab, CTL_ | 'I'} ,
|
{"!handle-tab", insert_tab, CTRL | 'I'} ,
|
||||||
{" help", help, META | '?'} ,
|
{" help", help, META | '?'} ,
|
||||||
{" hunt-backward", backhunt, 0} ,
|
{" hunt-backward", backhunt, 0} ,
|
||||||
{" hunt-forward", forwhunt, META | 'S'} ,
|
{" hunt-forward", forwhunt, META | 'S'} ,
|
||||||
@ -152,48 +149,48 @@ const name_bind names[] = {
|
|||||||
#if ISRCH
|
#if ISRCH
|
||||||
{" incremental-search", fisearch, CTLX | 'S'} ,
|
{" incremental-search", fisearch, CTLX | 'S'} ,
|
||||||
#endif
|
#endif
|
||||||
{"!insert-file", insfile, CTLX | CTL_ | 'I'} ,
|
{"!insert-file", insfile, CTLX | CTRL | 'I'} ,
|
||||||
{"!insert-space", insspace, CTL_ | 'C'} ,
|
{"!insert-space", insspace, CTRL | 'C'} ,
|
||||||
{"!insert-string", istring, 0} ,
|
{"!insert-string", istring, 0} ,
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
{"!justify-paragraph", justpara, META | 'J'} ,
|
{"!justify-paragraph", justpara, META | 'J'} ,
|
||||||
#endif
|
#endif
|
||||||
{"!kill-paragraph", killpara, META | CTL_ | 'W'} ,
|
{"!kill-paragraph", killpara, META | CTRL | 'W'} ,
|
||||||
#endif
|
#endif
|
||||||
{"!kill-region", killregion, CTL_ | 'W'} ,
|
{"!kill-region", killregion, CTRL | 'W'} ,
|
||||||
{"!kill-to-end-of-line", killtext, CTL_ | 'K'} ,
|
{"!kill-to-end-of-line", killtext, CTRL | 'K'} ,
|
||||||
{" list-buffers", listbuffers, CTLX | CTL_ | 'B'} ,
|
{" list-buffers", listbuffers, CTLX | CTRL | 'B'} ,
|
||||||
{" meta-prefix", metafn, CTL_ | '['} ,
|
{" meta-prefix", metafn, CTRL | '['} ,
|
||||||
{" move-window-down", mvdnwind, CTLX | CTL_ | 'N'} ,
|
{" move-window-down", mvdnwind, CTLX | CTRL | 'N'} ,
|
||||||
{" move-window-up", mvupwind, CTLX | CTL_ | 'P'} ,
|
{" move-window-up", mvupwind, CTLX | CTRL | 'P'} ,
|
||||||
{" name-buffer", namebuffer, META | CTL_ | 'N'} ,
|
{" name-buffer", namebuffer, META | CTRL | 'N'} ,
|
||||||
{"!newline", insert_newline, CTL_ | 'M'} ,
|
{"!newline", insert_newline, CTRL | 'M'} ,
|
||||||
{"!newline-and-indent", indent, CTL_ | 'J'} ,
|
{"!newline-and-indent", indent, CTRL | 'J'} ,
|
||||||
{" next-buffer", nextbuffer, CTLX | 'X'} ,
|
{" next-buffer", nextbuffer, CTLX | 'X'} ,
|
||||||
{" next-line", (fnp_t) forwline, CTL_ | 'N'} ,
|
{" next-line", (fnp_t) forwline, CTRL | 'N'} ,
|
||||||
{" next-page", (fnp_t) forwpage, CTL_ | 'V'} ,
|
{" next-page", (fnp_t) forwpage, CTRL | 'V'} ,
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
{" next-paragraph", gotoeop, META | 'N'} ,
|
{" next-paragraph", gotoeop, META | 'N'} ,
|
||||||
#endif
|
#endif
|
||||||
{" next-window", nextwind, CTLX | 'O'} ,
|
{" next-window", nextwind, CTLX | 'O'} ,
|
||||||
{" next-word", forwword, META | 'F'} ,
|
{" next-word", forwword, META | 'F'} ,
|
||||||
{" nop", nullproc, SPEC | META | 'C'}, /* hook */
|
{" nop", nullproc, SPEC | META | 'C'}, /* hook */
|
||||||
{"!open-line", openline, CTL_ | 'O'} ,
|
{"!open-line", openline, CTRL | 'O'} ,
|
||||||
{" overwrite-string", ovstring, 0} ,
|
{" overwrite-string", ovstring, 0} ,
|
||||||
{" pipe-command", pipecmd, CTLX | '@'} ,
|
{" pipe-command", pipecmd, CTLX | '@'} ,
|
||||||
{" previous-line", (fnp_t) backline, CTL_ | 'P'} ,
|
{" previous-line", (fnp_t) backline, CTRL | 'P'} ,
|
||||||
{" previous-page", (fnp_t) backpage, CTL_ | 'Z'} , /* MV */
|
{" previous-page", (fnp_t) backpage, CTRL | 'Z'} , /* MV */
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
{" previous-paragraph", gotobop, META | 'P'} ,
|
{" previous-paragraph", gotobop, META | 'P'} ,
|
||||||
#endif
|
#endif
|
||||||
{" previous-window", prevwind, CTLX | 'P'} ,
|
{" previous-window", prevwind, CTLX | 'P'} ,
|
||||||
{" previous-word", backword, META | 'B'} ,
|
{" previous-word", backword, META | 'B'} ,
|
||||||
{"!query-replace-string", qreplace, META | CTL_ | 'R'} ,
|
{"!query-replace-string", qreplace, META | CTRL | 'R'} ,
|
||||||
{" quick-exit", quickexit, META | 'Z'} ,
|
{" quick-exit", quickexit, META | 'Z'} ,
|
||||||
{"!quote-character", quote, CTL_ | 'Q'} , /* also XQ */
|
{"!quote-character", quote, CTRL | 'Q'} , /* also XQ */
|
||||||
{"!read-file", fileread, CTLX | CTL_ | 'R'} ,
|
{"!read-file", fileread, CTLX | CTRL | 'R'} ,
|
||||||
{" redraw-display", reposition, META | CTL_ | 'L'} , /* M! */
|
{" redraw-display", reposition, META | CTRL | 'L'} , /* M! */
|
||||||
{"!replace-string", sreplace, META | 'R'} ,
|
{"!replace-string", sreplace, META | 'R'} ,
|
||||||
{" resize-window", resize, CTLX | 'W'} ,
|
{" resize-window", resize, CTLX | 'W'} ,
|
||||||
{" restore-window", restwnd, 0} ,
|
{" restore-window", restwnd, 0} ,
|
||||||
@ -203,18 +200,18 @@ const name_bind names[] = {
|
|||||||
#if PROC
|
#if PROC
|
||||||
{" run", execproc, 0} , // alias of execute-procedure
|
{" run", execproc, 0} , // alias of execute-procedure
|
||||||
#endif
|
#endif
|
||||||
{"!save-file", filesave, CTLX | CTL_ | 'S'} , /* also X^D */
|
{"!save-file", filesave, CTLX | CTRL | 'S'} , /* also X^D */
|
||||||
{" save-window", savewnd, 0} ,
|
{" save-window", savewnd, 0} ,
|
||||||
{" scroll-next-down", scrnextdw, META | CTL_ | 'V'} ,
|
{" scroll-next-down", scrnextdw, META | CTRL | 'V'} ,
|
||||||
{" scroll-next-up", scrnextup, META | CTL_ | 'Z'} ,
|
{" scroll-next-up", scrnextup, META | CTRL | 'Z'} ,
|
||||||
{" search-forward", forwsearch, CTL_ | 'S'} ,
|
{" search-forward", forwsearch, CTRL | 'S'} ,
|
||||||
{" search-reverse", backsearch, CTL_ | 'R'} ,
|
{" search-reverse", backsearch, CTRL | 'R'} ,
|
||||||
{" select-buffer", usebuffer, CTLX | 'B'} ,
|
{" select-buffer", usebuffer, CTLX | 'B'} ,
|
||||||
{" set", setvar, CTLX | 'A'} ,
|
{" set", setvar, CTLX | 'A'} ,
|
||||||
{" set-fill-column", setfillcol, CTLX | 'F'} ,
|
{" set-fill-column", setfillcol, CTLX | 'F'} ,
|
||||||
{" set-mark", (fnp_t) setmark, META | ' '} , /* M. */
|
{" set-mark", (fnp_t) setmark, META | ' '} , /* M. */
|
||||||
{" shell-command", spawn, CTLX | '!'} ,
|
{" shell-command", spawn, CTLX | '!'} ,
|
||||||
{" shrink-window", shrinkwind, CTLX | CTL_ | 'Z'} ,
|
{" shrink-window", shrinkwind, CTLX | CTRL | 'Z'} ,
|
||||||
{" split-current-window", splitwind, CTLX | '2'} ,
|
{" split-current-window", splitwind, CTLX | '2'} ,
|
||||||
{" store-macro", storemac, 0} ,
|
{" store-macro", storemac, 0} ,
|
||||||
#if PROC
|
#if PROC
|
||||||
@ -223,31 +220,31 @@ const name_bind names[] = {
|
|||||||
#if BSD | SVR4
|
#if BSD | SVR4
|
||||||
{" suspend-emacs", bktoshell, CTLX | 'D'} , /* BSD MS */
|
{" suspend-emacs", bktoshell, CTLX | 'D'} , /* BSD MS */
|
||||||
#endif
|
#endif
|
||||||
{"!transpose-characters", (fnp_t) twiddle, CTL_ | 'T'} ,
|
{"!transpose-characters", (fnp_t) twiddle, CTRL | 'T'} ,
|
||||||
#if AEDIT
|
#if AEDIT
|
||||||
{"!trim-line", trim, CTLX | CTL_ | 'T'} ,
|
{"!trim-line", trim, CTLX | CTRL | 'T'} ,
|
||||||
#endif
|
#endif
|
||||||
{" unbind-key", unbindkey, META | CTL_ | 'K'} ,
|
{" unbind-key", unbindkey, META | CTRL | 'K'} ,
|
||||||
{" universal-argument", unarg, CTL_ | 'U'} ,
|
{" universal-argument", unarg, CTRL | 'U'} ,
|
||||||
{" unmark-buffer", unmark, META | '~'} ,
|
{" unmark-buffer", unmark, META | '~'} ,
|
||||||
{" update-screen", upscreen, 0} ,
|
{" update-screen", upscreen, 0} ,
|
||||||
{" view-file", viewfile, CTLX | CTL_ | 'V'} ,
|
{" view-file", viewfile, CTLX | CTRL | 'V'} ,
|
||||||
{"!wrap-word", wrapword, SPEC | META | 'W'} , /* hook */
|
{"!wrap-word", wrapword, SPEC | META | 'W'} , /* hook */
|
||||||
{" write-file", filewrite, CTLX | CTL_ | 'W'} ,
|
{" write-file", filewrite, CTLX | CTRL | 'W'} ,
|
||||||
{" write-message", writemsg, 0} ,
|
{" write-message", writemsg, 0} ,
|
||||||
{"!yank", yank, CTL_ | 'Y'} ,
|
{"!yank", yank, CTRL | 'Y'} ,
|
||||||
|
|
||||||
{" ", NULL, 0},
|
{" ", NULL, 0},
|
||||||
/* extra key mapping */
|
/* extra key mapping */
|
||||||
// { NULL, newsize, META | CTL_ | 'S'},
|
// { NULL, newsize, META | CTRL | 'S'},
|
||||||
{ NULL, backdel, CTL_ | '?'},
|
{ NULL, backdel, CTRL | '?'},
|
||||||
{ NULL, delbword, META | CTL_ | '?'},
|
{ NULL, delbword, META | CTRL | '?'},
|
||||||
{ NULL, detab, CTLX | CTL_ | 'A'},
|
{ NULL, detab, CTLX | CTRL | 'A'},
|
||||||
{ NULL, enlargewind, CTLX | '^'},
|
{ NULL, enlargewind, CTLX | '^'},
|
||||||
{ NULL, (fnp_t) backpage, META | 'V'},
|
{ NULL, (fnp_t) backpage, META | 'V'},
|
||||||
{ NULL, quote, CTLX | 'Q'},
|
{ NULL, quote, CTLX | 'Q'},
|
||||||
{ NULL, reposition, META | '!'},
|
{ NULL, reposition, META | '!'},
|
||||||
//detab { NULL, filesave, CTLX | CTL_ | 'D'},
|
//detab { NULL, filesave, CTLX | CTRL | 'D'},
|
||||||
{ NULL, (fnp_t) setmark, META | '.'},
|
{ NULL, (fnp_t) setmark, META | '.'},
|
||||||
// { NULL, bktoshell, META | 'S'},
|
// { NULL, bktoshell, META | 'S'},
|
||||||
|
|
||||||
@ -390,6 +387,21 @@ boolean delkeybinding( unsigned key) {
|
|||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function looks a key binding up in the binding table
|
||||||
|
*
|
||||||
|
* int c; key to find what is bound to it
|
||||||
|
*/
|
||||||
|
kbind_p getkeybinding( unsigned c) {
|
||||||
|
kbind_p ktp ;
|
||||||
|
|
||||||
|
for( ktp = keytab ; ktp->k_code != 0 ; ktp++)
|
||||||
|
if (ktp->k_code == c)
|
||||||
|
break ;
|
||||||
|
|
||||||
|
return ktp ;
|
||||||
|
}
|
||||||
|
|
||||||
#define BINARY 1
|
#define BINARY 1
|
||||||
|
|
||||||
nbind_p fncmatch( char *name) {
|
nbind_p fncmatch( char *name) {
|
||||||
|
10
names.h
10
names.h
@ -6,6 +6,12 @@
|
|||||||
#include "retcode.h"
|
#include "retcode.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define CTRL 0x01000000 /* Control flag, or'ed in */
|
||||||
|
#define META 0x02000000 /* Meta flag, or'ed in */
|
||||||
|
#define CTLX 0x04000000 /* ^X flag, or'ed in */
|
||||||
|
#define SPEC 0x08000000 /* special key (function keys) */
|
||||||
|
|
||||||
|
|
||||||
/* Bindable uEMACS function pointer type and definition template */
|
/* Bindable uEMACS function pointer type and definition template */
|
||||||
#define BINDABLE( fname) int fname( int f, int n)
|
#define BINDABLE( fname) int fname( int f, int n)
|
||||||
|
|
||||||
@ -39,8 +45,12 @@ extern kbind_p keytab ; /* key bind to functions table */
|
|||||||
boolean init_bindings( void) ;
|
boolean init_bindings( void) ;
|
||||||
kbind_p setkeybinding( unsigned key, nbind_p nbp) ;
|
kbind_p setkeybinding( unsigned key, nbind_p nbp) ;
|
||||||
boolean delkeybinding( unsigned key) ;
|
boolean delkeybinding( unsigned key) ;
|
||||||
|
kbind_p getkeybinding( unsigned key) ; /* look up by key code */
|
||||||
|
|
||||||
|
/* find a name to function association in the name to function mapping table */
|
||||||
nbind_p fncmatch( char *name) ; /* look up by name */
|
nbind_p fncmatch( char *name) ; /* look up by name */
|
||||||
|
|
||||||
|
|
||||||
/* bindable functions mapped to prefix keys and hooks */
|
/* bindable functions mapped to prefix keys and hooks */
|
||||||
BINDABLE( nullproc) ;
|
BINDABLE( nullproc) ;
|
||||||
BINDABLE( metafn) ;
|
BINDABLE( metafn) ;
|
||||||
|
90
random.c
90
random.c
@ -924,96 +924,6 @@ static int adjustmode( int kind, int global) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CFENCE
|
|
||||||
/*
|
|
||||||
* the cursor is moved to a matching fence
|
|
||||||
*
|
|
||||||
* int f, n; not used
|
|
||||||
*/
|
|
||||||
int getfence(int f, int n)
|
|
||||||
{
|
|
||||||
struct line *oldlp; /* original line pointer */
|
|
||||||
int oldoff; /* and offset */
|
|
||||||
int sdir; /* direction of search (1/-1) */
|
|
||||||
int count; /* current fence level count */
|
|
||||||
char ch; /* fence type to match against */
|
|
||||||
char ofence; /* open fence */
|
|
||||||
char c; /* current character in scan */
|
|
||||||
|
|
||||||
/* save the original cursor position */
|
|
||||||
oldlp = curwp->w_dotp;
|
|
||||||
oldoff = curwp->w_doto;
|
|
||||||
|
|
||||||
/* get the current character */
|
|
||||||
if (oldoff == llength(oldlp))
|
|
||||||
ch = '\n';
|
|
||||||
else
|
|
||||||
ch = lgetc(oldlp, oldoff);
|
|
||||||
|
|
||||||
/* setup proper matching fence */
|
|
||||||
switch (ch) {
|
|
||||||
case '(':
|
|
||||||
ofence = ')';
|
|
||||||
sdir = FORWARD;
|
|
||||||
break;
|
|
||||||
case '{':
|
|
||||||
ofence = '}';
|
|
||||||
sdir = FORWARD;
|
|
||||||
break;
|
|
||||||
case '[':
|
|
||||||
ofence = ']';
|
|
||||||
sdir = FORWARD;
|
|
||||||
break;
|
|
||||||
case ')':
|
|
||||||
ofence = '(';
|
|
||||||
sdir = REVERSE;
|
|
||||||
break;
|
|
||||||
case '}':
|
|
||||||
ofence = '{';
|
|
||||||
sdir = REVERSE;
|
|
||||||
break;
|
|
||||||
case ']':
|
|
||||||
ofence = '[';
|
|
||||||
sdir = REVERSE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
TTbeep();
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* scan until we find a match, or reach the end of file */
|
|
||||||
count = 1 ;
|
|
||||||
do {
|
|
||||||
if( boundry( curwp->w_dotp, curwp->w_doto, sdir)) {
|
|
||||||
/* at buffer limit, no match to be found */
|
|
||||||
/* restore the current position */
|
|
||||||
curwp->w_dotp = oldlp ;
|
|
||||||
curwp->w_doto = oldoff ;
|
|
||||||
TTbeep() ;
|
|
||||||
return FALSE ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( sdir == FORWARD)
|
|
||||||
forwchar( FALSE, 1) ;
|
|
||||||
else
|
|
||||||
backchar( FALSE, 1) ;
|
|
||||||
|
|
||||||
/* if no eol */
|
|
||||||
if( curwp->w_doto != llength(curwp->w_dotp)) {
|
|
||||||
c = curwbyte() ;
|
|
||||||
if( c == ch)
|
|
||||||
++count ;
|
|
||||||
else if( c == ofence)
|
|
||||||
--count ;
|
|
||||||
}
|
|
||||||
} while( count > 0) ;
|
|
||||||
|
|
||||||
/* we have a match, move the sucker */
|
|
||||||
curwp->w_flag |= WFMOVE ;
|
|
||||||
return TRUE ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int iovstring( int f, int n, const char *prompt, int (*fun)( char *)) {
|
static int iovstring( int f, int n, const char *prompt, int (*fun)( char *)) {
|
||||||
int status ; /* status return code */
|
int status ; /* status return code */
|
||||||
|
1
random.h
1
random.h
@ -43,7 +43,6 @@ int setemode( int f, int n) ;
|
|||||||
int delmode( int f, int n) ;
|
int delmode( int f, int n) ;
|
||||||
int setgmode( int f, int n) ;
|
int setgmode( int f, int n) ;
|
||||||
int delgmode( int f, int n) ;
|
int delgmode( int f, int n) ;
|
||||||
int getfence( int f, int n) ;
|
|
||||||
int istring( int f, int n) ;
|
int istring( int f, int n) ;
|
||||||
int ovstring( int f, int n) ;
|
int ovstring( int f, int n) ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user