Skip to content

Commit

Permalink
fix: Fix render style support with multiprocessing
Browse files Browse the repository at this point in the history
- Fix: Actually skip style support checks in subprocesses.
- Fix: Export forced support status correctly.
- Fix: Add `jpeg_quality` and `read_from_file` to exported iterm2 style
  attributes.
  • Loading branch information
AnonymouX47 committed Apr 7, 2023
1 parent 2dc4b0b commit 1637a38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/source/concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The available render styles are:
with a density of two pixels per character cell.

Using a render style not supported by the :term:`active terminal` is not allowed by
default. To force the usage of a style that is normally unsupported, add
default. To force the use of such a render style, add
:option:`--force-style <termvisage --force-style>`.


Expand Down
8 changes: 5 additions & 3 deletions src/termvisage/logging_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def __init__(self, *args, redirect_notifs: bool = False, **kwargs):
self._main_process_interrupted = cli.interrupted
self._ImageClass = tui.main.ImageClass
if self._ImageClass: # if the TUI is initialized
self._supported = self._ImageClass._supported
self._forced_support = self._ImageClass.forced_support
self._cell_ratio = cli.args.cell_ratio
self._query_timeout = cli.args.query_timeout
self._swap_win_size = cli.args.swap_win_size
Expand All @@ -81,8 +83,8 @@ def run(self):
try:
if self._ImageClass: # if the TUI is initialized
# The unpickled class object is in the originally defined state
# Eliminates queries for style support checks
self._ImageClass.forced_support = True
self._ImageClass._supported = self._supported # Avoid support check
self._ImageClass.forced_support = self._forced_support
for item in self._style_attrs:
setattr(self._ImageClass, *item)

Expand Down Expand Up @@ -160,7 +162,7 @@ def handle(self, record: _logging.LogRecord):
NOTIF = 1
child_processes = []
exported_style_attrs = {
"iterm2": ("_TERM", "_TERM_VERSION"),
"iterm2": ("_TERM", "_TERM_VERSION", "jpeg_quality", "read_from_file"),
"kitty": ("_TERM", "_TERM_VERSION", "_KITTY_VERSION"),
}

Expand Down

0 comments on commit 1637a38

Please sign in to comment.