1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

core: fix wrapping of words with wide chars (the break was made before the correct position)

This commit is contained in:
Sebastien Helleu
2012-10-12 14:05:48 +02:00
parent 5cfeb2f2bc
commit 70ce7fe3b6
2 changed files with 10 additions and 5 deletions
+3 -1
View File
@@ -1,12 +1,14 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.0-dev, 2012-10-09
v0.4.0-dev, 2012-10-12
Version 0.4.0 (under dev!)
--------------------------
* core: fix wrapping of words with wide chars (the break was made before the
correct position)
* aspell: add bar item "aspell_dict" (dictionary used on current buffer)
* irc: add option "-noswitch" for command /join (task #12275)
* irc: fix crash when message 352 has too few arguments (bug #37513)
+7 -4
View File
@@ -264,6 +264,9 @@ gui_chat_string_real_pos (const char *string, int pos)
/*
* gui_chat_get_word_info: returns info about next word: beginning, end, length
* Note: the word_{start|end}_offset are in bytes, but
* word_length(_with_spaces) are in number of chars on
* screen.
*/
void
@@ -274,7 +277,7 @@ gui_chat_get_word_info (struct t_gui_window *window,
{
const char *start_data;
char *next_char, *next_char2;
int leading_spaces, char_size;
int leading_spaces, char_size_screen;
*word_start_offset = 0;
*word_end_offset = 0;
@@ -298,10 +301,10 @@ gui_chat_get_word_info (struct t_gui_window *window,
if (leading_spaces)
*word_start_offset = next_char - start_data;
leading_spaces = 0;
char_size = next_char2 - next_char;
*word_end_offset = next_char2 - start_data - 1;
(*word_length_with_spaces) += char_size;
(*word_length) += char_size;
char_size_screen = utf8_char_size_screen (next_char);
(*word_length_with_spaces) += char_size_screen;
(*word_length) += char_size_screen;
}
else
{