yasmin_editor.editor_gui.recent_files module

Helpers for storing and curating recently opened editor documents.

class yasmin_editor.editor_gui.recent_files.RecentFilesStore(file_path: str | Path | None = None, *, max_entries: int = 10)

Bases: object

Persist recent editor documents in a small JSON file.

add_file(file_path: str, current_entries: Iterable[str] | None = None) list[str]

Add one file path to the persistent recent-files list.

clear() None

Clear all persisted recent-file entries.

load_entries(*, existing_only: bool = False) list[str]

Load recent-file entries from disk.

Invalid or unreadable files degrade gracefully to an empty list so the editor startup path does not fail because of configuration issues.

remove_file(file_path: str, current_entries: Iterable[str] | None = None) list[str]

Remove one file path from the persistent recent-files list.

save_entries(file_paths: Iterable[str]) list[str]

Write recent-file entries to disk and return the stored list.

yasmin_editor.editor_gui.recent_files.default_recent_files_store_path() Path

Return the default JSON file used for recent document persistence.

yasmin_editor.editor_gui.recent_files.normalize_recent_file_path(file_path: str) str

Return one canonical form for a recent-document path.

yasmin_editor.editor_gui.recent_files.prune_recent_file_entries(file_paths: Iterable[str], *, existing_only: bool = False) list[str]

Return cleaned recent-file entries with optional existence filtering.

yasmin_editor.editor_gui.recent_files.update_recent_file_entries(file_paths: Iterable[str], file_path: str, *, max_entries: int = 10) list[str]

Move one path to the front of the recent-files list.