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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Eric L.-2
URL:
  <http://savannah.nongnu.org/patch/?8253>

                 Summary: fix highlighted position in string with full-width
chars
                 Project: WeeChat
            Submitted by: ayanokouzi
            Submitted on: 2013年12月11日 09時17分36秒
                Category: display
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
                IRC nick:

    _______________________________________________________

Details:

Hi,

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,
0001-fix-highlighted-position-in-string-with-full-width-c.patch).

Regards,
AYANOKOUZI, Ryuunosuke
--
AYANOKOUZI, Ryuunosuke <[hidden email]>



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: 2013年12月11日 09時17分36秒  Name: testcase.png  Size: 51kB   By:
ayanokouzi

<http://savannah.nongnu.org/patch/download.php?file_id=29859>
-------------------------------------------------------
Date: 2013年12月11日 09時17分36秒  Name:
0001-fix-highlighted-position-in-string-with-full-width-c.patch  Size: 4kB  
By: ayanokouzi

<http://savannah.nongnu.org/patch/download.php?file_id=29860>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8253>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

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

Eric L.-2
Update of patch #8253 (project weechat):

                  Status:                    None => Done                  
             Assigned to:                    None => flashcode              

    _______________________________________________________

Follow-up 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.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8253>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

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

Eric L.-2
Follow-up Comment #2, patch #8253 (project weechat):

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.

Regards,
AYANOKOUZI, Ryuunosuke
--
AYANOKOUZI, Ryuunosuke <[hidden email]>


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8253>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev