Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: report parent directory of input_path as last_directory #519

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

mikavilpas
Copy link
Owner

@mikavilpas mikavilpas commented Oct 16, 2024

Background

When yazi is started too late, it can happen that we don't know what the
last_directory was when yazi has exited. When this happens, yazi has
already reported its cd event before ya starts and yazi.nvim cannot
capture it.

The issue can be tracked in sxyazi/yazi#1314

Issue

Currently yazi.nvim works around this limitation by using the parent
directory of the input_path as the last_directory since it's a good guess.

However, it looks like this has never worked reliably due to a bug in the
implementation. The correct directory was calculated, but it was not
assigned to the last_directory field in the state - it was ignored and
had no effect.

Solution

Assign the correct directory to the last_directory field in the state.

@mikavilpas mikavilpas force-pushed the report-correct-last-directory branch from 8ab332f to 0e06c5a Compare October 16, 2024 16:18
Background
==========

When yazi is started too late, it can happen that we don't know what the
last_directory was when yazi has exited. When this happens, yazi has
already reported its `cd` event before `ya` starts and yazi.nvim cannot
capture it.

The issue can be tracked in sxyazi/yazi#1314

Issue
=====

Currently yazi.nvim works around this limitation by using the parent
directory of the input_path as the last_directory since it's a good guess.

However, it looks like this has never worked reliably due to a bug in the
implementation. The correct directory was calculated, but it was not
assigned to the last_directory field in the state - it was ignored and
had no effect.

Solution
========

Assign the correct directory to the last_directory field in the state.
@mikavilpas mikavilpas force-pushed the report-correct-last-directory branch from 0e06c5a to 6295532 Compare October 16, 2024 17:13
@mikavilpas mikavilpas enabled auto-merge (squash) October 16, 2024 17:14
@mikavilpas mikavilpas merged commit 9ff955a into main Oct 16, 2024
16 checks passed
@mikavilpas mikavilpas deleted the report-correct-last-directory branch October 16, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant