Fix twiddle movement and at EOL with single Unicode.

This commit is contained in:
Renaud 2021-08-21 09:36:41 +08:00
parent 3d83877086
commit cd2f848e0a
1 changed files with 10 additions and 9 deletions

View File

@ -219,30 +219,31 @@ boolean setccol( int pos) {
*/
BBINDABLE( twiddle) {
unicode_t c ;
boolean eof_f = FALSE ;
assert( !(curbp->b_mode & MDVIEW)) ;
int len = llength( curwp->w_dotp) ;
if( len < 2 || curwp->w_doto == 0) /* at least 2 chars & not bol */
if( len < 2 || curwp->w_doto == 0) /* at least 2 bytes & not bol */
return FALSE ;
if( curwp->w_doto == len) { /* at end of line */
if( curwp->w_doto == len) { /* at end of line */
backchar( FALSE, 1) ;
eof_f = TRUE ;
if( curwp->w_doto == 0) {
/* only one combined character on this line */
forwchar( FALSE, 1) ;
return FALSE ;
}
}
len = lgetchar( &c) ; /* len => unicode or extended ASCII */
ldelchar( 1, FALSE) ;
backchar( FALSE, 1) ;
len = lgetchar( &c) ; /* len => unicode or extended ASCII */
ldelchar( 1, FALSE) ;
forwchar( FALSE, 1) ;
if( len == 1)
linsert_byte( 1, c) ;
else
linsert( 1, c) ;
if( eof_f == TRUE)
forwchar( FALSE, 1) ;
lchange( WFEDIT) ;
return TRUE ;
}