Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qterminal doesn't display images in Ranger or w3m #472

Closed
rdrms opened this issue Aug 30, 2018 · 2 comments
Closed

qterminal doesn't display images in Ranger or w3m #472

rdrms opened this issue Aug 30, 2018 · 2 comments
Labels

Comments

@rdrms
Copy link

rdrms commented Aug 30, 2018

Expected Behavior

Ranger previews image files within the terminal
w3m loads web pages with images inline

Current Behavior

Qterminal does not display images in ranger, presents a "list index out of range"
Neither do images work in w3m

Works in UXTerm and Xterm (which were the other terminals installed)

Steps to Reproduce (for bugs)
  1. Install ranger
  2. Install w3m (for image previews, make sure w3m-img is installed on debian)
  3. Edit the ranger config file rc.conf to show set preview_images true
  4. Attempt to preview an image in ranger, or go to a website with images with w3m
  5. Check other terminals, most of them work (some with issues)
Context
System Information

Here's the output from ranger, which crashes if you have the --debug flag turned on. Might be useful, might not, thought I'd include it anyway.

$ ranger --debug
ranger version: 1.8.1, executed with python 2.7.15
Locale: en_CA.UTF-8
Current file: /home/ryan/Pictures/debgradiant.jpg
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ranger/core/main.py", line 145, in main
    fm.loop()
  File "/usr/lib/python2.7/dist-packages/ranger/core/fm.py", line 366, in loop
    ui.draw_images()
  File "/usr/lib/python2.7/dist-packages/ranger/gui/ui.py", line 355, in draw_images
    self.browser.columns[-1].draw_image()
  File "/usr/lib/python2.7/dist-packages/ranger/gui/widgets/pager.py", line 101, in draw_image
    self.fm.notify(e, bad=True)
  File "/usr/lib/python2.7/dist-packages/ranger/gui/widgets/pager.py", line 97, in draw_image
    self.wid, self.hei)
  File "/usr/lib/python2.7/dist-packages/ranger/ext/img_display.py", line 106, in draw
    start_y, width, height))
  File "/usr/lib/python2.7/dist-packages/ranger/ext/img_display.py", line 140, in _generate_w3m_input
    fontw, fonth = self._get_font_dimensions()
  File "/usr/lib/python2.7/dist-packages/ranger/ext/img_display.py", line 95, in _get_font_dimensions
    xpixels, ypixels = int(output[0]), int(output[1])
IndexError: list index out of range

ranger crashed.  Please report this traceback at:
https://github.com/hut/ranger/issues

Here is a screenshot of Qterminal not displaying it while Xterm and UXterm (same thing?) are displaying it.
screenshot

@yan12125
Copy link
Member

w3m uses X11 protocol to draw images on terminals. It's a bug of w3m instead of individual terminals if images are not displayed.

Also, ranger should handle exceptions when w3m is not compatible with specific terminals.

@yan12125
Copy link
Member

As an alternative, qtermwidget can implement OSC 1337 as a portable way to display images. See lxqt/qtermwidget#207.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants