Skip to content

delete an entry and selecting a different entry inserts history -r which ends up in messing the selected entry #386 #534

@123swk123

Description

@123swk123

I have been living with this issue quite some time now and recently came across this tracker which gave me some insight on what's going on.

I am using hstr on the following platforms.

platform shell version
msys2 bash 5.2.37(2)
Ubuntu 20.xx bash 5.0.17(1)
Ubuntu 25.04 bash 5.2.37(1)

and I see that all of them exhibit the same exact behavior as described by this closes issue #386, so as a quick fix I removed history -r insertion logic when its dirty

diff --git a/src/hstr_history.c b/src/hstr_history.c
index adb55e6..184d997 100644
--- a/src/hstr_history.c
+++ b/src/hstr_history.c
@@ -405,7 +405,9 @@ int history_mgmt_remove_from_ranked(char *cmd, HistoryItems *history) {

 void history_mgmt_flush(void)
 {
+#if 0
     if(dirty && !is_zsh_parent_shell()) {
         fill_terminal_input("history -r\n", false);
     }
+#endif
 }

looks like we have to mask this logic for bash ver >= 5.x shell as well not just zsh .

Originally posted by @123swk123 in #386 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions