mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-14 01:20:31 +03:00
macOS: Fix regression in 0.26.0 that caused asking the user for a line of input such as for set_tab_title to not work
Apparently libedit doesn't work in the forked process when the parent process is run via Launch Services. I cant be bothered to investigate why, given that libedit is closed source. macOS users will just have to live without history/completion in the ask kitten until I get around to writing a replacement for readline/libedit. And on a personal note, macOS >> Necrotizing fasciitis Fixes #5447
This commit is contained in:
parent
644e46e91d
commit
d8e43a3412
@ -42,6 +42,8 @@ Detailed list of changes
|
||||
|
||||
- Fix regression in 0.26.0 that caused launching kitty without working STDIO handles to result in high CPU usage and prewarming failing (:iss:`5444`)
|
||||
|
||||
- macOS: Fix regression in 0.26.0 that caused asking the user for a line of input such as for :ac:`set_tab_title` to not work (:iss:`5447`)
|
||||
|
||||
0.26.1 [2022-08-30]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -158,14 +158,17 @@ def extra_for(width: int, screen_width: int) -> int:
|
||||
|
||||
class Password(Handler):
|
||||
|
||||
def __init__(self, cli_opts: AskCLIOptions, prompt: str) -> None:
|
||||
def __init__(self, cli_opts: AskCLIOptions, prompt: str, is_password: bool = True, initial_text: str = '') -> None:
|
||||
self.cli_opts = cli_opts
|
||||
self.prompt = prompt
|
||||
self.initial_text = initial_text
|
||||
from kittens.tui.line_edit import LineEdit
|
||||
self.line_edit = LineEdit(is_password=True)
|
||||
self.line_edit = LineEdit(is_password=is_password)
|
||||
|
||||
def initialize(self) -> None:
|
||||
self.cmd.set_cursor_shape('beam')
|
||||
if self.initial_text:
|
||||
self.line_edit.on_text(self.initial_text, True)
|
||||
self.draw_screen()
|
||||
|
||||
@Handler.atomic_update
|
||||
@ -205,7 +208,7 @@ class Password(Handler):
|
||||
return ''
|
||||
|
||||
|
||||
class Choose(Handler):
|
||||
class Choose(Handler): # {{{
|
||||
mouse_tracking = MouseTracking.buttons_only
|
||||
|
||||
def __init__(self, cli_opts: AskCLIOptions) -> None:
|
||||
@ -441,6 +444,7 @@ class Choose(Handler):
|
||||
def on_interrupt(self) -> None:
|
||||
self.quit_loop(1)
|
||||
on_eot = on_interrupt
|
||||
# }}}
|
||||
|
||||
|
||||
def main(args: List[str]) -> Response:
|
||||
@ -472,6 +476,15 @@ def main(args: List[str]) -> Response:
|
||||
loop.loop(phandler)
|
||||
return {'items': items, 'response': phandler.response}
|
||||
|
||||
rd = getattr(sys, 'kitty_run_data')
|
||||
if 'prewarmed' in rd and 'launched_by_launch_services' in rd:
|
||||
# bloody libedit doesnt work in the prewarmed process run from launch
|
||||
# services for reasons I really dont care enough to investigate
|
||||
loop = Loop()
|
||||
phandler = Password(cli_opts, prompt, is_password=False, initial_text=cli_opts.default or '')
|
||||
loop.loop(phandler)
|
||||
return {'items': items, 'response': phandler.response}
|
||||
|
||||
import readline as rl
|
||||
readline = rl
|
||||
from kitty.shell import init_readline
|
||||
|
@ -379,6 +379,7 @@ def _main() -> None:
|
||||
if is_macos and os.environ.pop('KITTY_LAUNCHED_BY_LAUNCH_SERVICES', None) == '1':
|
||||
os.chdir(os.path.expanduser('~'))
|
||||
args = macos_cmdline(args)
|
||||
getattr(sys, 'kitty_run_data')['launched_by_launch_services'] = True
|
||||
try:
|
||||
cwd_ok = os.path.isdir(os.getcwd())
|
||||
except Exception:
|
||||
|
Loading…
Reference in New Issue
Block a user