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

ranger won't refresh preview column when previewing images and files #859

Closed
x4121 opened this issue Apr 26, 2017 · 47 comments
Closed

ranger won't refresh preview column when previewing images and files #859

x4121 opened this issue Apr 26, 2017 · 47 comments

Comments

@x4121
Copy link

@x4121 x4121 commented Apr 26, 2017

Similar to #811, I get some strange effects when previewing images.
Bug stays even after deleting old ranger version (installed with apt) and building new version from current master.
Deleted ~/.config/ranger directory, ran ranger --copy-config all and changed preview_images to true.

ISSUE TYPE

  • Bug report

RUNTIME ENVIRONMENT

  • Operating system and version: Ubuntu-Gnome 17.04
  • Terminal emulator and version: konsole 16.12.3
  • Python version: Python 3.5.3
  • Ranger version/commit: ranger-master 1.9.0b5
  • Locale: en_US.UTF-8

EXPECTED BEHAVIOR

  • image preview redraws over previous images
  • image preview "clears" after closing ranger

CURRENT BEHAVIOR

  • some images are cropped
  • small images are drawn over previous images
  • image parts stay after closing ranger if terminal contains long texts

STEPS TO REPRODUCE

(see video)

TRACEBACK

Traceback (most recent call last):
  File "/usr/local/bin/ranger", line 41, in <module>
    sys.exit(ranger.main())  # pylint: disable=no-member
  File "/usr/local/lib/python3.5/dist-packages/ranger/core/main.py", line 222, in main
    fm.ui.destroy()
  File "/usr/local/lib/python3.5/dist-packages/ranger/gui/ui.py", line 171, in destroy
    DisplayableContainer.destroy(self)
  File "/usr/local/lib/python3.5/dist-packages/ranger/gui/displayable.py", line 291, in destroy
    displayable.destroy()
  File "/usr/local/lib/python3.5/dist-packages/ranger/gui/displayable.py", line 291, in destroy
    displayable.destroy()
  File "/usr/local/lib/python3.5/dist-packages/ranger/gui/widgets/pager.py", line 71, in destroy
    self.clear_image(force=True)
  File "/usr/local/lib/python3.5/dist-packages/ranger/gui/widgets/pager.py", line 60, in clear_image
    self.fm.image_displayer.clear(self.x, self.y, self.wid, self.hei)
  File "/usr/local/lib/python3.5/dist-packages/ranger/ext/img_display.py", line 146, in clear
    self.process.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe

IMAGES / VIDEOS

ranger

@Jab2870
Copy link

@Jab2870 Jab2870 commented May 8, 2017

I am also experiencing similar issues

@dvejmz
Copy link

@dvejmz dvejmz commented Oct 15, 2017

I'm also having this issue, but only in Konsole.

I cannot reproduce the problem in urxvt or gnome-terminal so the problem must be in the way Konsole interprets the request of W3MImageDisplayer to clear the previous image.

@dvejmz
Copy link

@dvejmz dvejmz commented Oct 18, 2017

I did a bit more digging around... This may be an issue with w3mimgdisplay itself rather than ranger. w3mimgdisplay is written primarily with xterm and similar terminal emulators (rxvt) in mind.

I ran a few tests against my installed w3m binary (version w3m/0.5.3+git20170102) in isolation and found the same problems. I used this script to easily draw and clear images on the terminal screen (the script was originally posted here).

After poking w3mimgdisplay from different terminals, I could see we have various degrees of "broken" here, Konsole and Termite being one of the most broken, for instance. xterm seems to work almost flawlessly

859-xterm

gnome-terminal kinda works but a "clear image" w3m-img op will black out the portion of the screen corresponding to the image instead of actually clearing it, as you can see here

859-gnome-terminal

As is already known, urxvt handles w3mimgdisplay nicely too (although not quite as nicely as xterm, but it's up there).

I've dropped this issue on w3m's doorstep to see what they make of it, but I guess for the time being we'll have to make do with what we've got or use a supported terminal :/

At any rate, there are also talks of using a generic, cleaner image displayer like Sixel so perhaps we should pool our efforts to get that going instead...

@make-github-pseudonymous-again
Copy link
Contributor

@make-github-pseudonymous-again make-github-pseudonymous-again commented Nov 18, 2017

Same issue with terminator.

@p3lim
Copy link

@p3lim p3lim commented Dec 26, 2017

Same with termite.

@djgalvan
Copy link

@djgalvan djgalvan commented Feb 8, 2018

Using termite, I don't seem to have issues viewing previews, although a black background does remain when previewing images of different sizes and will remain when navigating into a different directory. I find that if I could automatically send redraw_window when leaving a preview there would be no issues, but have no idea where or how to implement this.

@ghost
Copy link

@ghost ghost commented Apr 6, 2018

Same as what @djgalvan wants. If I could have it redraw the window between each file preview, ranger+termite would be perfect.

@toonn toonn added enhancement and removed bug labels Apr 7, 2018
@alexkubica
Copy link

@alexkubica alexkubica commented May 12, 2018

Sane issue here, using ranger with konsole too.
redraw_window doesn't seem to do anything but somehow hitting ctrl clears the image.

@toonn
Copy link
Member

@toonn toonn commented May 12, 2018

Just ctrl or ctrl-l?

@freed00m
Copy link

@freed00m freed00m commented May 18, 2018

@toonn For me ctrl-l clears it and I am using gnome-terminal.

Also moving mouse cursor over drawn image can removes cca 20px row from the image + the image leftover is often draw over other gnome aps like nautilus. :D so I think it's a xorg/gtk3

See here

2018-05-18-235834_962x703_scrot
issue

@alexkubica
Copy link

@alexkubica alexkubica commented May 22, 2018

@tonttu Both ctrl or ctrl-l clear the image for me.

@tonttu
Copy link
Contributor

@tonttu tonttu commented May 23, 2018

@AlexK-IL that's great, but I think you meant to tell that to @toonn .

@fbob
Copy link

@fbob fbob commented May 28, 2018

same issue here
ranger --v
ranger-stable 1.8.1

Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0]

konsole 17.12.3 on ubuntu 18.04

@x4121
Copy link
Author

@x4121 x4121 commented May 30, 2018

Finally getting rid of konsole and replacing it with alacritty "fixed" it for me. Works flawlessly now 😉

@vifon
Copy link
Member

@vifon vifon commented Jun 1, 2018

Everybody, please check if the issue still occurs after d9bb560. Remember to run ./ranger.py -c or update rc.conf because the new w3m_delay is crucial here.

@ghost
Copy link

@ghost ghost commented Jun 1, 2018

I've now setup urxvt and set ranger to use 'urxvt' for image previews, works much better (although slightly slower).

@thothonegan
Copy link

@thothonegan thothonegan commented Jun 5, 2018

Running current master, with Konsole 18.04.1, it seems to work if i go over a lot of non-images before some images. If i reverse direction in the middle of images (e.g. if you're going down the list, you start going back up), it doesn't clear properly, and if i start ranger in a folder with just images it doesn't clear properly (using w3m_delay 1 as an extreme).

@thothonegan
Copy link

@thothonegan thothonegan commented Jun 5, 2018

Sorry for the noise, that's still the same w3m bug already noted earlier in the thread.

@saranvdev
Copy link

@saranvdev saranvdev commented Aug 16, 2018

Same issue here.

xfce4-terminal 0.8.7.4-1
ranger-master 1.9.1

@Luxed
Copy link

@Luxed Luxed commented Sep 25, 2018

@vifon The commit hasn't resolved the issue for me :/ The delay doesn't do anything unfortunately (it delays the loading of the image but the old one is still present under).
Pressing refreshes the screen and removes the old images.

Terminal: Termite v13
Ranger: ranger-master 1.9.2
Python: 3.7.0

@vifon
Copy link
Member

@vifon vifon commented Sep 25, 2018

Which preview method do you use?

@Luxed
Copy link

@Luxed Luxed commented Sep 25, 2018

oh, I'm so sorry I didn't write that in the comment: I use w3m

EDIT: after testing on my desktop (which I didn't update for at least a week (I'm on Arch-linux)), it worked fine, after the update, it didn't work right anymore.
But ranger and w3m where at the latest version before I updated my system.
The issue seems to come from somewhere else.

@toonn
Copy link
Member

@toonn toonn commented Sep 27, 2018

Maybe the termite version? Isn't there a patch termite for w3m?

@ykyuen
Copy link

@ykyuen ykyuen commented Oct 2, 2018

Same problem for w3m, termite in archlinux.

ranger: 1.9.2.2.g8e9451e6-1
termite: 13-3
python: 3.7.0 (default, Sep 15 2018, 19:13:07) [GCC 8.2.1 20180831]

already set the w3m_delay in rc.conf but still got the same problem.
sc-2018-10-02-10-09-41

Current workaround is to use Ctrl + l to refresh the screen.

@toonn
Copy link
Member

@toonn toonn commented Oct 2, 2018

This is the patch I was referring to.

@XakepSDK
Copy link

@XakepSDK XakepSDK commented Oct 3, 2018

user@arch ~/.config/ranger % ranger --version
ranger version: ranger-master 1.9.1
Python version: 3.7.0 (default, Sep 15 2018, 19:13:07) [GCC 8.2.1 20180831]
Locale: en_US.UTF-8

user@arch ~/.config/ranger % termite --version
termite v13

user@arch ~/.config/ranger % w3m -version
w3m version w3m/0.5.3+git20180125, options lang=en,m17n,image,color,ansi-color,mouse,gpm,menu,cookie,ssl,ssl-verify,external-uri-loader,nntp,ipv6,alarm,mark

Same issue

@toonn
Copy link
Member

@toonn toonn commented Oct 3, 2018

@Luxed, @ykyuen, @XakepSDK, are any of you running that patched termite version?

@zelmor
Copy link

@zelmor zelmor commented Oct 3, 2018

I just wanted to mention that xfce4-terminal in Debian Stable is suffering the same issue. ctrl+l fixes the problem.

ranger 1.7.1-1
w3m-img 0.5.3-34+deb9u1

@toonn
Copy link
Member

@toonn toonn commented Oct 3, 2018

@zelmor, that's probably because of debian stable and its ancient versions ; )

@XakepSDK
Copy link

@XakepSDK XakepSDK commented Oct 3, 2018

@toonn same issue

@ykyuen
Copy link

@ykyuen ykyuen commented Oct 4, 2018

@toonn i tried the patcted termite and still having the same issue

[ykyuen@camus bin]$ ./termite --version
termite v10-152-ga3a888c
@j-degreef
Copy link

@j-degreef j-degreef commented Oct 11, 2018

Hi,
Just to summarize the situation, neither d9bb560 (which apparently only add a comment in the code), neither "set w3m_delay 0.02" (which just delay image display) an neither [https://aur.archlinux.org/packages/termite-ranger-fix-git/] solve this problem.
Tested on Archlinux uptodate
Termite v13
Ranger version: ranger-master 1.9.1
Python version: 3.7.0 (default, Sep 15 2018, 19:13:07) [GCC 8.2.1 20180831]
W3m version w3m/0.5.3+git20180125
Locale: en_US.UTF-8

Only ctrl-l permits to refresh the screen to clean the previous image which is displayed in the background of the current one.

I don't know the code enough to be sure but it seems the right part of the screen is refreshed each time a new text is displayed when browsing directories.
Wouldn't it be possible to make the same for images : simulate a ctrl-l each time a new image or a new text is displayed on a previous image. This would avoid to have image displaying on another one or text displaying on top of an image....

@toonn
Copy link
Member

@toonn toonn commented Oct 12, 2018

The solution you describe isn't really workable. It's only needed for termite which isn't even supported by w3m, tats/w3m#94.

Ideally termite would implement kitty's image protocol or at least sixel. Termite maintainers put the burden of doing so on VTE though. I didn't look further into whether VTE is working on support or considering working on support.

There's also another previewing method in the works #1284 which should work with termite but will probably show growing pains. There's also some work on a previewing method using mpv but it's been neglected.

@zaeph
Copy link
Contributor

@zaeph zaeph commented Oct 28, 2018

On a related note (since it’s probably due to terminator+w3m), the previewed images are overlapping with the file's path on my end.

screen1
(Note that I'm also experiencing the same issue with stacking previews.)

The problem is somewhat alleviated by setting draw_borders to true, but it’s still off:

screen4

@zaeph zaeph mentioned this issue Oct 28, 2018
5 of 9 tasks complete
@herod2k
Copy link

@herod2k herod2k commented Dec 4, 2018

Same issue here.

I have removed ranger and cleared the config files. I have reinstalled it directly from git. I've enabled the image preview inside rc.conf

set preview_images true

as indicated here: https://github.com/ranger/ranger/wiki/Image-Previews

And I'm still getting the error.

I'm using ranger 1.9.2

ranger version: ranger-master 1.9.2
Python version: 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Locale: None.None

Terminals: Terminator 1.9.1 and Gnome-terminal (3.28.2)
Operating system: Ubuntu 18.04 + i3-gaps

The problem appears when I preview an image and it persists until I press ctrl-l or I remove the focus from the window (for this reason I couldn't take a better screenshot, sorry)
photo_2018-12-04_11-41-23

@toonn
Copy link
Member

@toonn toonn commented Dec 4, 2018

All terminals based on libVTE are probably affected by this issue to varying degrees. This includes gnome-terminal, terminator, termite and more.

@SlidingHorn
Copy link

@SlidingHorn SlidingHorn commented Dec 11, 2018

This appears to also affect mate-terminal

Running ranger-stable 1.8.1 on Ubuntu MATE 18.04

@itgoyo
Copy link

@itgoyo itgoyo commented Dec 13, 2018

Same issue here.

I have removed ranger and cleared the config files. I have reinstalled it directly from git. I've enabled the image preview inside rc.conf

set preview_images true

as indicated here: https://github.com/ranger/ranger/wiki/Image-Previews

And I'm still getting the error.

I'm using ranger 1.9.2

ranger version: ranger-master 1.9.2
Python version: 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Locale: None.None

Terminals: Terminator 1.9.1 and Gnome-terminal (3.28.2)
Operating system: Ubuntu 18.04 + i3-gaps

The problem appears when I preview an image and it persists until I press ctrl-l or I remove the focus from the window (for this reason I couldn't take a better screenshot, sorry)
photo_2018-12-04_11-41-23

hello,May I ask you a question? what's your terminal ? is xfce4-terminal or gnome-terminal or i3-sensible-terminal ? I found ranger do not work well in xfce4-terminal.

@herod2k
Copy link

@herod2k herod2k commented Dec 13, 2018

hello,May I ask you a question? what's your terminal ? is xfce4-terminal or gnome-terminal or i3-sensible-terminal ? I found ranger do not work well in xfce4-terminal.

I use terminator (mainly) and sometimes gnome-terminal. In these terminals ranger works perfectly except for the image preview.
Otherwise in RXVT-Unicode, ranger doesn't have any problem with the images (but I don't use it).

@ax3ghazy
Copy link

@ax3ghazy ax3ghazy commented Jan 13, 2019

Same issue here with Konsole and Termite. The issue doesn't happen with Urxvt, Alacritty nor Xfce4-terminal..

@realestninja
Copy link

@realestninja realestninja commented Mar 3, 2019

Same here. URxvt works fine but when using Terminator and navigating through some images, the preview pane gets all messed up with previous images partly overlapped.

Edit:
I abandoned URxvt for Kitty, which is a different terminal. It works well out of the box and absolutely no issues with ranger nor with nerdfonts. I can highly recommend if you have any issues with your current terminal.

@lucaparmigiani
Copy link

@lucaparmigiani lucaparmigiani commented Mar 18, 2019

Same issue with zsh.
I solve the problem adding self.fm.ui.win.redrawwin() in the method clear() of the object W3MImageDisplayer.

try:
            self.fm.ui.win.redrawwin()  # <--- here
            self.process.stdin.write(cmd)
        except IOError as ex:
            if ex.errno == errno.EPIPE:
                return
            raise
        self.process.stdin.flush()
        self.process.stdout.readline(

I don't think this is the best way of solving the issue, but not refreshing the image really annoys me.

Also doing this makes small image not visible.
If you watch carefully you can see them printed but then diseapper.

@huyhoang8398
Copy link

@huyhoang8398 huyhoang8398 commented Apr 26, 2019

same issues with xfce4-terminal, archlinux, w3m

@thexavier666
Copy link

@thexavier666 thexavier666 commented Jun 8, 2019

same issue with gnome-terminal. But i'm using ranger from repo. Ubuntu 18.04

@rodhash
Copy link

@rodhash rodhash commented Sep 26, 2019

Same issue with zsh.
I solve the problem adding self.fm.ui.win.redrawwin() in the method clear() of the object W3MImageDisplayer.

try:
            self.fm.ui.win.redrawwin()  # <--- here
            self.process.stdin.write(cmd)
        except IOError as ex:
            if ex.errno == errno.EPIPE:
                return
            raise
        self.process.stdin.flush()
        self.process.stdout.readline(

I don't think this is the best way of solving the issue, but not refreshing the image really annoys me.

Also doing this makes small image not visible.
If you watch carefully you can see them printed but then diseapper.

Very nice! It seems to have fixed the issue .. in some cases it still happens (huge imgs) but not always any more which is already a great improvement for me!

Update: Actually it seems way more stable now, don't see the issue happening for awhile.. not sure if it had some sort of cache or something but this update really helped, thanks a lot!

Running on xfce4-terminal (0.8.7.4-2.el7) plus tmux 2.9

@dirtydigs
Copy link

@dirtydigs dirtydigs commented Oct 21, 2019

Anyone still looking at this issue, using Konsole I chose the ueberzug method for image preview and no problems at all. Using Manjaro.

@toonn
Copy link
Member

@toonn toonn commented Oct 21, 2019

That's probably the right solution for most people. Note that it's only available in master though. It's coming in the next release, which will happen some time this decade...

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

Successfully merging a pull request may close this issue.

None yet