Compare commits

...

2 Commits

Author SHA1 Message Date
Austreelis 39c5f17a39 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 <dev@austreelis.net>
2023-09-23 11:00:35 +02:00
Lionel Dricot f8d185eac9 ignoring encoding errors in ansicat 2023-09-23 10:42:45 +02:00
3 changed files with 4 additions and 2 deletions

View File

@ -10,6 +10,7 @@ Changes since beta1
- fixes existing non-html ressources marked a to_fetch even when not needed (simple and/or confusion)
- attempt at hiding XMLparsedAsHTMLWarning from BS4 library
- chafa now used by default everywhere if version > 1.10
- ignoring encoding error in ansicat
## 2.0-beta1 - September 05th 2023
This is an an experimental release. Bug reports and feedbacks are welcome on the offpunk-devel list.

View File

@ -1247,7 +1247,7 @@ def renderer_from_file(path,url=None,theme=None):
url = path
if os.path.exists(path):
if mime.startswith("text/") or mime in _FORMAT_RENDERERS:
with open(path) as f:
with open(path,errors="ignore") as f:
content = f.read()
f.close()
else:

View File

@ -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 = []