1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

avoid doing the cleanup every time

This commit is contained in:
Joël Schaerer 2010-07-21 16:48:35 +02:00
parent 1be62c7ad2
commit 0f3a6b4b20

View File

@ -22,7 +22,7 @@ from sys import argv,exit,stderr
import os import os
import signal import signal
max_keyweight=1000 max_keyweight=1000
max_stored_paths=300 max_stored_paths=400
completion_separator='__' completion_separator='__'
def signal_handler(arg1,arg2): def signal_handler(arg1,arg2):
@ -62,7 +62,8 @@ def forget(path_dict,dic_file):
def clean_dict(sorted_dirs,path_dict): def clean_dict(sorted_dirs,path_dict):
"""Limits the sized of the path_dict to max_stored_paths. Returns True if keys were deleted""" """Limits the sized of the path_dict to max_stored_paths. Returns True if keys were deleted"""
if len(sorted_dirs) > max_stored_paths: if len(sorted_dirs) > max_stored_paths:
for dir,dummy in sorted_dirs[max_stored_paths:]: #remove 25 more than needed, to avoid doing it every time
for dir,dummy in sorted_dirs[max_stored_paths-25:]:
del path_dict[dir] del path_dict[dir]
return True return True
else: return False else: return False