From 46889a3a32cd07225b653590046a97601166332c Mon Sep 17 00:00:00 2001 From: pagedown Date: Tue, 8 Mar 2022 23:42:41 +0800 Subject: [PATCH] Fix shell integration being disabled with one invalid option --- kitty/options/utils.py | 2 +- kitty/shell_integration.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kitty/options/utils.py b/kitty/options/utils.py index a0e5ab6bc..07b711dca 100644 --- a/kitty/options/utils.py +++ b/kitty/options/utils.py @@ -804,7 +804,7 @@ def shell_integration(x: str) -> FrozenSet[str]: q = frozenset(x.lower().split()) if not q.issubset(s): log_error(f'Invalid shell integration options: {q - s}, ignoring') - return q & s + return q & s or frozenset({'invalid'}) return q diff --git a/kitty/shell_integration.py b/kitty/shell_integration.py index 2af338208..2794b1e02 100644 --- a/kitty/shell_integration.py +++ b/kitty/shell_integration.py @@ -8,7 +8,7 @@ from contextlib import suppress from typing import Dict, List, Optional from .constants import shell_integration_dir -from .options.types import Options +from .options.types import Options, defaults from .utils import log_error, which from .fast_data_types import get_options @@ -170,6 +170,9 @@ def get_effective_ksi_env_var(opts: Optional[Options] = None) -> str: opts = opts or get_options() if 'disabled' in opts.shell_integration: return '' + # Use the default when shell_integration is empty due to misconfiguration + if 'invalid' in opts.shell_integration: + return defaults.shell_integration return ' '.join(opts.shell_integration)