Skip to content

Commit

Permalink
core in emacs mode while entering characters in different locale.
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus-it committed Jan 4, 2021
1 parent dd22d2a commit 919b8cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cmd/ksh93/edit/emacs.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ One line screen editor for any program
static int print(int);
static int _isword(int);
# define isword(c) _isword(out[c])
# define digit(c) ((c&~STRIP)==0 && isdigit(c))

#else
# define gencpy(a,b) strcpy((char*)(a),(char*)(b))
# define genncpy(a,b,n) strncpy((char*)(a),(char*)(b),n)
# define genlen(str) strlen(str)
# define print(c) isprint(c)
# define isword(c) (isalnum(out[c]) || (out[c]=='_'))
# define digit(c) isdigit(c)
#endif /*SHOPT_MULTIBYTE */

typedef struct _emacs_
Expand Down Expand Up @@ -317,7 +319,7 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit)
count = 1;
adjust = -1;
i = cur;
if(c!='\t' && c!=ESC && !isdigit(c))
if(c!='\t' && c!=ESC && !digit(c))
ep->ed->e_tabcount = 0;
switch(c)
{
Expand Down Expand Up @@ -777,7 +779,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
int digit,ch;
digit = 0;
value = 0;
while ((i=ed_getchar(ep->ed,0)),isdigit(i))
while ((i=ed_getchar(ep->ed,0)),digit(i))
{
value *= 10;
value += (i - '0');
Expand Down Expand Up @@ -1016,7 +1018,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
{
i=ed_getchar(ep->ed,0);
ed_ungetchar(ep->ed,i);
if(isdigit(i))
if(digit(i))
ed_ungetchar(ep->ed,ESC);
}
}
Expand Down

0 comments on commit 919b8cb

Please sign in to comment.