Let the history be pruned, and keep the settings window open on save

The History tab was read-only, so the only way to get rid of a dictation
was to edit history.jsonl by hand. Entries can now be removed: right-click
or Delete drops the selection, "Clear history" empties the file, and the
Ctrl/Shift selection lets several go at once. Deleting more than one asks
first, since there is no undo.

The cap on the file has existed since the first commit but was never
reachable from the interface. It is now a spinbox in the same tab, applied
the moment you save rather than on the next dictation, and 0 turns it off.
Trimming rewrites the file only when it is actually over the cap, instead
of on every single dictation, and does it through a temporary file so a
crash cannot leave a half-written history behind.

Deletion matches an entry on its whole content, not on its line number: the
worker may well have appended a new dictation while the window sat open.

Save no longer closes the window. It confirms and stays put, so you can
settle several things in one sitting; the cross closes it. Cancel is gone
with it, because it would be a lie next to a Save that already wrote.
This commit is contained in:
yusufipk
2026-07-25 20:07:36 +07:00
parent 60c8006725
commit 2cbc369132
4 changed files with 175 additions and 26 deletions
+4 -1
View File
@@ -113,7 +113,10 @@ class Pipeline(QObject):
"raw": raw,
"text": text,
})
cfg.trim_history(conf["history_limit"])
try:
cfg.trim_history(conf["history_limit"])
except OSError as exc:
print(f"dikte: could not trim the history: {exc}", file=sys.stderr)
self.finished.emit(raw, text, warning)
except (api.ApiError, paste.PasteError) as exc: