diff options
author | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2018-06-01 22:14:06 +0200 |
---|---|---|
committer | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2018-06-01 22:14:06 +0200 |
commit | 0045755469b253436c847e0e0d600941252f4a5f (patch) | |
tree | 93a831dc363e99a3bd4673ce0c7ccd9e482193a8 /ranger | |
parent | 37d26620d0f43baf8a46dff323d9268f4fe64097 (diff) | |
download | ranger-0045755469b253436c847e0e0d600941252f4a5f.tar.gz |
Make the w3m delay configurable
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/config/rc.conf | 4 | ||||
-rw-r--r-- | ranger/container/settings.py | 1 | ||||
-rw-r--r-- | ranger/ext/img_display.py | 7 |
3 files changed, 9 insertions, 3 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 1296f1ca..58d6d243 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -95,6 +95,10 @@ set preview_images false # whole terminal window. set preview_images_method w3m +# Delay in seconds before displaying an image with the w3m method. +# Increase it in case of experiencing display corruption. +set w3m_delay 0.02 + # Default iTerm2 font size (see: preview_images_method: iterm2) set iterm2_font_width 8 set iterm2_font_height 11 diff --git a/ranger/container/settings.py b/ranger/container/settings.py index a7707ff0..11097cec 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -91,6 +91,7 @@ ALLOWED_SETTINGS = { 'vcs_backend_hg': str, 'vcs_backend_svn': str, 'viewmode': str, + 'w3m_delay': float, 'wrap_scroll': bool, 'xterm_alt_key': bool, } diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index f423830f..4f447f39 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -60,7 +60,7 @@ class ImageDisplayer(object): pass -class W3MImageDisplayer(ImageDisplayer): +class W3MImageDisplayer(ImageDisplayer, FileManagerAware): """Implementation of ImageDisplayer using w3mimgdisplay, an utilitary program from w3m (a text-based web browser). w3mimgdisplay can display images either in virtual tty (using linux framebuffer) or in a Xorg session. @@ -123,8 +123,9 @@ class W3MImageDisplayer(ImageDisplayer): # Mitigate the issue with the horizontal black bars when # selecting some images on some systems. 2 milliseconds seems # enough. Adjust as necessary. - from time import sleep - sleep(0.02) + if self.fm.settings.w3m_delay > 0: + from time import sleep + sleep(self.fm.settings.w3m_delay) self.process.stdin.write(input_gen) self.process.stdin.flush() |