src/misc_gui.cpp
changeset 6537 dbf4fa55395f
parent 6527 f584ab6d87f8
child 6540 4db000b2cc41
equal deleted inserted replaced
6536:901c7fc9d39d 6537:dbf4fa55395f
   803 {
   803 {
   804 	WChar c;
   804 	WChar c;
   805 	uint width;
   805 	uint width;
   806 	size_t len;
   806 	size_t len;
   807 
   807 
   808 	if (backspace) {
   808 	if (backspace) tb->caretpos -= Utf8PrevCharLen(tb->buf + tb->caretpos);
   809 		do {
       
   810 			tb->caretpos--;
       
   811 		} while (IsUtf8Part(*(tb->buf + tb->caretpos)));
       
   812 	}
       
   813 
   809 
   814 	len = Utf8Decode(&c, tb->buf + tb->caretpos);
   810 	len = Utf8Decode(&c, tb->buf + tb->caretpos);
   815 	width = GetCharacterWidth(FS_NORMAL, c);
   811 	width = GetCharacterWidth(FS_NORMAL, c);
   816 
   812 
   817 	tb->width  -= width;
   813 	tb->width  -= width;
   890 	switch (navmode) {
   886 	switch (navmode) {
   891 	case WKC_LEFT:
   887 	case WKC_LEFT:
   892 		if (tb->caretpos != 0) {
   888 		if (tb->caretpos != 0) {
   893 			WChar c;
   889 			WChar c;
   894 
   890 
   895 			do {
   891 			tb->caretpos -= Utf8PrevCharLen(tb->buf + tb->caretpos);
   896 				tb->caretpos--;
       
   897 			} while (IsUtf8Part(*(tb->buf + tb->caretpos)));
       
   898 
       
   899 			Utf8Decode(&c, tb->buf + tb->caretpos);
   892 			Utf8Decode(&c, tb->buf + tb->caretpos);
   900 			tb->caretxoffs -= GetCharacterWidth(FS_NORMAL, c);
   893 			tb->caretxoffs -= GetCharacterWidth(FS_NORMAL, c);
   901 
   894 
   902 			return true;
   895 			return true;
   903 		}
   896 		}