~lioploum/offpunk-devel

Fix None prompt until manually changed v1 PROPOSED

Austreelis: 1
 Fix None prompt until manually changed

 1 files changed, 2 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~lioploum/offpunk-devel/patches/44956/mbox | git am -3
Learn more about email & git

[PATCH] Fix None prompt until manually changed Export this patch

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 <dev@austreelis.net>
---
 offpunk.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/offpunk.py b/offpunk.py
index 61e79b9..9234fdf 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 = []
-- 
2.41.0