From 1266ac35187ccee19709c79bef596dba94cc5a2a Mon Sep 17 00:00:00 2001 From: Psychedelic Squid Date: Wed, 20 Apr 2011 05:32:16 +0100 Subject: [PATCH] New '/link [notice number]' syntax, equivalent to '/link 1 [notice number]'. Resolves bug 18 . --- README | 3 +++ src/identicurse/identicurse.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README b/README index 609f57d..42a33b2 100644 --- a/README +++ b/README @@ -278,6 +278,9 @@ Available commands are as follows: There is also an alias for this: "/links [notice number]". (See also 'ADVANCED CONFIGURATION, Link opening' section below.) +/link [notice number] + As above, but the first link in the notice is selected. + /alias [alias] [command] This will create the alias given as an alias for the command given. For example: diff --git a/src/identicurse/identicurse.py b/src/identicurse/identicurse.py index a08f7c7..db81bdc 100644 --- a/src/identicurse/identicurse.py +++ b/src/identicurse/identicurse.py @@ -1173,8 +1173,11 @@ def parse_input(self, input): elif tokens[0] == "/alias" and len(tokens) >= 3: self.cmd_alias(tokens[1], " ".join(tokens[2:])) - elif tokens[0] == "/link": - self.cmd_link(self.tabs[self.current_tab].timeline[int(tokens[2]) - 1], tokens[1]) + elif tokens[0] == "/link" and len(tokens) >= 2: + if len(tokens) == 2: # only notice number given, assume first link + self.cmd_link(self.tabs[self.current_tab].timeline[int(tokens[1]) - 1], 1) + else: # notice number and link number given + self.cmd_link(self.tabs[self.current_tab].timeline[int(tokens[2]) - 1], tokens[1]) elif tokens[0] == "/bugreport" and len(tokens) >= 2: update = self.cmd_bugreport(" ".join(tokens[1:]))