1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-10 14:36:13 -05:00

Fix &right to handle a count of Unicode characters.

This commit is contained in:
Renaud 2021-08-21 17:21:18 +08:00
parent cd2f848e0a
commit ab34471d4d

14
eval.c
View File

@ -414,14 +414,20 @@ static const char *gtfun( char *fname) {
retstr = result ; retstr = result ;
break ; break ;
case UFRIGHT: case UFRIGHT:
sz = atoi( argv[ 1]) ; sz = strlen( argv[ 0]) ;
for( sz1 = atoi( argv[ 1]) ; sz1 > 0 && sz > 0 ; sz1--)
if( --sz > 0)
sz -= utf8_revdelta( (unsigned char *) &( argv[ 0])[ sz], sz) ;
retstr = &( argv[ 0])[ sz] ;
sz = strlen( retstr) ;
if( sz >= ressize) { if( sz >= ressize) {
free( result) ; free( result) ;
result = malloc( sz + 1) ;
ressize = sz + 1 ; ressize = sz + 1 ;
result = malloc( ressize) ;
} }
retstr = strcpy( result, &(argv[ 0][ strlen( argv[ 0]) - sz])) ; retstr = strcpy( result, retstr) ;
break ; break ;
case UFMID: case UFMID:
sz1 = strlen( argv[ 0]) ; sz1 = strlen( argv[ 0]) ;