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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement flags for synchronizing the image list when changing the working directory #792

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

karlch
Copy link
Owner

@karlch karlch commented Mar 19, 2024

Add flags to syncrhonize the image file list when changing the working directory:

I believe this is as close as we will get to the ideas in #132 without going full-on async - which probably won't happen anytime soon (ever? 馃槩 ) given the time constraints for working on vimiv.

The odd outliers are when the image filelist is not in sync with a directory, e.g., when loading tags or opening images from multiple directories. However, this is not something the library (or opening a directory) would care about and sits on the other end of the spectrum.

Anyone still interested in testing this after such a long time? @mcp292 or @jcjgraf ? 馃槉

fixes #694 - along with the inconsistency noticed on initial testing ~7 months ago
fixes #132 - as we realistically won't go further into the async realm

In the library, this option will autoload the images in the newly opened
directory.

Related to #694 and #132.
Instead of having the working directory handler directly load the
directory, we now defer this to the LibraryModel. This way, the model
can decide if the path selected in the new directory is an image. If
yes, load it - with this image focused.

Thus, we don't end up jumping positions like previously, when we enter a
directory that:
* Has images
* Has an image in the stored position
Where:
1) We would load the directory into the library => paths visible in
   library
2) We would load the stored position => new path selected
3) We would load all images into the image filelist
4) We would open the first image
5) The library would select the first image => jump to new path which is
   not desirable
1) The stored path is an image => load images and select this one
2) There are images in the directory => load images and select the first
   image, overriding any stored directory
3) There are no images in the new directory => clear images

This comes very close to the preferred behaviour in #132, except for the
async part which we are omitting, in favour of the *optional*
--open-selected flag.
This emulates the behaviour of :scroll left/right --open-selected by
directly setting autoload in the library.
The image filelist should be empty when running
:scroll left --open-selected and entering a directory without any
images.
React to the emitted signal, instead of exclusively emitting it.
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.

First image in directory not shown Reload image/thumbnail mode when working directory changes
1 participant