Skip to content

Commit

Permalink
added option "idle_delay"
Browse files Browse the repository at this point in the history
per request of nfnty
  • Loading branch information
hut committed Oct 31, 2014
1 parent 4e73fe4 commit cb7674d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
7 changes: 6 additions & 1 deletion doc/ranger.1
Expand Up @@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "RANGER 1"
.TH RANGER 1 "ranger-1.6.1" "10/15/2014" "ranger manual"
.TH RANGER 1 "ranger-1.6.1" "10/31/2014" "ranger manual"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
Expand Down Expand Up @@ -669,6 +669,11 @@ this pattern will hide all files that start with a dot or end with a tilde.
.Vb 1
\& set hidden_filter ^\e.|~$
.Ve
.IP "idle_delay [integer]" 4
.IX Item "idle_delay [integer]"
The delay that ranger idly waits for user input, in milliseconds, with a
resolution of 100ms. Lower delay reduces lag between directory updates but
increases \s-1CPU\s0 load.
.IP "max_console_history_size [integer, none]" 4
.IX Item "max_console_history_size [integer, none]"
How many console commands should be kept in history? \*(L"none\*(R" will disable the
Expand Down
6 changes: 6 additions & 0 deletions doc/ranger.pod
Expand Up @@ -655,6 +655,12 @@ this pattern will hide all files that start with a dot or end with a tilde.

set hidden_filter ^\.|~$

=item idle_delay [integer]

The delay that ranger idly waits for user input, in milliseconds, with a
resolution of 100ms. Lower delay reduces lag between directory updates but
increases CPU load.

=item max_console_history_size [integer, none]

How many console commands should be kept in history? "none" will disable the
Expand Down
5 changes: 5 additions & 0 deletions ranger/config/rc.conf
Expand Up @@ -169,6 +169,11 @@ set preview_max_size 0
# Add the highlighted file to the path in the titlebar
set show_selection_in_titlebar true

# The delay that ranger idly waits for user input, in milliseconds, with a
# resolution of 100ms. Lower delay reduces lag between directory updates but
# increases CPU load.
set idle_delay 2000

# ===================================================================
# == Local Options
# ===================================================================
Expand Down
1 change: 1 addition & 0 deletions ranger/container/settings.py
Expand Up @@ -25,6 +25,7 @@
'draw_progress_bar_in_status_bar': bool,
'flushinput': bool,
'hidden_filter': str,
'idle_delay': int,
'max_console_history_size': (int, type(None)),
'max_history_size': (int, type(None)),
'mouse_enabled': bool,
Expand Down
4 changes: 3 additions & 1 deletion ranger/gui/ui.py
Expand Up @@ -117,7 +117,9 @@ def set_load_mode(self, boolean):
self.win.nodelay(1)
else:
self.win.nodelay(0)
curses.halfdelay(20)
# Sanitize halfdelay setting
halfdelay = min(255, max(1, self.settings.idle_delay // 100))
curses.halfdelay(halfdelay)

def destroy(self):
"""Destroy all widgets and turn off curses"""
Expand Down

0 comments on commit cb7674d

Please sign in to comment.