diff --git a/Makefile b/Makefile index 7510936..5690871 100644 --- a/Makefile +++ b/Makefile @@ -165,8 +165,7 @@ isearch.o: isearch.c isearch.h basic.h retcode.h buffer.h line.h utf8.h \ window.h line.o: line.c line.h retcode.h utf8.h buffer.h estruct.h mlout.h \ window.h defines.h -lock.o: lock.c estruct.h lock.h defines.h display.h utf8.h input.h bind.h \ - retcode.h pklock.h +lock.o: lock.c estruct.h lock.h main.o: main.c estruct.h basic.h retcode.h bind.h bindable.h buffer.h \ line.h utf8.h display.h eval.h execute.h file.h lock.h mlout.h random.h \ search.h terminal.h defines.h termio.h version.h window.h @@ -176,7 +175,7 @@ names.o: names.c names.h basic.h retcode.h bind.h bindable.h buffer.h \ line.h utf8.h display.h estruct.h eval.h exec.h file.h isearch.h \ region.h random.h search.h spawn.h window.h defines.h word.h pklock.o: pklock.c estruct.h pklock.h -posix.o: posix.c termio.h utf8.h estruct.h retcode.h +posix.o: posix.c random.o: random.c random.h retcode.h basic.h buffer.h line.h utf8.h \ display.h estruct.h execute.h input.h bind.h search.h terminal.h \ defines.h window.h @@ -189,7 +188,7 @@ spawn.o: spawn.c spawn.h defines.h buffer.h line.h retcode.h utf8.h \ window.h tcap.o: tcap.c terminal.h defines.h retcode.h utf8.h display.h estruct.h \ termio.h -termio.o: termio.c +termio.o: termio.c termio.h utf8.h estruct.h retcode.h utf8.o: utf8.c utf8.h window.o: window.c window.h defines.h buffer.h line.h retcode.h utf8.h \ basic.h display.h estruct.h execute.h terminal.h wrapper.h diff --git a/display.c b/display.c index c676856..0c0e313 100644 --- a/display.c +++ b/display.c @@ -588,6 +588,8 @@ void updpos(void) curcol += 2 ; /* displayed as ^c */ else if( c >= 0x80 && c <= 0xA0) curcol += 3 ; /* displayed as \xx */ + else if( c >= 0x3000 && c <= 0x3FFF) + curcol += 2 ; /* double width unicode character */ else curcol += 1 ; } diff --git a/utf8.c b/utf8.c index 5300cfb..175d3d2 100644 --- a/utf8.c +++ b/utf8.c @@ -20,10 +20,15 @@ unsigned utf8_to_unicode(char *line, unsigned index, unsigned len, unicode_t *res) { unicode_t value ; - unsigned c = line[ index] & 0xFFU ; + unsigned c ; unsigned bytes, mask, i; - *res = c; + assert( index < len) ; +#ifdef NDEBUG + if( index >= len) + return 0 ; +#endif + *res = c = line[ index] & 0xFFU ; /* * 0xxxxxxx is valid one byte utf8