From 39c5f17a39b8f17482eb1a1a4ad63760c83a3ca6 Mon Sep 17 00:00:00 2001 From: Austreelis Date: Sat, 23 Sep 2023 02:08:48 +0200 Subject: [PATCH] Fix None prompt until manually changed The GeminiClient's constructor expected set_prompt to return the prompt, while the function directly mutated it without returning anything. This manifested as having "None" as prompt instead of the default "ON>", until entering the offline command. This patch both fixes the constructor by not setting self.prompt to the result of GeminiClient.set_prompt, *and* make that function return the prompt as well. Each of those is a separated hunk, feel free to only apply whichever feels best (though applying both should warrant any future mistake of the sort). Signed-off-by: Austreelis --- offpunk.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/offpunk.py b/offpunk.py index 8526e03..9f9997f 100755 --- a/offpunk.py +++ b/offpunk.py @@ -142,7 +142,7 @@ class GeminiClient(cmd.Cmd): os.umask(0o077) self.opencache = opnk.opencache() self.theme = offthemes.default - self.prompt = self.set_prompt("ON") + self.set_prompt("ON") self.current_url = None self.hist_index = 0 self.marks = {} @@ -222,6 +222,7 @@ class GeminiClient(cmd.Cmd): self.prompt = "\001\x1b[%sm\002"%open_color + prompt + "\001\x1b[%sm\002"%close_color + "> " #support for 256 color mode: #self.prompt = "\001\x1b[38;5;76m\002" + "ON" + "\001\x1b[38;5;255m\002" + "> " + "\001\x1b[0m\002" + return self.prompt def complete_list(self,text,line,begidx,endidx): allowed = []