Skip to content

Commit

Permalink
fix: try child foreground cwd instead of root (#234)
Browse files Browse the repository at this point in the history
closes #233
  • Loading branch information
mikesmithgh committed Apr 18, 2024
1 parent 6314885 commit 70f148a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions python/kitty_scrollback_nvim.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ def parse_config(args):
return 'ksb_builtin_get_text_all'


def parse_cwd(args):
def parse_cwd(args, default_cwd):
for idx, arg in reversed(list(enumerate(args))):
if arg == '--cwd' and (idx + 1 < len(args)):
cwd_args = args[idx + 1]
del args[idx:idx + 2]
return ('--cwd', cwd_args)
return ('--cwd', 'root')
if default_cwd:
return ('--cwd', default_cwd)
return ()


def nvim_err_cmd(err_file):
Expand Down Expand Up @@ -160,7 +162,7 @@ def handle_result(args: List[str],
return

config = parse_config(args)
cwd = parse_cwd(args)
cwd = parse_cwd(args, w.child.foreground_cwd)
env = parse_env(args)
tmux_data = parse_tmux_env(env)
kitty_data_str = pipe_data(w,
Expand Down

0 comments on commit 70f148a

Please sign in to comment.