From 7800c598f659c2f9e9af4c2d42e2de947e6d53a0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 23 Feb 2022 22:38:54 +0530 Subject: [PATCH] hints kitten: Fix a regression that broke recognition of path:linenumber:colnumber Fixes #4675 --- docs/changelog.rst | 2 ++ kittens/hints/main.py | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index a67b49d53..a9dfa1ced 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -90,6 +90,8 @@ Detailed list of changes - Splits layout: A new value for :option:`launch --location` to auto-select the split axis when splitting existing windows. Wide windows are split side-by-side and tall windows are split one-above-the-other +- hints kitten: Fix a regression that broke recognition of path:linenumber:colnumber (:iss:`4675`) + - Fix a regression in the previous release that broke :opt:`active_tab_foreground` (:iss:`4620`) - Fix :ac:`show_last_command_output` not working when the output is stored diff --git a/kittens/hints/main.py b/kittens/hints/main.py index 130aebcf6..8b7e92264 100644 --- a/kittens/hints/main.py +++ b/kittens/hints/main.py @@ -703,9 +703,18 @@ def main(args: List[str]) -> Optional[Dict[str, Any]]: def linenum_handle_result(args: List[str], data: Dict[str, Any], target_window_id: int, boss: BossType, extra_cli_args: Sequence[str], *a: Any) -> None: + pat = re.compile(r':(\d+)$') for m, g in zip(data['match'], data['groupdicts']): if m: path, line = g['path'], g['line'] + # look for trailers on path of the for :number + while True: + m = pat.search(path) + if m is None: + break + line = m.group(1) + path = path[:-len(m.group())] + path = os.path.expanduser(path.split(':')[-1]) line = int(line) break