diff --git a/kitty/boss.py b/kitty/boss.py index 6dbb31c4a..60cc54bc6 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -1346,7 +1346,7 @@ class Boss: # the system less before macOS 12.3 barfs up OSC codes, so sanitize them ourselves sentinel = os.path.join(cache_dir(), 'less-is-new-enough') if not os.path.exists(sentinel): - if less_version() >= 581: + if less_version(cmd[0]) >= 581: open(sentinel, 'w').close() else: bdata = re.sub(br'\x1b\].*?\x1b\\', b'', bdata) diff --git a/kitty/rc/scroll_window.py b/kitty/rc/scroll_window.py index dcf63aa72..5f633c932 100644 --- a/kitty/rc/scroll_window.py +++ b/kitty/rc/scroll_window.py @@ -41,7 +41,7 @@ class ScrollWindow(RemoteCommand): pages = 'p' in amt unscroll = 'u' in amt mult = -1 if amt.endswith('-') and not unscroll else 1 - q = int(amt.rstrip('+-pu')) + q = int(amt.rstrip('+-plu')) amount = q * mult, 'p' if pages else ('u' if unscroll else 'l') return {'match': opts.match, 'amount': amount} diff --git a/kitty/utils.py b/kitty/utils.py index e93378e28..15cbcfe44 100644 --- a/kitty/utils.py +++ b/kitty/utils.py @@ -953,7 +953,7 @@ def macos_version() -> Tuple[int, ...]: return tuple(map(int, platform.mac_ver()[0].split('.'))) -@run_once +@lru_cache(maxsize=2) def less_version(less_exe: str = 'less') -> int: import subprocess o = subprocess.check_output([less_exe, '-V'], stderr=subprocess.STDOUT).decode() diff --git a/shell-integration/ssh/bootstrap-utils.sh b/shell-integration/ssh/bootstrap-utils.sh index 90f1e4412..ad7b91e15 100644 --- a/shell-integration/ssh/bootstrap-utils.sh +++ b/shell-integration/ssh/bootstrap-utils.sh @@ -15,7 +15,6 @@ mv_files_and_dirs() { cd "$cwd" } - compile_terminfo() { tname=".terminfo" # Ensure the 78 dir is present @@ -40,7 +39,6 @@ compile_terminfo() { fi } - parse_passwd_record() { printf "%s" "$(command grep -o '[^:]*$')" } @@ -152,7 +150,7 @@ execute_sh_with_posix_env() { command "$login_shell" -l -c ":" > /dev/null 2> /dev/null && return [ -z "$shell_integration_dir" ] && die "Could not read data over tty ssh kitten cannot function" sh_dir="$shell_integration_dir/sh" - command mkdir -p "$sh_dir" || die "Creating $sh_dir failed" + command mkdir -p "$sh_dir" || die "Creating directory $sh_dir failed" sh_script="$sh_dir/login_shell_env.sh" # Source /etc/profile, ~/.profile, and then check and source ENV printf "%s" '