mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-21 00:26:27 -05:00
Correct column position when displaying double width unicode character (assumed in range \u3000-\u3FFF).
This commit is contained in:
parent
18cd0ba37f
commit
774475a4f6
7
Makefile
7
Makefile
@ -165,8 +165,7 @@ isearch.o: isearch.c isearch.h basic.h retcode.h buffer.h line.h utf8.h \
|
|||||||
window.h
|
window.h
|
||||||
line.o: line.c line.h retcode.h utf8.h buffer.h estruct.h mlout.h \
|
line.o: line.c line.h retcode.h utf8.h buffer.h estruct.h mlout.h \
|
||||||
window.h defines.h
|
window.h defines.h
|
||||||
lock.o: lock.c estruct.h lock.h defines.h display.h utf8.h input.h bind.h \
|
lock.o: lock.c estruct.h lock.h
|
||||||
retcode.h pklock.h
|
|
||||||
main.o: main.c estruct.h basic.h retcode.h bind.h bindable.h buffer.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 \
|
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
|
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 \
|
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
|
region.h random.h search.h spawn.h window.h defines.h word.h
|
||||||
pklock.o: pklock.c estruct.h pklock.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 \
|
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 \
|
display.h estruct.h execute.h input.h bind.h search.h terminal.h \
|
||||||
defines.h window.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
|
window.h
|
||||||
tcap.o: tcap.c terminal.h defines.h retcode.h utf8.h display.h estruct.h \
|
tcap.o: tcap.c terminal.h defines.h retcode.h utf8.h display.h estruct.h \
|
||||||
termio.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
|
utf8.o: utf8.c utf8.h
|
||||||
window.o: window.c window.h defines.h buffer.h line.h retcode.h 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
|
basic.h display.h estruct.h execute.h terminal.h wrapper.h
|
||||||
|
@ -588,6 +588,8 @@ void updpos(void)
|
|||||||
curcol += 2 ; /* displayed as ^c */
|
curcol += 2 ; /* displayed as ^c */
|
||||||
else if( c >= 0x80 && c <= 0xA0)
|
else if( c >= 0x80 && c <= 0xA0)
|
||||||
curcol += 3 ; /* displayed as \xx */
|
curcol += 3 ; /* displayed as \xx */
|
||||||
|
else if( c >= 0x3000 && c <= 0x3FFF)
|
||||||
|
curcol += 2 ; /* double width unicode character */
|
||||||
else
|
else
|
||||||
curcol += 1 ;
|
curcol += 1 ;
|
||||||
}
|
}
|
||||||
|
9
utf8.c
9
utf8.c
@ -20,10 +20,15 @@
|
|||||||
unsigned utf8_to_unicode(char *line, unsigned index, unsigned len, unicode_t *res)
|
unsigned utf8_to_unicode(char *line, unsigned index, unsigned len, unicode_t *res)
|
||||||
{
|
{
|
||||||
unicode_t value ;
|
unicode_t value ;
|
||||||
unsigned c = line[ index] & 0xFFU ;
|
unsigned c ;
|
||||||
unsigned bytes, mask, i;
|
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
|
* 0xxxxxxx is valid one byte utf8
|
||||||
|
Loading…
Reference in New Issue
Block a user