[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Weechat-dev] [patch #7733] hidden full-width character on the last colu
From: |
AYANOKOUZI, Ryuunosuke |
Subject: |
[Weechat-dev] [patch #7733] hidden full-width character on the last column |
Date: |
Sat, 03 Mar 2012 06:36:30 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11 |
URL:
<http://savannah.nongnu.org/patch/?7733>
Summary: hidden full-width character on the last column
Project: WeeChat
Submitted by: ayanokouzi
Submitted on: 2012年03月03日 06時36分29秒
Category: None
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
IRC nick:
_______________________________________________________
Details:
Hi,
If full-width character is located on the last column of chat window,
the character will be hidden.
To demonstrate the bug, I took a screen shot (bug.png) and attached
it.
To reproduce the bug,
0 type command prefix '/' followed by 20 times cyclic sequence of half-width
012345678.
0 type command prefix '/' followed by 10 times cyclic sequence of full-width
0123456789.
In half-width case, displayed last character of 1st line is 0 and
first character of 2nd line is 1.
But in full-width case, displayed last character of 1st line is 9 and
first character of 2nd line is 1. 0 should be located between 9 and
1. The same can be said for another lines. It is unintended
consequences.
Because weechat try to put a line (width = 81) in chat window (width =
80), this might be happen. Based on this suspect, I just added some
lines to gui_chat_string_real_pos subroutine in ./src/gui/gui-chat.c
as shown below, and create a git patch
(0001-hidden-full-width-character-on-the-last-column.patch).
/*
* gui_chat_string_real_pos: get real position in string
* (ignoring color/bold/.. chars)
*/
int
gui_chat_string_real_pos (const char *string, int pos)
{
const char *real_pos, *real_pos_prev, *ptr_string;
int size_on_screen;
if (pos <= 0)
return 0;
real_pos = string;
ptr_string = string;
while (ptr_string && ptr_string[0] && (pos > 0))
{
ptr_string = gui_chat_string_next_char (NULL, NULL,
(unsigned char *)ptr_string,
0, 0);
if (ptr_string)
{
size_on_screen = (((unsigned char)ptr_string[0]) < 32) ? 1 :
utf8_char_size_screen (ptr_string);
if (size_on_screen > 0)
pos -= size_on_screen;
ptr_string = utf8_next_char (ptr_string);
real_pos_prev = real_pos;
real_pos = ptr_string;
}
}
if (pos < 0)
real_pos = real_pos_prev;
return 0 + (real_pos - string);
}
For comparison, I took bug-fixed version's screen shot (bug-fixed.png)
and attached it.
Please find attached files (bug.png, bug-fixed.png,
0001-hidden-full-width-character-on-the-last-column.patch).
Regards,
AYANOKOUZI, Ryuunosuke
--
AYANOKOUZI, Ryuunosuke <address@hidden>
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: 2012年03月03日 06時36分29秒 Name: bug.png Size: 9kB By:
ayanokouzi
<http://savannah.nongnu.org/patch/download.php?file_id=25252>
-------------------------------------------------------
Date: 2012年03月03日 06時36分29秒 Name: bug-fixed.png Size: 9kB By:
ayanokouzi
<http://savannah.nongnu.org/patch/download.php?file_id=25253>
-------------------------------------------------------
Date: 2012年03月03日 06時36分29秒 Name:
0001-hidden-full-width-character-on-the-last-column.patch Size: 1kB By:
ayanokouzi
<http://savannah.nongnu.org/patch/download.php?file_id=25254>
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/patch/?7733>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [Weechat-dev] [patch #7733] hidden full-width character on the last column,
AYANOKOUZI, Ryuunosuke <=