mirror of
https://github.com/rfivet/uemacs.git
synced 2024-11-16 09:36:29 -05:00
Insure transpose-characters works with UTF8.
This commit is contained in:
parent
92078e5595
commit
f11dea468f
2
ebind.c
2
ebind.c
@ -73,7 +73,7 @@ struct key_tab keytab[NBINDS] = {
|
||||
,
|
||||
{CONTROL | 'S', forwsearch}
|
||||
,
|
||||
{CONTROL | 'T', twiddle}
|
||||
{CONTROL | 'T', (fn_t) twiddle}
|
||||
,
|
||||
{CONTROL | 'U', unarg}
|
||||
,
|
||||
|
2
names.c
2
names.c
@ -217,7 +217,7 @@ struct name_bind names[] = {
|
||||
#if BSD | __hpux | SVR4
|
||||
{"suspend-emacs", bktoshell},
|
||||
#endif
|
||||
{"transpose-characters", twiddle},
|
||||
{"transpose-characters", (fn_t) twiddle},
|
||||
#if AEDIT
|
||||
{"trim-line", trim},
|
||||
#endif
|
||||
|
45
random.c
45
random.c
@ -230,27 +230,32 @@ int setccol(int pos)
|
||||
* work. This fixes up a very common typo with a single stroke. Normally bound
|
||||
* to "C-T". This always works within a line, so "WFEDIT" is good enough.
|
||||
*/
|
||||
int twiddle(int f, int n)
|
||||
{
|
||||
struct line *dotp;
|
||||
int doto;
|
||||
int cl;
|
||||
int cr;
|
||||
boolean twiddle( int f, int n) {
|
||||
unicode_t c ;
|
||||
int len ;
|
||||
boolean eof_f = FALSE ;
|
||||
|
||||
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
||||
return rdonly(); /* we are in read only mode */
|
||||
dotp = curwp->w_dotp;
|
||||
doto = curwp->w_doto;
|
||||
if (doto == llength(dotp) && --doto < 0)
|
||||
return FALSE;
|
||||
cr = lgetc(dotp, doto);
|
||||
if (--doto < 0)
|
||||
return FALSE;
|
||||
cl = lgetc(dotp, doto);
|
||||
lputc(dotp, doto + 0, cr);
|
||||
lputc(dotp, doto + 1, cl);
|
||||
lchange(WFEDIT);
|
||||
return TRUE;
|
||||
if( curbp->b_mode & MDVIEW) /* don't allow this command if */
|
||||
return rdonly() ; /* we are in read only mode */
|
||||
|
||||
len = llength( curwp->w_dotp) ;
|
||||
if( len < 2 || curwp->w_doto == 0) /* at least 2 chars & not bol */
|
||||
return FALSE ;
|
||||
|
||||
if( curwp->w_doto == len) { /* at end of line */
|
||||
backchar( FALSE, 1) ;
|
||||
eof_f = TRUE ;
|
||||
}
|
||||
|
||||
lgetchar( &c) ;
|
||||
ldelchar( 1, FALSE) ;
|
||||
backchar( FALSE, 1) ;
|
||||
linsert( 1, c) ;
|
||||
if( eof_f == TRUE)
|
||||
forwchar( FALSE, 1) ;
|
||||
|
||||
lchange( WFEDIT) ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user