From ffcf65ec4323613deff7c6fa7f92843d58879e41 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 10 Feb 2011 16:13:28 +0100 Subject: /help completion --- src/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index ae3bc55b..91b427a7 100644 --- a/src/core.py +++ b/src/core.py @@ -115,7 +115,7 @@ class Core(object): # The completion function should return True if a completion was # made ; False otherwise self.commands = { - 'help': (self.command_help, '\_o< KOIN KOIN KOIN', None), + 'help': (self.command_help, '\_o< KOIN KOIN KOIN', self.completion_help), 'join': (self.command_join, _("Usage: /join [room_name][@server][/nick] [password]\nJoin: Join the specified room. You can specify a nickname after a slash (/). If no nickname is specified, you will use the default_nick in the configuration file. You can omit the room name: you will then join the room you\'re looking at (useful if you were kicked). You can also provide a room_name without specifying a server, the server of the room you're currently in will be used. You can also provide a password to join the room.\nExamples:\n/join room@server.tld\n/join room@server.tld/John\n/join room2\n/join /me_again\n/join\n/join room@server.tld/my_nick password\n/join / password"), self.completion_join), 'exit': (self.command_quit, _("Usage: /exit\nExit: Just disconnect from the server and exit poezio."), None), 'next': (self.rotate_rooms_right, _("Usage: /next\nNext: Go to the next room."), None), @@ -1003,6 +1003,10 @@ class Core(object): msg = _('Unknown command: %s') % args[0] self.information(msg) + def completion_help(self, the_input): + commands = list(self.commands.keys()) + list(self.current_tab().commands.keys()) + return the_input.auto_completion(commands, ' ') + def command_status(self, arg): args = arg.split() if len(args) < 1: -- cgit v1.2.3 From 30f9f2b0559bdb045e003bfa7c0c53a3fa9f4c07 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 10 Feb 2011 16:15:33 +0100 Subject: Fix the /help command with commands of the current tab --- src/core.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 91b427a7..b3119499 100644 --- a/src/core.py +++ b/src/core.py @@ -999,6 +999,8 @@ class Core(object): if len(args) >= 1: if args[0] in list(self.commands.keys()): msg = self.commands[args[0]][1] + elif args[0] in list(self.current_tab().commands.keys()): + msg = self.current_tab().commands[args[0]][1] else: msg = _('Unknown command: %s') % args[0] self.information(msg) -- cgit v1.2.3 From 6ed087a65c1e7fdc020f11b5247a8feeac7b3517 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 10 Feb 2011 16:18:17 +0100 Subject: Fix /list completion (complete the servers only) --- src/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index b3119499..41ec12f2 100644 --- a/src/core.py +++ b/src/core.py @@ -1134,7 +1134,7 @@ class Core(object): for tab in self.tabs: # TODO, also from an history if isinstance(tab, tabs.MucTab) and\ tab.get_name() not in muc_serv_list: - muc_serv_list.append(tab.get_name()) + muc_serv_list.append(JID(tab.get_name()).server) if muc_serv_list: return the_input.auto_completion(muc_serv_list, ' ') -- cgit v1.2.3 From ac99467965ba04282b6dbc63c5c04ab91ba1b007 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 13 Feb 2011 22:28:35 +0100 Subject: Make the tab collectable by remove self references when closing them. --- src/core.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 41ec12f2..98d2a7fa 100644 --- a/src/core.py +++ b/src/core.py @@ -1303,6 +1303,8 @@ class Core(object): tab.on_close() self.tabs.remove(tab) self.rotate_rooms_left() + del tab.key_func # Remove self references + del tab.commands # and make the object collectable del tab def move_separator(self): -- cgit v1.2.3