patchWeeChat - Patches: patch #8253, fix highlighted position in string...


patch #8253: fix highlighted position in string with full-width chars

Submitted by:  AYANOKOUZI, Ryuunosuke <ayanokouzi>
Submitted on:  Wed 11 Dec 2013 09:17:36 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.


Wed 11 Dec 2013 12:35:29 PM UTC, comment #2: 

Hi FlashCode,

Thanks for quick reply.

I think your idea is better than mine. I also checked result with some
test-cases, it seems to work fine.

AYANOKOUZI, Ryuunosuke
AYANOKOUZI, Ryuunosuke <>

AYANOKOUZI, Ryuunosuke <ayanokouzi>
Wed 11 Dec 2013 11:50:39 AM UTC, comment #1: 

Thanks for the patch, it is committed.

I changed some things:
- use of only one function to not duplicate code, with new argument: "int use_screen_size", to use size on screen instead of number of chars,
- use of "use_screen_size" == 0 only in text emphasis (I'm not sure it was intentional in your patch to not use width any more in many calls to the function).

My tests were OK, but if you think something is wrong with these changes, please let me know.

Sebastien Helleu <flashcode>
Project AdministratorIn charge of this item.
Wed 11 Dec 2013 09:17:36 AM UTC, original submission:  


When highlighting a word in string containing full-width chars ahead
of the search word, wrong position is highlighted.

This is a patch for this bug.

This bug is caused by position counting error in
"gui_chat_string_real_pos" function.  According to the source of
"gui_color_emphasize" function, argument "pos" for function
"gui_chat_string_real_pos" is expected to be a number of UTF-8 chars,
but inside "gui_chat_string_real_pos" function, argument "pos" is
treated as the width of string on screen. So, if argument "string"
doesn't contain full-width chars, it's always fine. But if there is
full-width char ahead of search word, wrong position is highlighted.

Please find attached files (testcase.png,

AYANOKOUZI, Ryuunosuke
AYANOKOUZI, Ryuunosuke <>

AYANOKOUZI, Ryuunosuke <ayanokouzi>


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

Attach Files:

Attached Files
file #29859:  testcase.png added by ayanokouzi (51KiB - 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 (Posted a comment)
  • -email is unavailable- added by ayanokouzi (Submitted the item)

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-02-09 flashcode Open/ClosedOpen => Closed
    2013-12-11 flashcode StatusNone => Done
        Assigned toNone => flashcode
    2013-12-11 ayanokouzi Attached File- => Added testcase.png, #29859
        Attached File- => Added 0001-fix-highlighted-position-in-string-with-full-width-c.patch, #29860

    Back to the top

    Powered by Savane 3.7