patchWeeChat - Patches: patch #7733, hidden full-width character on the...

 
 

patch #7733: hidden full-width character on the last column

Submitted by:  AYANOKOUZI, Ryuunosuke <ayanokouzi>
Submitted on:  Sat 03 Mar 2012 06:36:29 AM UTC  
 
Category:  display Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  Sebastien Helleu <flashcode> Open/Closed:  Closed
IRC nick: 

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 03 Mar 2012 06:36:29 AM UTC, original submission:

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,

  1. type command prefix '/' followed by 20 times cyclic sequence of half-width 012345678.
  2. 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 <i38w7i3@yahoo.co.jp>

AYANOKOUZI, Ryuunosuke <ayanokouzi>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #25252:  bug.png added by ayanokouzi (9KiB - image/png)
file #25253:  bug-fixed.png added by ayanokouzi (9KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by flashcode (Updated the item)
  • -email is unavailable- added by ayanokouzi (Submitted the item)
  • -email is unavailable- added by ayanokouzi
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-06-04 flashcode Open/ClosedOpen => Closed
    2012-03-03 flashcode CategoryNone => display
        StatusNone => Done
        Assigned toNone => flashcode
    2012-03-03 ayanokouzi Attached File- => Added bug.png, #25252
        Attached File- => Added bug-fixed.png, #25253
        Attached File- => Added 0001-hidden-full-width-character-on-the-last-column.patch, #25254
        Carbon-Copy- => Added i38w7i3@yahoo.co.jp

    Back to the top


    Powered by Savane 3.4