Skip to content

Commit efaa45a

Browse files
history: add script-opt to control history size
1 parent 565cb6c commit efaa45a

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

docs/file_browser.conf

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ root_separators=,;
1818
# number of entries to show on the screen at once
1919
num_entries=20
2020

21+
# number of directories to keep in the history.
22+
# A size of 0 disables the history.
23+
history_size=100
24+
2125
# wrap the cursor around the top and bottom of the list
2226
wrap=no
2327

modules/navigation/directory-movement.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function directory_movement.append_history(directory)
5252
g.history.size = g.history.size + 1
5353
g.history.position = g.history.position + 1
5454

55-
if g.history.size > 100 then
55+
if g.history.size > o.history_size then
5656
table.remove(g.history.list, 1)
5757
g.history.size = g.history.size - 1
5858
end
@@ -96,7 +96,7 @@ function directory_movement.goto_directory(directory, moving_adjacent, store_his
9696
end
9797
end
9898

99-
if store_history == nil or store_history then
99+
if o.history_size > 0 and store_history == nil or store_history then
100100
directory_movement.append_history(directory)
101101
end
102102
return scanning.rescan(moving_adjacent or false)

modules/options.lua

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ local o = {
1212
--number of entries to show on the screen at once
1313
num_entries = 20,
1414

15+
--number of directories to keep in the history
16+
history_size = 100,
17+
1518
--wrap the cursor around the top and bottom of the list
1619
wrap = false,
1720

0 commit comments

Comments
 (0)