diff options
author | hut <hut@lavabit.com> | 2010-03-17 12:38:21 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-03-17 12:38:21 +0100 |
commit | 9207e83c0672c6b8b49fce3b621197fb1e77b2be (patch) | |
tree | 80d8d2875291fc29a21b94b00b460e51302c6401 | |
parent | 9a735f62cfb4a16eb711750883f68f8099508f4b (diff) | |
download | ranger-9207e83c0672c6b8b49fce3b621197fb1e77b2be.tar.gz |
fixed #69: tab completion breaks with Apps subclass
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | ranger/api/apps.py | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/TODO b/TODO index 964cccc9..f20d542e 100644 --- a/TODO +++ b/TODO @@ -70,7 +70,7 @@ Bugs (X) #62 10/02/15 curs_set can raise an exception (X) #65 10/02/16 "source ranger ranger some/file.txt" shouldn't cd after exit ( ) #67 10/03/08 terminal title in tty - ( ) #69 10/03/11 tab-completion breaks with Apps subclass + (X) #69 10/03/11 tab-completion breaks with Apps subclass Ideas diff --git a/ranger/api/apps.py b/ranger/api/apps.py index e61b5e2c..a17a6601 100644 --- a/ranger/api/apps.py +++ b/ranger/api/apps.py @@ -112,8 +112,12 @@ class Applications(FileManagerAware): def all(self): """Returns a list with all application functions""" - methods = self.__class__.__dict__ - return [meth[4:] for meth in methods if meth.startswith('app_')] + result = set() + # go through all the classes in the mro (method resolution order) + # so subclasses will return the apps of their superclasses. + for cls in self.__class__.__mro__: + result |= set(m[4:] for m in cls.__dict__ if m.startswith('app_')) + return sorted(result) def tup(*args): |