mirror of
https://github.com/rfivet/uemacs.git
synced 2025-02-20 23:17:13 -05:00
Compare commits
No commits in common. "79c3dfa4d9cccbf19df4cb37a39ca21c21f512f0" and "3bce7a4751bc20dd267a7dcbd7210bc40d0f9c08" have entirely different histories.
79c3dfa4d9
...
3bce7a4751
6
basic.c
6
basic.c
@ -44,8 +44,10 @@ static unsigned getgoal( line_p dlp) {
|
||||
col += 2 ;
|
||||
else if( c >= 0x80 && c <= 0xA0) /* \xx */
|
||||
col += 3 ;
|
||||
else
|
||||
col += utf8_width( c) ;
|
||||
else {
|
||||
int w = utf8_width( c) ; /* work around */
|
||||
col += (w < 0) ? 2 : w ; /* unknown unicode width as \u */
|
||||
}
|
||||
|
||||
if( col > curgoal)
|
||||
break ;
|
||||
|
@ -21,7 +21,11 @@ BINDABLE( upscreen) ;
|
||||
void vtinit( void) ;
|
||||
void vtfree( void) ;
|
||||
void vttidy( void) ;
|
||||
boolean update( boolean force_f) ;
|
||||
int update( boolean force_f) ;
|
||||
void updpos( void) ;
|
||||
void upddex( void) ;
|
||||
void updgar( void) ;
|
||||
int updupd( int force) ;
|
||||
void upmode( void) ;
|
||||
void movecursor( int row, int col) ;
|
||||
void mlerase( void) ;
|
||||
|
3
random.c
3
random.c
@ -164,7 +164,8 @@ int getccol( int bflg) {
|
||||
else if (c >= 0x80 && c <= 0xa0) /* displayed as \xx */
|
||||
col += 3 ;
|
||||
else {
|
||||
col += utf8_width( c) ;
|
||||
int w = utf8_width( c) ; /* incomplete wc_width */
|
||||
col += (w < 0) ? 2 : w ;
|
||||
}
|
||||
}
|
||||
|
||||
|
21
utf8.c
21
utf8.c
@ -7,9 +7,10 @@
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
/* Display width of UTF-8 character */
|
||||
int _utf8_width( unicode_t c) {
|
||||
/*
|
||||
* Display width of UTF-8 character
|
||||
*/
|
||||
int utf8_width( unicode_t c) {
|
||||
#if CYGWIN
|
||||
assert( sizeof( wchar_t) == 2) ; /* wcwidth only supports UTF-16 */
|
||||
return (c < 0x10000) ? wcwidth( (wchar_t) c) : -1 ;
|
||||
@ -18,14 +19,8 @@ int _utf8_width( unicode_t c) {
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int utf8_width( unicode_t c) {
|
||||
int w = _utf8_width( c) ;
|
||||
return (w < 0) ? 2 : w ; /* display \u if can't figure out width */
|
||||
}
|
||||
|
||||
|
||||
/* utf8_to_unicode()
|
||||
/*
|
||||
* utf8_to_unicode()
|
||||
*
|
||||
* Convert a UTF-8 sequence to its unicode value, and return the length of
|
||||
* the sequence in bytes.
|
||||
@ -89,8 +84,8 @@ unsigned utf8_to_unicode( const char *line, unsigned index, unsigned len,
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
/* unicode_to_utf8()
|
||||
/*
|
||||
* unicode_to_utf8()
|
||||
*
|
||||
* Convert a unicode value to its canonical utf-8 sequence.
|
||||
*
|
||||
|
3
utf8.h
3
utf8.h
@ -4,8 +4,7 @@
|
||||
|
||||
typedef unsigned int unicode_t ;
|
||||
|
||||
int _utf8_width( unicode_t c) ; /* straight width */
|
||||
int utf8_width( unicode_t c) ; /* workaround width */
|
||||
int utf8_width( unicode_t c) ;
|
||||
unsigned utf8_to_unicode( const char *line, unsigned index, unsigned len,
|
||||
unicode_t *res) ;
|
||||
unsigned utf8_revdelta( unsigned char *buf, unsigned pos) ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user