bugranger - Bugs: bug #40888, [PATCH] Improve img_display...

 
 

bug #40888: [PATCH] Improve img_display implementation

Submitted by:  Casper Ti. Vector <caspervector>
Submitted on:  Thu 12 Dec 2013 09:57:15 PM UTC  
 
Severity:  3 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Wed 29 Jan 2014 09:23:33 AM UTC, comment #2: 

Again update, tested to run on submitter's machine.

Casper Ti. Vector <caspervector>
Sun 05 Jan 2014 01:33:52 PM UTC, comment #1: 

Updated patch, with a small but silly mistake fixed.

(file #30192)

Casper Ti. Vector <caspervector>
Thu 12 Dec 2013 09:57:15 PM UTC, original submission:  

In current implementation, img_display._get_font_dimensions() queries the width / height (in pixels) of the tty through the TIOCGWINSZ ioctl.

This works in xterm and urxvt, but returning ws_xpixel/ws_xpixel from the TIOCGWINSZ ioctl is not mandated (for example, in all VTE-based terminals, like gnome-terminal and lots of others).  See also the following quote from tty_ioctl(4):

>       The struct used by these ioctls is defined as
>
>           struct winsize {
>               unsigned short ws_row;
>               unsigned short ws_col;
>               unsigned short ws_xpixel;   /* unused */
>               unsigned short ws_ypixel;   /* unused */
>           };


w3m itself uses the `-test' option of `w3mimgdisplay' to determine the pixel sizes of ttys.  Therefore, if we follow the same approach, we can (hopefully) display images in any terminal that w3m can.

Attached is the patch.  Happy hacking :)

Casper Ti. Vector <caspervector>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #30406:  ranger-9999-img_display-term_size-r2.patch added by caspervector (974B - text/x-patch - Again update, tested to run on submitter's machine.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by caspervector (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-29 caspervector Attached File- => Added ranger-9999-img_display-term_size-r2.patch, #30406
    2014-01-05 caspervector Attached File- => Added ranger-trunk-img_display-term_size-r1.patch, #30192
    2013-12-12 caspervector Attached File- => Added ranger-trunk-img_display-term_size.patch, #29910

    Back to the top


    Powered by Savane 3.5