Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5247d2a
feat(input): :sparkles: introducing stdin support allowing to read an…
dvorka May 18, 2025
189ca60
fix: changing mode used to open /dev/tty #235
dvorka May 18, 2025
b6f2a01
build(gha): :construction_worker: updating distro to build HSTR on GH…
dvorka May 18, 2025
8686983
build(gha): :construction_worker: fixing CI dependencies
dvorka May 18, 2025
d02987d
build: :green_heart: changing apt packages for Qt on 24.04
dvorka May 21, 2025
b32ea0a
docs(adding doc to man):
dvorka Jan 24, 2026
654e22a
Merge branch 'dev-3.2.0' into enh-235/stdin-support
dvorka Jan 24, 2026
4805fdb
Merge branch 'dev-3.2.0' into enh-235/stdin-support
dvorka Jan 25, 2026
ff12073
refactor: gitignore
dvorka Jan 25, 2026
cbb5390
fix(stdin): hide DEL
dvorka Jan 25, 2026
faf2916
fix(stdin): skip favorites view in stdin mode
dvorka Jan 25, 2026
04f7847
build(gha): returning back GHA w/ correct config + improving document…
dvorka Jan 25, 2026
26cc8db
doc(changelog): changelog polish.
dvorka Jan 25, 2026
6ff94ee
fix(alloc): fixing malloc/free -- DANGEROUS change
dvorka Jan 25, 2026
4658846
fix(stdin): preventing crash on closing pipe (IMPORTANT: previous che…
dvorka Jan 25, 2026
d5b2e31
fix(malloc): fixing freeing memory by changing responsibility of who …
dvorka Jan 25, 2026
651bc0c
fix(memleaks): ensuring that rows from pipe are not freed prematurely…
dvorka Jan 26, 2026
3e21198
Merge branch 'dev-3.2.0' into enh-235/stdin-support
dvorka Jan 26, 2026
f3df066
fix(stdin): removing undesired close of stdin causing potentially var…
dvorka Jan 26, 2026
16b3805
Merge branch 'dev-3.2.0' into enh-235/stdin-support
dvorka Jan 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ This document provides instructions to the copilot AI assistants and agents.
## Test instructions

- Test code is stored in the `tests/src` directory.
- Use `valgrind` to check for memory leaks and memory corruption issues after code changes.
- Tests can be run with `cd build && make test`.
- Write backend tests for all bugs being fixed.
- Use https://github.com/ThrowTheSwitch/Unity framework for testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on: [push]

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Install packages
run: sudo apt-get update && sudo apt install -y build-essential qt5-default qt5-qmake ccache libncursesw5-dev libreadline-dev
- name: Install packages for Ubuntu 24.04
run: sudo apt-get update && sudo apt install -y build-essential qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools ccache libncursesw5-dev libreadline-dev

- name: Build lib and run unit tests using Unity test framework
run: cd test && qmake hstr-unit-tests.pro && make clean all && ./hstr-unit-tests
6 changes: 3 additions & 3 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
2026-01-24 Martin Dvorak <martin.dvorak@mindforger.com>
2026-01-26 Martin Dvorak <martin.dvorak@mindforger.com>

* Released v3.2.0 - Minor release bringing:
- STDIN handling
- Configuration for TIOCSTI enforcement
- HSTR can newly read from pipe / stdin instead of just shell history
- Enforcement of the HSTR configuration in case of TIOCSTI is not available

2023-04-18 Martin Dvorak <martin.dvorak@mindforger.com>

Expand Down
2 changes: 1 addition & 1 deletion PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Contributor: Busindre <busilezas at busindre.com>

pkgname=hstr
pkgver=3.1
pkgver=3.2
pkgrel=1
pkgdesc="A command line utility that brings improved BASH command completion from the history. It aims to make completion easier and more efficient than Ctrl-r."
arch=('x86_64'
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![All releases downloads](https://img.shields.io/github/downloads/dvorka/hstr/total.svg)](https://github.com/dvorka/hstr/releases)
[![License](https://img.shields.io/github/license/dvorka/hstr?color=%23fe0000)](https://github.com/dvorka/hstr/blob/master/LICENSE)

Easily view, navigate and search your **command history** with shell history suggest box for
Easily view, navigate and search your **command history** with shell history suggest box for
[bash](https://www.gnu.org/software/bash/) and [zsh](CONFIGURATION.md#zsh-history-settings).

[![Shell History Suggest Box](doc/hstr-v2.gif "Shell History Suggest Box @ YouTube")](http://www.youtube.com/watch?v=sPF29NyXe2U)
Expand All @@ -27,6 +27,14 @@ or **bookmark** your favorite commands.

<!-- Check [video](http://www.youtube.com/watch?v=sPF29NyXe2U) tutorial. -->

## Packages

<table><tr><td>
<a href="https://repology.org/project/hstr/versions">
<img src="https://repology.org/badge/vertical-allrepos/hstr.svg" alt="Packaging status" align="left">
</a>
</td></tr></table>

## Installation

Install:
Expand Down
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The following HSTR versions are currently being supported with security updates.

| Version | Supported |
| -------- | ------------------ |
| 3.2.0 | :white_check_mark: |
| 3.1.0 | :white_check_mark: |
| 3.0.0 | :white_check_mark: |
| 2.6.0 | :white_check_mark: |
Expand Down
4 changes: 2 additions & 2 deletions build/debian/make-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ then
exit 1
fi

export ARG_BAZAAR_MSG="HSTR 3.1.0"
export ARG_VERSION="3.1.0"
export ARG_BAZAAR_MSG="HSTR 3.2.0"
export ARG_VERSION="3.2.0"

# Debian releases: https://www.debian.org/releases/
# 6/7/8/9/10: squeeze wheezy jessie stretch buster
Expand Down
2 changes: 1 addition & 1 deletion build/fedora/rpm-from-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# This script is available from http://www.mindforger.com/fedora/fedora-rpm-from-deb.sh
# to be easily available in VMs

export MFVERSION="3.1.0"
export MFVERSION="3.2.0"
export MFPRJNAME="hstr-${MFVERSION}"
export AMD64NAME="hstr_${MFVERSION}-1_amd64"
export I386NAME="hstr_${MFVERSION}-1_i386"
Expand Down
2 changes: 1 addition & 1 deletion build/tarball/tarball-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

export SCRIPT_HOME=`pwd`

export HSTR_VERSION="3.1.0"
export HSTR_VERSION="3.2.0"

export NOW=`date +%Y-%m-%d--%H-%M-%S`
export GH_RELEASE_DIR=~/p/hstr/release
Expand Down
4 changes: 2 additions & 2 deletions build/ubuntu/launchpad-make-all-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ then
exit 1
fi

export ARG_BAZAAR_MSG="Release 3.1"
export ARG_MAJOR_VERSION=3.1.
export ARG_BAZAAR_MSG="Release 3.2"
export ARG_MAJOR_VERSION=3.2.
export ARG_MINOR_VERSION=8 # minor version is incremented for every Ubuntu version

# https://wiki.ubuntu.com/Releases
Expand Down
42 changes: 30 additions & 12 deletions doc/USER-DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Table of contents:
* Blacklist
* Delete last command
* Examples

# Features
HSTR is typically started by pressing <kbd>Ctrl-r</kbd> after
you configure it for this shorcut in your shell. However,
Expand All @@ -33,23 +33,35 @@ hh
```

It opens a page with a history view (ranking view is default).
Alternatively you can run HSTR in non-interactive mode -
Alternatively you can run HSTR in non-interactive mode -
commands are just listed on standard output based on history
view:

```bash
hh --non-interactive
hstr --non-interactive
```

Filtering pattern can be optionally specified as well:

```bash
hh -i git
hstr -i git
```

Prints history items containing `git` to standard output and
exits.

HSTR can also read text input from a pipe instead of shell
history, allowing you to interactively browse and filter
any text data:

```bash
ls | hstr
```

This opens HSTR with the output of `ls` command, which you
can filter and select from. Any command output can be piped
to HSTR this way.

## History Filtering
When HSTR starts in interative mode, a view of commands
is shown. This list of commands can be filtered just by typing
Expand All @@ -67,13 +79,13 @@ items is highlighted. Once you are done with your choice:


## Favorite Commands
HSTR allows you to store and manage your favorite
commands.
HSTR allows you to store and manage your favorite
commands.

A new favorite command can be added from
ranking or raw history view by pressing <kbd>Ctrl-f</kbd>.

You can check your favorite commands by choosing
You can check your favorite commands by choosing
favorite view - rotate views using <kbd>Ctrl-/</kbd> or start
HSTR by adding `favorites-view` to `HSTR_CONFIG` environment
property. A favorite command can be choosen just
Expand Down Expand Up @@ -104,8 +116,8 @@ printf "\e[?2004l" # fix broken copy/paste in terminal #TERM
## Blacklist
HSTR allows you to specify a set of commands to be
skipped from all the views. Blacklist typically contains
frequently used commands whose completion from history
has a little or no value. The default blacklist looks
frequently used commands whose completion from history
has a little or no value. The default blacklist looks
like this:

```bash
Expand All @@ -125,7 +137,7 @@ Tips:
* You can skip any command from history just by
prefixing it with `SPACE`. For example:
` echo "Skip this from history"` It's a `bash`
option that is configured using
option that is configured using
`HISTCONTROL=ignorespace` environment variable.


Expand All @@ -148,8 +160,8 @@ Get more colors when running HSTR:
export HSTR_CONFIG=hicolor
```

Start HSTR in configured view and filter out history items
containing 'git' (make sure `hh` is defined using
Start HSTR in configured view and filter out history items
containing 'git' (make sure `hh` is defined using
[alias](../CONFIGURATION.md#alias)):

```bash
Expand All @@ -173,3 +185,9 @@ Check HSTR man page:
```bash
man hstr
```

Browse output of any command interactively:

```bash
ls -la | hh
```
Comment on lines +189 to +193

Copilot AI Jan 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new example uses hh, but earlier in the document the pipe example uses ls | hstr and other examples were switched to hstr. To avoid confusion, make the examples consistent (either use hstr everywhere, or consistently use hh and explicitly state it’s an alias).

Copilot uses AI. Check for mistakes.
2 changes: 1 addition & 1 deletion hstr.pro
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ hstrdebug {
QMAKE_LINK = gcc

# TIOCSTI debugging:
DEFINES += DEBUG_NO_TIOCSTI
# DEFINES += DEBUG_NO_TIOCSTI

message(DEFINES of hstr.pro build: $$DEFINES)
3 changes: 3 additions & 0 deletions man/hstr.1
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ bindkey -s "\eC\-r" "\eC\-a hstr \-\- \eC\-j" # bind hstr to Ctrl-r (for Vi mode
.TP
\fBhstr --insert-in-terminal="git add . && git diff --cached"\fR
Insert command in terminal prompt and exit.
.TP
\fBls | hstr\fR
Read a text input from pipe and interactively browse it.
.SH AUTHOR
Written by Martin Dvorak <martin.dvorak@mindforger.com>
.SH BUGS
Expand Down
8 changes: 4 additions & 4 deletions pad.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
</Company_Info>
<Program_Info>
<Program_Name>HSTR</Program_Name>
<Program_Version>3.1.0</Program_Version>
<Program_Release_Month>4</Program_Release_Month>
<Program_Release_Day>18</Program_Release_Day>
<Program_Release_Year>2023</Program_Release_Year>
<Program_Version>3.2.0</Program_Version>
<Program_Release_Month>5</Program_Release_Month>
<Program_Release_Day>9</Program_Release_Day>
<Program_Release_Year>2025</Program_Release_Year>
Comment on lines +55 to +57

Copilot AI Jan 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PAD release date (2025-05-09) doesn’t match the changelog entry for v3.2.0 (2026-01-25). If v3.2.0 is being released now, update the PAD date to match; otherwise align the changelog/versioning so downstream consumers don’t get conflicting release metadata.

Suggested change
<Program_Release_Month>5</Program_Release_Month>
<Program_Release_Day>9</Program_Release_Day>
<Program_Release_Year>2025</Program_Release_Year>
<Program_Release_Month>1</Program_Release_Month>
<Program_Release_Day>25</Program_Release_Day>
<Program_Release_Year>2026</Program_Release_Year>

Copilot uses AI. Check for mistakes.
<Program_Cost_Dollars />
<Program_Cost_Other_Code>USD</Program_Cost_Other_Code>
<Program_Cost_Other />
Expand Down
4 changes: 2 additions & 2 deletions src/hashset.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ void hashset_destroy(HashSet *hs, const bool freeValues)
while(p && p->next) {
if(p->key) {
free(p->key);
if(freeValues && p->value) free(p->value);
if(freeValues) free(p->value); // free(NULL) is safe per C standard
}
pp=p;
p=p->next;
free(pp);
}
if(p && p->key) {
free(p->key);
if(freeValues && p->value) free(p->value);
if(freeValues) free(p->value);
free(p);
}
}
Expand Down
Loading