dece 3 years ago
parent 7ed83f9389
commit 016e4a49f9

@ -782,8 +782,8 @@ class Browser:
page = self.current_page page = self.current_page
if not page: if not page:
return return
mime = page.mime.short if page.mime else "(unknown MIME type)" mime = page.mime.short if page.mime else "unk. MIME"
encoding = page.encoding or "(unknown encoding)" encoding = page.encoding or "unk. encoding"
size = f"{len(page.source)} chars" size = f"{len(page.source)} chars"
lines = f"{len(page.metalines)} lines" lines = f"{len(page.metalines)} lines"
info = f"{mime} {encoding} {size} {lines}" info = f"{mime} {encoding} {size} {lines}"

@ -103,11 +103,11 @@ def get_help(config, plugins):
) )
config_list = "\n".join( config_list = "\n".join(
( (
f"* {key} = {value} (default {repr(DEFAULT_CONFIG[key])})" f"* {key} = {config[key]} (default {repr(DEFAULT_CONFIG[key])})"
if value != DEFAULT_CONFIG[key] if config[key] != DEFAULT_CONFIG[key]
else f"* {key} = {value}" else f"* {key} = {config[key]}"
) )
for key, value in config.items() for key in sorted(config)
) )
return HELP_PAGE.format( return HELP_PAGE.format(
plugin_commands=plugin_commands, plugin_commands=plugin_commands,

@ -4,7 +4,7 @@ Currently contains only overrides for render modes, per URL path. In the future
it may be interesting to move a few things from the config to here, such as the it may be interesting to move a few things from the config to here, such as the
text width. text width.
This is a map from an URL to dicts. The only used key is render_mode. This is a map from URLs to dicts. The only used key is render_mode.
""" """
import json import json
@ -25,7 +25,7 @@ def load_capsule_prefs(prefs_path: Path) -> Optional[dict]:
return prefs return prefs
def save_capsule_prefs(prefs: dict, prefs_path: Path): def save_capsule_prefs(prefs: dict, prefs_path: Path) -> bool:
"""Save the capsule preferences. Return True on success.""" """Save the capsule preferences. Return True on success."""
try: try:
with open(prefs_path, "wt") as prefs_file: with open(prefs_path, "wt") as prefs_file:

@ -1,4 +1,4 @@
"""Rendering Gemtext in curses.""" """Rendering metalines in curses."""
import curses import curses

Loading…
Cancel
Save