New Upstream Release - hstr
Ready changes
Summary
Merged new upstream version: 3.1+ds (was: 2.6+ds).
Resulting package
Built on 2023-05-18T05:01 (took 4m31s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases hstr-dbgsymapt install -t fresh-releases hstr
Lintian Result
Diff
diff --git a/.github/workflows/build_ubuntu.yml b/.github/workflows/build_ubuntu.yml
new file mode 100644
index 0000000..b468ce5
--- /dev/null
+++ b/.github/workflows/build_ubuntu.yml
@@ -0,0 +1,17 @@
+name: Ubuntu unit tests
+
+on: [push]
+
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ 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: Build lib and run unit tests using Unity test framework
+ run: cd test && qmake hstr-unit-tests.pro && make clean all && ./hstr-unit-tests
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e79c8fb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,34 @@
+/autom4te.cache/
+/aclocal.m4
+/compile
+/config.guess
+/config.log
+/config.status
+/config.sub
+/configure
+/depcomp
+/install-sh
+/missing
+/src/hstr
+/src/hh
+.deps/
+.vscode
+Makefile
+Makefile.in
+*.o
+*.pro.user
+*.snap
+/parts
+/prime
+/stage
+/snap/.snapcraft
+/snap/snap/
+/snap/parts/
+*.*~
+hstr
+hh
+*.pro.user
+test/hstr-unit-tests
+/hstr.pro.user*
+*.stash
+*.save
diff --git a/CONFIGURATION.md b/CONFIGURATION.md
index 4b36f8a..6c99794 100644
--- a/CONFIGURATION.md
+++ b/CONFIGURATION.md
@@ -3,10 +3,10 @@ Get most of HSTR by configuring it with:
```bash
# bash
-hstr --show-configuration >> ~/.bashrc
+hstr --show-bash-configuration >> ~/.bashrc
# zsh
-hstr --show-configuration >> ~/.zshrc
+hstr --show-zsh-configuration >> ~/.zshrc
```
Run `hstr --show-configuration` to determine what will be appended to your
@@ -18,10 +18,10 @@ to apply changes.
For more configuration options details please refer to:
* bind HSTR to a [keyboard shortcut](#bash-binding-hstr-to-keyboard-shortcut)
- * [Bash Emacs keymap](#bash-emacs-keymap--default) (default)
+ * [Bash Emacs keymap](#bash-emacs-keymap-default) (default)
* [Bash Vim keymap](#bash-vim-keymap)
* [zsh Emacs keymap](#zsh-emacs-keymap) (default)
-* create `hh` [alias](#Alias) for `hstr`
+* create `hh` [alias](#alias) for `hstr`
* use [environment variables](#environment-variables) and [HSTR config options](#hstr-config-options)
* get more [colors](#colors)
* change [positioning of elements](#positioning)
diff --git a/Changelog b/Changelog
index 815abdf..522f984 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,13 @@
+2023-04-18 Martin Dvorak <martin.dvorak@mindforger.com>
+
+ * Released v3.1.0 - Minor release fixing a Bash function that is used
+ when ioctl/TIOCSTI is not available.
+
+2023-04-15 Martin Dvorak <martin.dvorak@mindforger.com>
+
+ * Released v3.0.0 - major release which adds ability of HSTR to work
+ on operating systems and Linux kernels without ioctl/TIOCSTI support.
+
2022-12-11 Martin Dvorak <martin.dvorak@mindforger.com>
* Released v2.6.0 - fix release (several memory leak and overflow fixes,
@@ -27,21 +37,23 @@
2018-08-28 Martin Dvorak <martin.dvorak@mindforger.com>
- * Released v2.0.0 - Major release which resolves confusing hstr/hh ambuiguity by choosing
+ * Released v2.0.0 - Major release which resolves confusing hstr/hh ambiguity by choosing
hstr to be the only name used. hh becomes just a shell alias. Therefore this release
introduces backward incompatible changes: all HH_ starting environment variables were
- changed to HSTR_, similarly configuration file names starting with .hh_ were renamed to start
- with .hstr_, identifiers used in HSTR_CONFIG were changed e.g. favorites to favorites-view.
- Please check man page for details and update your 1.x.x configuration.
- Ubuntu package name was changed - use: apt install hstr. Tarball name has been changed as
- well to have hstr prefix - please update your scripts.
- Additional improvements: all memory leaks fixed, long commands handling improved (...), bash
- autocomplete added.
+ changed to HSTR_, similarly configuration file names starting with .hh_ were renamed
+ to start with .hstr_, identifiers used in HSTR_CONFIG were changed e.g. favorites to
+ favorites-view.
+ * Please check man page for details and update your 1.x.x configuration.
+ * Ubuntu package name was changed - use: apt install hstr. Tarball name has been changed
+ as well to have hstr prefix - please update your scripts.
+ * Additional improvements: all memory leaks fixed, long commands handling improved (...),
+ bash autocomplete added.
2018-08-13 Martin Dvorak <martin.dvorak@mindforger.com>
- * Released v1.27.0 - Long lines support, QtCreator IDE migration, all build scripts rewritten,
- new distros (my Debian PPA, snap, ...), CI, unit test framework and tests, various fixes.
+ * Released v1.27.0 - Long lines support, QtCreator IDE migration, all build scripts
+ rewritten, new distros (my Debian PPA, snap, ...), CI, unit test framework and tests,
+ various fixes.
2018-05-06 Martin Dvorak <martin.dvorak@mindforger.com>
@@ -61,7 +73,7 @@
2016-11-22 Martin Dvorak <martin.dvorak@mindforger.com>
- * Released v1.21 - Ubuntu Yakkety Yak release
+ * Released v1.21 - Ubuntu Yakkety Yak release.
2016-04-27 Martin Dvorak <martin.dvorak@mindforger.com>
@@ -102,7 +114,7 @@
* New release brings keyboard based search i.e. matching
of history entries by occurrence of words in arbitrary
order.
- * In addition highlighting of matching segments in history
+ * In addition highlighting of matching segments in history
entries has been improved.
2014-09-11 Martin Dvorak <martin.dvorak@mindforger.com>
@@ -117,17 +129,17 @@
* Released v1.12 - Regexp
* New release brings regexp based filtering of command
- history. In addition it's possible to use HSTR in
+ history. In addition it is possible to use HSTR in
non-interactive mode i.e. filtered output is written
to standard output. openSUSE became newly supported
distribution.
2014-04-14 Martin Dvorak <martin.dvorak@mindforger.com>
- * Released v1.10 - Favorites
+ * Released v1.10 - Favorites.
* Major release that brings favorites - favorite
commands can be bookmarked for later use and managed
- in a brand new view
+ in a brand new view.
2014-03-16 Martin Dvorak <martin.dvorak@mindforger.com>
@@ -138,8 +150,8 @@
2014-01-25 Martin Dvorak <martin.dvorak@mindforger.com>
- * Released v1.0 - The First Stable Release
+ * Released v1.0 - The First Stable Release.
2013-12-03 Martin Dvorak <martin.dvorak@mindforger.com>
- * Released v0.2 - Initial Release
+ * Released v0.2 - Initial Release.
diff --git a/INSTALLATION.md b/INSTALLATION.md
index acab4b5..386f28f 100644
--- a/INSTALLATION.md
+++ b/INSTALLATION.md
@@ -1,4 +1,5 @@
# Installation
+
Install:
* [Ubuntu](#ubuntu)
@@ -37,13 +38,18 @@ Tarball:
Upgrade:
-* [HSTR 1.x to 2.x](#upgrade)
+* [HSTR 1.x to 2.x](#hstr-1x-to-2x-from-hh-to-hstr)
+* [HSTR 2.x to 3.x](#hstr-2x-to-3x-ioctl--tiocsti)
+
# Install
+
Install HSTR using a [package](https://pkgs.org/search/?q=hstr) or repository.
+
## Ubuntu
-HSTR is [included in Ubuntu 21.10](https://packages.ubuntu.com/impish/utils/hstr) and [newer](https://wiki.ubuntu.com/Releases) releases:
-```
+HSTR is [included in Ubuntu 21.10](https://packages.ubuntu.com/search?keywords=hstr) and [newer](https://wiki.ubuntu.com/Releases) releases:
+
+```bash
sudo apt install hstr
```
@@ -66,9 +72,10 @@ sudo apt-get install hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Debian/Mint
+
HSTR is [included in Debian 11](https://packages.debian.org/bullseye/hstr) and [newer](https://www.debian.org/releases/) releases:
-```
+```bash
sudo apt install hstr
```
@@ -107,13 +114,14 @@ apt-get install libncursesw5 libtinfo5
sudo dpkg -i hstr.deb
```
-
## Fedora/RHEL/CentOS/Scientific
+
Install HSTR on [Fedora](https://src.fedoraproject.org/rpms/hstr), RHEL, CentOS or Scientific Linux:
```bash
sudo dnf install hstr
```
+
... or:
```bash
@@ -132,6 +140,7 @@ sudo dnf install ./hstr-<major>.<minor>.<revision>-2.x86_64.rpm
```
## openSUSE
+
To install HSTR on openSUSE, please check [software.opensuse.org](https://software.opensuse.org/package/hstr) or [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:
```bash
@@ -141,7 +150,9 @@ zypper install hstr
```
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
+
## Gentoo
+
To install HSTR on Gentoo run (HSTR has been added to [Portage](https://bugs.gentoo.org/show_bug.cgi?id=527122)):
```bash
@@ -161,6 +172,7 @@ apk add hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## ALT Linux
+
To install HSTR on ALT Linux, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:
```bash
@@ -173,7 +185,9 @@ sudo apt-get install hstr
```
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
+
## Arch/Manjaro Linux
+
To install HSTR on Arch or Manjaro Linux download the latest distribution either from [pkgs.org](https://pkgs.org/search/?q=hstr) or [GitHub releases](https://github.com/dvorka/hstr/releases).
Use [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD) in the root of the distribution to build package using `makepkg`.
@@ -181,6 +195,7 @@ Use [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD) in the root of the
To install HSTR from the [Arch User Repository (AUR)](https://aur.archlinux.org/packages/hstr-git/) run `yaourt -S hstr-git` in command line.
## FreeBSD
+
To install HSTR on FreeBSD, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:
```bash
@@ -188,7 +203,9 @@ pkg install hstr
```
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
+
## Slackware
+
To install HSTR on Slackware, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:
```bash
@@ -196,7 +213,9 @@ upgradepkg --install-new hstr-<major>.<minor>-x86_64-1cf.txz
```
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
+
## Void Linux
+
To install HSTR on Void Linux, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:
```bash
@@ -204,7 +223,9 @@ xbps-install -Su hstr
```
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
+
## Milis Linux
+
To install HSTR on Milis Linux run the following commands as root:
```bash
@@ -214,12 +235,15 @@ mps kur hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Haiku OS
+
To install HSTR on Haiku OS use [Haiku Depot](https://www.haiku-os.org/docs/userguide/en/applications/haikudepot.html):
* https://depot.haiku-os.org/#!/?srchexpr=hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
+
## macOS
+
Install HSTR on macOS using [Homebrew](https://brew.sh/) ([formula](https://formulae.brew.sh/formula/hstr)):
```bash
@@ -235,6 +259,7 @@ sudo port install hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## nix package manager
+
To install HSTR using the [nix package manager](https://nixos.org/nix/) e.g. on [NixOS](https://nixos.org/) you can use the [nix derivation for HSTR](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/hstr/default.nix):
```bash
@@ -244,6 +269,7 @@ nix-env -i hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Guix package manager
+
To install HSTR in [GuixSD](https://www.gnu.org/software/guix/) or using the standalone [Guix package manager](https://www.gnu.org/software/guix/manual/en/html_node/Binary-Installation.html#Binary-Installation) you can install the `hstr` package, e.g.
```bash
@@ -253,6 +279,7 @@ guix package -i hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## MPR package manager
+
To install HSTR in Ubuntu or derivative operating systems using MPR, you can search for `hstr-git` using helper
or install it manually using `makedeb -s`
@@ -261,9 +288,11 @@ or install it manually using `makedeb -s`
[MPR package](https://mpr.hunterwittenborn.com/packages/hstr-git)
# Build
+
Build HSTR from source code.
## Build on any Linux distro
+
Clone Git repository:
```bash
@@ -285,6 +314,7 @@ Build and install HSTR using:
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build snap
+
To build [snap](https://snapcraft.io/) for HSTR first clone Git repository:
```bash
@@ -298,7 +328,7 @@ distribution.
Install [snapcraft](https://snapcraft.io/) and build
snap by running snapcraft in the root of Git repository:
-```
+```bash
$ ls ./snap
snapcraft.yaml
$ snapcraft
@@ -308,6 +338,7 @@ $ snapcraft
Find `hstr_0+git..._amd64.snap` in the current directory.
## Build on Ubuntu
+
To build HSTR on Ubuntu clone Git repository:
```bash
@@ -334,8 +365,8 @@ Build and install HSTR using:
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
-
## Build on Debian
+
To build HSTR on Debian clone Git repository:
```bash
@@ -360,10 +391,10 @@ Build and install HSTR using:
./configure && make && make install
```
-
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build on Fedora
+
To build HSTR on Fedora clone Git repository:
```bash
@@ -391,6 +422,7 @@ Build and install HSTR using:
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build on WSL
+
To build HSTR on [Windows Subsystem for Linux (WSL)](https://msdn.microsoft.com/en-us/commandline/wsl/about) clone Git repository:
```bash
@@ -428,6 +460,7 @@ Make sure to **run** HSTR using <kbd>Ctrl-r</kbd> (or `hstrwsl`) - otherwise com
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build on Cygwin
+
To build HSTR on [Cygwin](https://www.cygwin.com) clone Git repository:
```bash
@@ -457,7 +490,9 @@ hstr --show-configuration >> ~/.bashrc
Make sure to **run** HSTR using <kbd>Ctrl-r</kbd> (or `hstrcygwin`) - otherwise commands will not appear in prompt.
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
+
## Build on macOS
+
HSTR can be built on macOS either using [MacPorts](https://www.macports.org/) or [Homebrew](https://brew.sh/).
---
@@ -492,9 +527,11 @@ make
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
# Tarball
+
Download and install HSTR tarball.
## Build and Install Tarball
+
Download latest tarball from [GitHub releases](https://github.com/dvorka/hstr/releases) section.
Expand the archive and install HSTR using:
@@ -503,7 +540,32 @@ Expand the archive and install HSTR using:
```
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
+
# Upgrade
+
+HSTR major versions upgrades instructions.
+
+## HSTR 1.x to 2.x: from HH to HSTR
+
Upgrade HSTR using a [package](https://pkgs.org/search/?q=hstr) or repository. If you are `HSTR 1.x` user, please read about [HSTR 2.x changes](https://github.com/dvorka/hstr/releases/tag/2.0).
+## HSTR 2.x to 3.x: ioctl / TIOCSTI
+
+`TIOCSTI` is an acronym for "Terminal Input Output Control STack Input",
+and it is a system call used in Unix-like operating systems. The `TIOCSTI`
+system call allows to insert data into the input buffer of a terminal
+as if it had been typed by the user.
+
+`TIOCSTI` is NOT available at:
+
+* Linux kernel >=6.2.0
+* Cygwin
+* WSL
+
+HSTR uses `TIOCSTI` to insert a command chosen by the user in HSTR
+to shell prompt - if `TIOCSTI` is available. Otherwise shell specific
+line editors features are used.
+
+**Therefore it is important to configure HSTR after the installation:**
+* [HSTR configuration](README.md#configuration)
diff --git a/PKGBUILD b/PKGBUILD
index 29cd778..71cd6a2 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@
# Contributor: Busindre <busilezas at busindre.com>
pkgname=hstr
-pkgver=2.6
+pkgver=3.1
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'
diff --git a/README.md b/README.md
index bca5ea2..b04d8e3 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# HSTR
+
[![GitHub Actions CI for Ubuntu](https://github.com/dvorka/hstr/actions/workflows/build_ubuntu.yml/badge.svg)](https://github.com/dvorka/hstr/actions)
[![Current release](https://img.shields.io/github/release/dvorka/hstr.svg)](https://github.com/dvorka/hstr/releases)
[![GitHub issues](https://img.shields.io/github/issues/dvorka/hstr.svg?maxAge=360)](https://github.com/dvorka/hstr/issues)
@@ -11,14 +12,14 @@ Easily view, navigate and search your **command history** with shell history sug
[![Shell History Suggest Box](doc/hstr-v2.gif "Shell History Suggest Box @ YouTube")](http://www.youtube.com/watch?v=sPF29NyXe2U)
## Description
+
Are you looking for a command that you used **recently**? Do you
want to avoid the need to write **long commands** over and over
again? Are you looking for a tool that is able to manage your
**favorite** commands?
HSTR (**H**i**ST**o**R**y) is a command line utility that brings improved `bash`/`zsh` command completion
-from the history. It aims to make completion **easier** and more **efficient**
-than <kbd>Ctrl-r</kbd>.
+from the history. It aims to make completion **easier** and more **efficient** than <kbd>Ctrl-r</kbd>.
HSTR can also **manage** your command history (for instance you can remove
commands that are obsolete or contain a piece of sensitive information)
@@ -26,8 +27,8 @@ or **bookmark** your favorite commands.
<!-- Check [video](http://www.youtube.com/watch?v=sPF29NyXe2U) tutorial. -->
-
## Installation
+
Install:
* [Ubuntu](INSTALLATION.md#ubuntu)
@@ -69,25 +70,26 @@ Tarball:
Check also [packages](https://pkgs.org/search/?q=hstr) for Linux and Unix.
-
## Configuration
+
Configure HSTR just by running:
```bash
# bash
-hstr --show-configuration >> ~/.bashrc
+hstr --show-bash-configuration >> ~/.bashrc
# zsh
-hstr --show-configuration >> ~/.zshrc
+hstr --show-zsh-configuration >> ~/.zshrc
```
-For detailed HSTR configuration documentation please refer to [Configuration](CONFIGURATION.md).
+For detailed HSTR configuration documentation please refer to [Configuration](CONFIGURATION.md).
## In the News
-Read about HSTR in [LinuxMagazine](http://www.linux-magazine.com/Issues/2014/164/Bash-History-on-Steroids), [UbuntuGeek](http://www.ubuntugeek.com/tag/hstr-bash-history), [DebianAdmin](http://www.debianadmin.com/hstr-easily-view-navigate-search-and-use-your-command-history-with-shell-history.html), [Tuxdiary](http://tuxdiary.com/2015/02/17/hstr/), [Softpedia](http://linux.softpedia.com/get/Terminals/BASH-Command-History-Completion-103155.shtml) and [OSTechNix](https://www.ostechnix.com/hstr-easily-view-navigate-search-manage-commandline-history/).
+Read about HSTR in [LinuxMagazine](http://www.linux-magazine.com/Issues/2014/164/Bash-History-on-Steroids), [UbuntuGeek](http://www.ubuntugeek.com/tag/hstr-bash-history), [DebianAdmin](http://www.debianadmin.com/hstr-easily-view-navigate-search-and-use-your-command-history-with-shell-history.html), [Tuxdiary](http://tuxdiary.com/2015/02/17/hstr/), [Softpedia](http://linux.softpedia.com/get/Terminals/BASH-Command-History-Completion-103155.shtml) and [OSTechNix](https://www.ostechnix.com/hstr-easily-view-navigate-search-manage-commandline-history/).
## Documentation
+
Check man page:
```bash
@@ -96,6 +98,6 @@ man hstr
User videos: [Zack](https://www.youtube.com/watch?v=Qd75pIeQkH8), [Dvorka](https://www.youtube.com/watch?v=sPF29NyXe2U) and [Yu-Jie Lin](https://www.youtube.com/watch?v=Qx5n_5B5xUw).
-
## Bugs
+
https://github.com/dvorka/hstr/issues
diff --git a/SECURITY.md b/SECURITY.md
index ecb0c88..db3fdfc 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -4,18 +4,20 @@
The following HSTR versions are currently being supported with security updates.
-| Version | Supported |
-| ------- | ------------------ |
-| 2.6.0 | :white_check_mark: |
-| 2.5.0 | :white_check_mark: |
-| 2.4.0 | :white_check_mark: |
-| <= 2.3.0 | :x: |
+| Version | Supported |
+| -------- | ------------------ |
+| 3.1.0 | :white_check_mark: |
+| 3.0.0 | :white_check_mark: |
+| 2.6.0 | :white_check_mark: |
+| 2.5.0 | :white_check_mark: |
+| 2.4.0 | :white_check_mark: |
+| <= 2.3.0 | :x: |
## Reporting a Vulnerability
-Please report HSTR vulnerabilities to
+Please report HSTR vulnerabilities to
[martin.dvorak@mindforger.com](martin.dvorak@mindforger.com)
All reported vulnerabilities will be examined, reproduced and
-expected fix release and release date will be shared with
+expected fix release and release date will be shared with
the reporter.
diff --git a/_config.yml b/_config.yml
new file mode 100644
index 0000000..fc24e7a
--- /dev/null
+++ b/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-hacker
\ No newline at end of file
diff --git a/check-bash-lab-experiments b/check-bash-lab-experiments
new file mode 100644
index 0000000..e69de29
diff --git a/configure.ac b/configure.ac
index e7d2ea6..16d1284 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
# configure.ac Autoconf configuration file
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
AC_PREREQ([2.69])
-AC_INIT(hstr, 2.6.0, martin.dvorak@mindforger.com)
+AC_INIT(hstr, 3.0.0, martin.dvorak@mindforger.com)
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
# Check src dir existence.
diff --git a/debian/changelog b/debian/changelog
index 07ca346..edb0d5b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+hstr (3.1+ds-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Thu, 18 May 2023 04:57:45 -0000
+
hstr (2.6+ds-1) unstable; urgency=medium
* New upstream release.
diff --git a/debian/patches/01_fix_remove_symlink.diff b/debian/patches/01_fix_remove_symlink.diff
index 4f333ee..8346b4e 100644
--- a/debian/patches/01_fix_remove_symlink.diff
+++ b/debian/patches/01_fix_remove_symlink.diff
@@ -2,9 +2,11 @@ Description:Dont install hh link
Author: Daniel Echeverri <epsilon@debian.org>
Last-Update: <2020-03-22>
Forwarded: not-needed
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -34,7 +34,5 @@
+Index: hstr.git/src/Makefile.am
+===================================================================
+--- hstr.git.orig/src/Makefile.am
++++ hstr.git/src/Makefile.am
+@@ -34,7 +34,5 @@ hstr_SOURCES = \
main.c
# create hstr > hh hard link on installation
diff --git a/debian/patches/03_fix_remove_shebang.diff b/debian/patches/03_fix_remove_shebang.diff
index b35c8c9..82252e8 100644
--- a/debian/patches/03_fix_remove_shebang.diff
+++ b/debian/patches/03_fix_remove_shebang.diff
@@ -2,10 +2,12 @@ Description:Remove shebang from bash-completion.
Author: Daniel Echeverri <epsilon@debian.org>
Last-Update: <2022-12-19>
Forwarded: not-needed
---- a/etc/bash-completion.d/hstr
-+++ b/etc/bash-completion.d/hstr
+Index: hstr.git/etc/bash-completion.d/hstr
+===================================================================
+--- hstr.git.orig/etc/bash-completion.d/hstr
++++ hstr.git/etc/bash-completion.d/hstr
@@ -1,4 +1,3 @@
-#!/bin/bash
#
- # Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ # Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
diff --git a/etc/bash-completion.d/hstr b/etc/bash-completion.d/hstr
index 0ec1d6d..44ed31d 100755
--- a/etc/bash-completion.d/hstr
+++ b/etc/bash-completion.d/hstr
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/hstr.pro b/hstr.pro
index e4c3343..199d507 100644
--- a/hstr.pro
+++ b/hstr.pro
@@ -1,6 +1,6 @@
-# hstr.pro Qt project file for HSTR shell history compleation utility
+# hstr.pro Qt project file for HSTR shell history completion utility
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -60,3 +60,8 @@ hstrdebug {
QMAKE_CC = ccache gcc
}
QMAKE_LINK = gcc
+
+# TIOCSTI debugging:
+DEFINES += DEBUG_NO_TIOCSTI
+
+message(DEFINES of hstr.pro build: $$DEFINES)
diff --git a/man/hstr.1 b/man/hstr.1
index 43547af..9aee3db 100644
--- a/man/hstr.1
+++ b/man/hstr.1
@@ -31,30 +31,36 @@ Insert custom command to terminal prompt and exit
Show favorites view immediately
.TP
\fB-s --show-configuration\fR
-Show configuration that can be added to ~/.bashrc
-.TP
+Show configuration to be added to the config file of the shell (~/.bashrc or ~/.zshrc)
+.TP
+\fB-B --show-bash-configuration\fR
+Show Bash configuration to be added to ~/.bashrc
+.TP
+\fB-Z --show-zsh-configuration\fR
+Show Zsh configuration to be added to ~/.zshrc
+.TP
\fB-b --show-blacklist\fR
Show blacklist of commands to be filtered out before history processing
-.TP
+.TP
\fB-V --version\fR
Show version information
.SH KEYS
-.TP
+.TP
\fBpattern\fR
Type to filter shell history.
-.TP
+.TP
\fBCtrl\-e\fR
Toggle regular expression and substring search.
-.TP
+.TP
\fBCtrl\-t\fR
Toggle case sensitive search.
-.TP
+.TP
\fBCtrl\-/\fR, \fBCtrl\-7\fR
Rotate view of history as provided by bash, ranked history ordered by the number of occurrences/length/timestamp and favorites.
-.TP
+.TP
\fBCtrl\-f\fR
Add currently selected command to favorites.
-.TP
+.TP
\fBCtrl\-l\fR
Toggle search pattern case.
.TP
@@ -181,7 +187,28 @@ Example:
Commands to be hidden.
.SH BASH CONFIGURATION
-Optionally add the following lines to ~/.bashrc:
+Add the following lines to ~/bashrc if TIOCSTI is not supported by your OS:
+.nf
+.sp
+alias hh=hstr # hh to be alias for hstr
+export HSTR_CONFIG=hicolor # get more colors
+shopt -s histappend # append new history items to .bash_history
+export HISTCONTROL=ignorespace # leading space hides commands from history
+export HISTFILESIZE=10000 # increase history file size (default is 500)
+export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
+# ensure synchronization between bash memory and history file
+export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
+function hstrnotiocsti {
+ { HSTR_OUT="$( { </dev/tty hstr ${READLINE_LINE}; } 2>&1 1>&3 3>&- )"; } 3>&1;
+ READLINE_LINE="$(hstr ${READLINE_LINE})"
+ READLINE_POINT=${#READLINE_LINE}
+}
+# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
+if [[ $- =~ .*i.* ]]; then bind -x '"\C-r": "hstrnotiocsti"'; fi
+export HSTR_TIOCSTI=n
+.sp
+.fi
+Optionally add the following lines to ~/.bashrc if TIOCSTI is supported by your OS:
.nf
.sp
alias hh=hstr # make hh alias of hstr
@@ -197,7 +224,25 @@ if [[ $\- =~ .*i.* ]]; then bind '"\eC\-r": "\eC\-a hstr -- \eC-j"'; fi
.sp
.fi
.SH ZSH CONFIGURATION
-Optionally add the following lines to ~/.zshrc:
+Add the following lines to ~/zshrc if TIOCSTI is not supported by your OS:
+.nf
+.sp
+alias hh=hstr # hh to be alias for hstr
+setopt histignorespace # skip cmds w/ leading space from history
+export HSTR_CONFIG=hicolor # get more colors
+hstr_no_tiocsti() {
+ zle -I
+ { HSTR_OUT="$( { </dev/tty hstr ${BUFFER}; } 2>&1 1>&3 3>&- )"; } 3>&1;
+ BUFFER="${HSTR_OUT}"
+ CURSOR=${#BUFFER}
+ zle redisplay
+}
+zle -N hstr_no_tiocsti
+bindkey '\C-r' hstr_no_tiocsti
+export HSTR_TIOCSTI=n
+.sp
+.fi
+Optionally add the following lines to ~/.zshrc if TIOCSTI is supported by your OS:
.nf
.sp
export HSTR_CONFIG=hicolor # get more colors
@@ -217,10 +262,10 @@ bindkey -s "\eC\-r" "\eC\-a hstr \-\- \eC\-j" # bind hstr to Ctrl-r (for Vi mode
Print history items containing 'git' to standard output and exit.
.TP
\fBhstr --show-configuration >> ~/.bashrc\fR
- Append default \fBhstr\fR configuration to your bash profile.
+ Append default \fBhstr\fR configuration to your Bash profile.
.TP
\fBhstr --show-configuration >> ~/.zhrc\fR
- Append default \fBhstr\fR configuration to your zsh profile.
+ Append default \fBhstr\fR configuration to your Zsh profile.
.TP
\fBhstr --show-blacklist\fR
Show blacklist configured for history processing.
diff --git a/pad.xml b/pad.xml
index b12d578..2b7c3fd 100644
--- a/pad.xml
+++ b/pad.xml
@@ -1,115 +1,115 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- pad.xml PAD file for HSTR
-
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<XML_DIZ_INFO>
- <MASTER_PAD_VERSION_INFO>
- <MASTER_PAD_VERSION>3.10</MASTER_PAD_VERSION>
- <MASTER_PAD_EDITOR>http://www.padbuilder.com</MASTER_PAD_EDITOR>
- <MASTER_PAD_INFO>Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://www.asp-shareware.org/pad</MASTER_PAD_INFO>
- </MASTER_PAD_VERSION_INFO>
- <Company_Info>
- <Company_Name>MindForger</Company_Name>
- <Address_1 />
- <Address_2 />
- <City_Town>Prague</City_Town>
- <State_Province />
- <Zip_Postal_Code />
- <Country>Czech Republic</Country>
- <Company_WebSite_URL>https://www.mindforger.com</Company_WebSite_URL>
- <Contact_Info>
- <Author_First_Name>Martin</Author_First_Name>
- <Author_Last_Name>Dvorak</Author_Last_Name>
- <Author_Email>martin.dvorak@mindforger.com</Author_Email>
- <Contact_First_Name>Martin</Contact_First_Name>
- <Contact_Last_Name>Dvorak</Contact_Last_Name>
- <Contact_Email>martin.dvorak@mindforger.com</Contact_Email>
- </Contact_Info>
- <Support_Info>
- <Sales_Email />
- <Support_Email>info@mindforger.com</Support_Email>
- <General_Email />
- <Sales_Phone />
- <Support_Phone />
- <General_Phone />
- <Fax_Phone />
- </Support_Info>
- </Company_Info>
- <Program_Info>
- <Program_Name>HSTR</Program_Name>
- <Program_Version>2.6.0</Program_Version>
- <Program_Release_Month>12</Program_Release_Month>
- <Program_Release_Day>10</Program_Release_Day>
- <Program_Release_Year>2022</Program_Release_Year>
- <Program_Cost_Dollars />
- <Program_Cost_Other_Code>USD</Program_Cost_Other_Code>
- <Program_Cost_Other />
- <Program_Type>Freeware</Program_Type>
- <Program_Release_Status>Major Update</Program_Release_Status>
- <Program_Install_Support>Install and Uninstall</Program_Install_Support>
- <Program_OS_Support>Linux,Linux Console,Linux Open Source,Mac OS X,Windows WSL</Program_OS_Support>
- <Program_Language>English</Program_Language>
- <Program_Change_Info />
- <Program_Specific_Category>Utilities</Program_Specific_Category>
- <Program_Category_Class>System Utilities::Shell Tools</Program_Category_Class>
- <Program_Categories />
- <Program_System_Requirements />
- <File_Info>
- <File_Size_Bytes>39472</File_Size_Bytes>
- <File_Size_K>38.55</File_Size_K>
- <File_Size_MB>0.04</File_Size_MB>
- </File_Info>
- <Expire_Info>
- <Has_Expire_Info>N</Has_Expire_Info>
- <Expire_Count />
- <Expire_Based_On />
- <Expire_Other_Info />
- <Expire_Month />
- <Expire_Day />
- <Expire_Year />
- </Expire_Info>
- </Program_Info>
- <Program_Descriptions>
- <English>
- <Keywords>shell, history, bash, zsh</Keywords>
- <Char_Desc_45>Shell History Suggest Box</Char_Desc_45>
- <Char_Desc_80>Shell history suggest box - easily view, navigate, search and manage your command history.</Char_Desc_80>
- <Char_Desc_250>Are you looking for a command that you used recently? Do you want to avoid the need to write long commands over and over again despite you used them recently? Are you looking for a tool that is able to manage your favorite commands? HSTR is a comman</Char_Desc_250>
- <Char_Desc_450 />
- <Char_Desc_2000 />
- </English>
- </Program_Descriptions>
- <Web_Info>
- <Application_URLs>
- <Application_Info_URL>https://github.com/dvorka/hstr</Application_Info_URL>
- <Application_Order_URL />
- <Application_Screenshot_URL>http://mindforger.com/projects/images/hh-1.jpg</Application_Screenshot_URL>
- <Application_Icon_URL />
- <Application_XML_File_URL>http://mindforger.com/project/hstr/pad-hstr.xml</Application_XML_File_URL>
- </Application_URLs>
- <Download_URLs>
- <Primary_Download_URL>https://github.com/dvorka/hstr/releases</Primary_Download_URL>
- <Secondary_Download_URL />
- <Additional_Download_URL_1 />
- <Additional_Download_URL_2 />
- </Download_URLs>
- </Web_Info>
- <Permissions>
- <Distribution_Permissions />
- <EULA />
- </Permissions>
-</XML_DIZ_INFO>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ pad.xml PAD file for HSTR
+
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<XML_DIZ_INFO>
+ <MASTER_PAD_VERSION_INFO>
+ <MASTER_PAD_VERSION>3.10</MASTER_PAD_VERSION>
+ <MASTER_PAD_EDITOR>http://www.padbuilder.com</MASTER_PAD_EDITOR>
+ <MASTER_PAD_INFO>Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://www.asp-shareware.org/pad</MASTER_PAD_INFO>
+ </MASTER_PAD_VERSION_INFO>
+ <Company_Info>
+ <Company_Name>MindForger</Company_Name>
+ <Address_1 />
+ <Address_2 />
+ <City_Town>Prague</City_Town>
+ <State_Province />
+ <Zip_Postal_Code />
+ <Country>Czech Republic</Country>
+ <Company_WebSite_URL>https://www.mindforger.com</Company_WebSite_URL>
+ <Contact_Info>
+ <Author_First_Name>Martin</Author_First_Name>
+ <Author_Last_Name>Dvorak</Author_Last_Name>
+ <Author_Email>martin.dvorak@mindforger.com</Author_Email>
+ <Contact_First_Name>Martin</Contact_First_Name>
+ <Contact_Last_Name>Dvorak</Contact_Last_Name>
+ <Contact_Email>martin.dvorak@mindforger.com</Contact_Email>
+ </Contact_Info>
+ <Support_Info>
+ <Sales_Email />
+ <Support_Email>info@mindforger.com</Support_Email>
+ <General_Email />
+ <Sales_Phone />
+ <Support_Phone />
+ <General_Phone />
+ <Fax_Phone />
+ </Support_Info>
+ </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_Cost_Dollars />
+ <Program_Cost_Other_Code>USD</Program_Cost_Other_Code>
+ <Program_Cost_Other />
+ <Program_Type>Freeware</Program_Type>
+ <Program_Release_Status>Major Update</Program_Release_Status>
+ <Program_Install_Support>Install and Uninstall</Program_Install_Support>
+ <Program_OS_Support>Linux,Linux Console,Linux Open Source,Mac OS X,Windows WSL</Program_OS_Support>
+ <Program_Language>English</Program_Language>
+ <Program_Change_Info />
+ <Program_Specific_Category>Utilities</Program_Specific_Category>
+ <Program_Category_Class>System Utilities::Shell Tools</Program_Category_Class>
+ <Program_Categories />
+ <Program_System_Requirements />
+ <File_Info>
+ <File_Size_Bytes>39472</File_Size_Bytes>
+ <File_Size_K>38.55</File_Size_K>
+ <File_Size_MB>0.04</File_Size_MB>
+ </File_Info>
+ <Expire_Info>
+ <Has_Expire_Info>N</Has_Expire_Info>
+ <Expire_Count />
+ <Expire_Based_On />
+ <Expire_Other_Info />
+ <Expire_Month />
+ <Expire_Day />
+ <Expire_Year />
+ </Expire_Info>
+ </Program_Info>
+ <Program_Descriptions>
+ <English>
+ <Keywords>shell, history, bash, zsh</Keywords>
+ <Char_Desc_45>Shell History Suggest Box</Char_Desc_45>
+ <Char_Desc_80>Shell history suggest box - easily view, navigate, search and manage your command history.</Char_Desc_80>
+ <Char_Desc_250>Are you looking for a command that you used recently? Do you want to avoid the need to write long commands over and over again despite you used them recently? Are you looking for a tool that is able to manage your favorite commands? HSTR is a comman</Char_Desc_250>
+ <Char_Desc_450 />
+ <Char_Desc_2000 />
+ </English>
+ </Program_Descriptions>
+ <Web_Info>
+ <Application_URLs>
+ <Application_Info_URL>https://github.com/dvorka/hstr</Application_Info_URL>
+ <Application_Order_URL />
+ <Application_Screenshot_URL>http://mindforger.com/projects/images/hh-1.jpg</Application_Screenshot_URL>
+ <Application_Icon_URL />
+ <Application_XML_File_URL>http://mindforger.com/project/hstr/pad-hstr.xml</Application_XML_File_URL>
+ </Application_URLs>
+ <Download_URLs>
+ <Primary_Download_URL>https://github.com/dvorka/hstr/releases</Primary_Download_URL>
+ <Secondary_Download_URL />
+ <Additional_Download_URL_1 />
+ <Additional_Download_URL_2 />
+ </Download_URLs>
+ </Web_Info>
+ <Permissions>
+ <Distribution_Permissions />
+ <EULA />
+ </Permissions>
+</XML_DIZ_INFO>
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index df1bac6..620d2b2 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,6 +1,6 @@
# snapcraft.yaml snap builder configuration
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/src/hashset.c b/src/hashset.c
index 94ab27d..3730b12 100644
--- a/src/hashset.c
+++ b/src/hashset.c
@@ -1,7 +1,7 @@
/*
hashset.c hash set implementation
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/hstr.c b/src/hstr.c
index 529dc66..8183031 100644
--- a/src/hstr.c
+++ b/src/hstr.c
@@ -1,7 +1,7 @@
/*
hstr.c HSTR shell history completion utility
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -137,7 +137,7 @@
// major.minor.revision
static const char* VERSION_STRING=
- "hstr version \"2.6.0\" (2022-12-11T22:00:00)"
+ "hstr version \"3.1.0\" (2023-04-18T08:50:00)"
"\n";
static const char* HSTR_VIEW_LABELS[]={
@@ -157,7 +157,7 @@ static const char* HSTR_CASE_LABELS[]={
"sensitive"
};
-static const char* INSTALL_BASH_STRING=
+static const char* INSTALL_BASH_CODE_PREFIX=
"\n# HSTR configuration - add this to ~/.bashrc"
"\nalias hh=hstr # hh to be alias for hstr"
"\nexport HSTR_CONFIG=hicolor # get more colors"
@@ -176,96 +176,32 @@ static const char* INSTALL_BASH_STRING=
// across different bash sessions.
// -c -r ... Forces entire .bash_history to be reloaded (handles history deletes, synchronizes different bash sessions)
"\n# ensure synchronization between bash memory and history file"
- "\nexport PROMPT_COMMAND=\"history -a; history -n; ${PROMPT_COMMAND}\""
- "\n# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)"
-#if defined(__MS_WSL__)
- // IMPROVE commands are NOT executed on return under win10 > consider hstr_utils changes
- // Script hints:
- // {...} is inline group ~ lambda function whose vars are visible to the other commands
- // V=$(c) executes commands and stores it to var V
- "\nfunction hstrwsl {"
- "\n offset=${READLINE_POINT}"
- "\n READLINE_POINT=0"
- "\n { READLINE_LINE=$(</dev/tty hstr ${READLINE_LINE:0:offset} 2>&1 1>&$hstrout); } {hstrout}>&1"
- "\n READLINE_POINT=${#READLINE_LINE}"
- "\n}"
- "\nif [[ $- =~ .*i.* ]]; then bind -x '\"\\C-r\": \"hstrwsl\"'; fi"
-#elif defined(__CYGWIN__)
- "\nfunction hstrcygwin {"
- "\n offset=${READLINE_POINT}"
- "\n READLINE_POINT=0"
- "\n { READLINE_LINE=$(</dev/tty hstr ${READLINE_LINE:0:offset} 2>&1 1>&$hstrout); } {hstrout}>&1"
- "\n READLINE_POINT=${#READLINE_LINE}"
- "\n}"
- "\nif [[ $- =~ .*i.* ]]; then bind -x '\"\\C-r\": \"hstrcygwin\"'; fi"
-#else
- "\nif [[ $- =~ .*i.* ]]; then bind '\"\\C-r\": \"\\C-a hstr -- \\C-j\"'; fi"
- "\n# if this is interactive shell, then bind 'kill last command' to Ctrl-x k"
- "\nif [[ $- =~ .*i.* ]]; then bind '\"\\C-xk\": \"\\C-a hstr -k \\C-j\"'; fi"
-#endif
- "\n\n";
+ "\nexport PROMPT_COMMAND=\"history -a; history -n; ${PROMPT_COMMAND}\"";
// zsh doc: http://zsh.sourceforge.net/Guide/zshguide.html
-static const char* INSTALL_ZSH_STRING=
+static const char* INSTALL_ZSH_CODE_PREFIX=
"\n# HSTR configuration - add this to ~/.zshrc"
"\nalias hh=hstr # hh to be alias for hstr"
"\nsetopt histignorespace # skip cmds w/ leading space from history"
// HISTFILE should not be needed - HSTR must work on blank environment as well
// "\nexport HISTFILE=~/.zsh_history # ensure history file visibility"
- "\nexport HSTR_CONFIG=hicolor # get more colors"
-#if defined(__MS_WSL__)
- // TODO binding to be rewritten for zsh@WSL as it's done for bash - hstr_winwsl() like function to be implemented to make it work on WSL
-
- "\n# Function and binding below is bash script that makes command completion work under WSL."
- "\n# If you can rewrite the function and binding from bash to zsh please send it to martin.dvorak@mindforger.com"
- "\n# so that I can share it with other users."
- "\n#function hstr_winwsl {"
- "\n# offset=${READLINE_POINT}"
- "\n# READLINE_POINT=0"
- "\n# { READLINE_LINE=$(</dev/tty hstr ${READLINE_LINE:0:offset} 2>&1 1>&$hstrout); } {hstrout}>&1"
- "\n# READLINE_POINT=${#READLINE_LINE}"
- "\n#}"
- "\n#bindkey -s \"\\C-r\" \"\\eqhstr_winwsl\\n\""
- "\n"
- "\nbindkey -s \"\\C-r\" \"\\eqhstr\\n\" # bind hstr to Ctrl-r (for Vi mode check doc)"
-#elif defined(__CYGWIN__)
- // TODO binding to be rewritten for zsh@Cygwin as it's done for bash - hstr_cygwin() like function to be implemented to make it work under Cygwin
-
- "\n# Function and binding below is bash script that makes command completion work under Cygwin."
- "\n# If you can rewrite the function and binding from bash to zsh please send it to martin.dvorak@mindforger.com"
- "\n# so that I can share it with other users."
- "\n#function hstr_cygwin {"
- "\n# offset=${READLINE_POINT}"
- "\n# READLINE_POINT=0"
- "\n# { READLINE_LINE=$(</dev/tty hstr ${READLINE_LINE:0:offset} 2>&1 1>&$hstrout); } {hstrout}>&1"
- "\n# READLINE_POINT=${#READLINE_LINE}"
- "\n#}"
- "\n#bindkey -s \"\\C-r\" \"\\eqhstr_cygwin\\n\""
- "\n"
- "\nbindkey -s \"\\C-r\" \"\\eqhstr\\n\" # bind hstr to Ctrl-r (for Vi mode check doc)"
-#else
- "\nbindkey -s \"\\C-r\" \"\\C-a hstr -- \\C-j\" # bind hstr to Ctrl-r (for Vi mode check doc)"
-#endif
- // TODO try variant with args/pars separation
- //"\nbindkey -s \"\\C-r\" \"\\eqhstr --\\n\" # bind hstr to Ctrl-r (for Vi mode check doc)"
- // alternate binding options in zsh:
- // bindkey -s '^R' '^Ahstr ^M'
- // bindkey -s "\C-r" "\C-a hstr -- \C-j"
- "\n\n";
+ "\nexport HSTR_CONFIG=hicolor # get more colors";
static const char* HELP_STRING=
"Usage: hstr [option] [arg1] [arg2]..."
"\nShell history suggest box:"
"\n"
- "\n --favorites -f ... show favorites view"
- "\n --kill-last-command -k ... delete last command in history"
- "\n --non-interactive -n ... print filtered history and exit"
- "\n --show-configuration -s ... show configuration to be added to ~/.bashrc"
- "\n --show-zsh-configuration -z ... show zsh configuration to be added to ~/.zshrc"
- "\n --show-blacklist -b ... show commands to skip on history indexation"
- "\n --insert-in-terminal=[c] -i ... insert command c in terminal prompt and exit"
- "\n --version -V ... show version details"
- "\n --help -h ... help"
+ "\n --favorites -f ... show favorites view"
+ "\n --kill-last-command -k ... delete last command in history"
+ "\n --non-interactive -n ... print filtered history and exit"
+ "\n --show-configuration -s ... show configuration to be added to ~/.bashrc"
+ "\n --show-bash-configuration -B ... show bash configuration to be added to ~/.bashrc"
+ "\n --show-zsh-configuration -Z ... show zsh configuration to be added to ~/.zshrc"
+ "\n --show-blacklist -b ... show commands to skip on history indexation"
+ "\n --is-tiocsti -t ... detect whether TIOCSTI is supported and print y or n"
+ "\n --insert-in-terminal=[c] -i ... insert command c in terminal prompt and exit"
+ "\n --version -V ... show version details"
+ "\n --help -h ... help"
"\n"
"\nReport bugs to martin.dvorak@mindforger.com"
"\nHome page: https://github.com/dvorka/hstr"
@@ -280,16 +216,18 @@ static const char* LABEL_HELP=
#define GETOPT_OPTIONAL_ARGUMENT 2
static const struct option long_options[] = {
- {"favorites", GETOPT_NO_ARGUMENT, NULL, 'f'},
- {"kill-last-command", GETOPT_NO_ARGUMENT, NULL, 'k'},
- {"version", GETOPT_NO_ARGUMENT, NULL, 'V'},
- {"help", GETOPT_NO_ARGUMENT, NULL, 'h'},
- {"non-interactive", GETOPT_NO_ARGUMENT, NULL, 'n'},
- {"show-configuration", GETOPT_NO_ARGUMENT, NULL, 's'},
- {"show-zsh-configuration", GETOPT_NO_ARGUMENT, NULL, 'z'},
- {"show-blacklist", GETOPT_NO_ARGUMENT, NULL, 'b'},
- {"insert-in-terminal", GETOPT_REQUIRED_ARGUMENT, NULL, 'i'},
- {0, 0, NULL, 0 }
+ {"favorites", GETOPT_NO_ARGUMENT, NULL, 'f'},
+ {"kill-last-command", GETOPT_NO_ARGUMENT, NULL, 'k'},
+ {"version", GETOPT_NO_ARGUMENT, NULL, 'V'},
+ {"help", GETOPT_NO_ARGUMENT, NULL, 'h'},
+ {"non-interactive", GETOPT_NO_ARGUMENT, NULL, 'n'},
+ {"show-configuration", GETOPT_NO_ARGUMENT, NULL, 's'},
+ {"show-bash-configuration", GETOPT_NO_ARGUMENT, NULL, 'B'},
+ {"show-zsh-configuration", GETOPT_NO_ARGUMENT, NULL, 'Z'},
+ {"show-blacklist", GETOPT_NO_ARGUMENT, NULL, 'b'},
+ {"is-tiocsti", GETOPT_NO_ARGUMENT, NULL, 't'},
+ {"insert-in-terminal", GETOPT_REQUIRED_ARGUMENT, NULL, 'i'},
+ {0, 0, NULL, 0 }
};
typedef struct {
@@ -406,6 +344,88 @@ void signal_callback_handler_ctrl_c(int signum)
}
}
+void print_bash_install_code(void)
+{
+ printf("%s", INSTALL_BASH_CODE_PREFIX);
+
+ if(is_tiocsti) {
+ printf(
+ "\nif [[ $- =~ .*i.* ]]; then bind '\"\\C-r\": \"\\C-a hstr -- \\C-j\"'; fi"
+ "\n# if this is interactive shell, then bind 'kill last command' to Ctrl-x k"
+ "\nif [[ $- =~ .*i.* ]]; then bind '\"\\C-xk\": \"\\C-a hstr -k \\C-j\"'; fi"
+ "\nexport HSTR_TIOCSTI=y"
+ );
+ } else {
+ printf(
+#if defined(__MS_WSL__)
+ "\nfunction hstrwsl {"
+#elif defined(__CYGWIN__)
+ "\nfunction hstrcygwin {"
+#else
+ "\nfunction hstrnotiocsti {"
+#endif
+ "\n { READLINE_LINE=\"$( { </dev/tty hstr ${READLINE_LINE}; } 2>&1 1>&3 3>&- )\"; } 3>&1;"
+ "\n READLINE_POINT=${#READLINE_LINE}"
+ "\n}"
+ "\n# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)"
+
+#if defined(__MS_WSL__)
+ "\nif [[ $- =~ .*i.* ]]; then bind -x '\"\\C-r\": \"hstrwsl\"'; fi"
+#elif defined(__CYGWIN__)
+ "\nif [[ $- =~ .*i.* ]]; then bind -x '\"\\C-r\": \"hstrcygwin\"'; fi"
+#else
+ "\nif [[ $- =~ .*i.* ]]; then bind -x '\"\\C-r\": \"hstrnotiocsti\"'; fi"
+#endif
+ );
+ printf("\nexport HSTR_TIOCSTI=n");
+ }
+
+ printf("\n\n");
+}
+
+void print_zsh_install_code(void)
+{
+ printf("%s", INSTALL_ZSH_CODE_PREFIX);
+
+ if(is_tiocsti) {
+ printf(
+ "\nbindkey -s \"\\C-r\" \"\\C-a hstr -- \\C-j\" # bind hstr to Ctrl-r (for Vi mode check doc)"
+ "\nexport HSTR_TIOCSTI=y"
+ );
+ } else {
+ printf(
+#if defined(__MS_WSL__)
+ "\nhstr_wsl() {"
+#elif defined(__CYGWIN__)
+ "\nhstr_cygwin() {"
+#else
+ "\nhstr_no_tiocsti() {"
+#endif
+
+ "\n zle -I"
+ "\n { HSTR_OUT=\"$( { </dev/tty hstr ${BUFFER}; } 2>&1 1>&3 3>&- )\"; } 3>&1;"
+ "\n BUFFER=\"${HSTR_OUT}\""
+ "\n CURSOR=${#BUFFER}"
+ "\n zle redisplay"
+ "\n}"
+
+#if defined(__MS_WSL__)
+ "\nzle -N hstr_wsl"
+ "\nbindkey '\\C-r' hstr_wsl"
+#elif defined(__CYGWIN__)
+ "\nzle -N hstr_cygwin"
+ "\nbindkey '\\C-r' hstr_cygwin"
+#else
+ "\nzle -N hstr_no_tiocsti"
+ "\nbindkey '\\C-r' hstr_no_tiocsti"
+#endif
+ );
+ printf("\nexport HSTR_TIOCSTI=n");
+ }
+
+ printf("\n\n");
+}
+
unsigned recalculate_max_history_items(void)
{
int n = getmaxy(stdscr);
@@ -1207,6 +1227,7 @@ void stdout_history_and_return(void)
}
// IMPROVE hstr doesn't have to be passed as parameter - it's global static
+// TODO rename method _
char* getResultFromSelection(int selectionCursorPosition, Hstr* hstr, char* result) {
if (hstr->promptBottom) {
result=hstr->selection[hstr->promptItems-selectionCursorPosition-1];
@@ -1625,6 +1646,7 @@ void loop_to_select(void)
fill_terminal_input("\"", FALSE);
}
if(executeResult) {
+ // TODO w/o TIOCSTI the command is NOT executed, just shown in the prompt
fill_terminal_input("\n", FALSE);
}
}
@@ -1670,7 +1692,7 @@ void hstr_interactive(void)
void hstr_getopt(int argc, char **argv)
{
int option_index = 0;
- int option = getopt_long(argc, argv, "fkVhnszbi", long_options, &option_index);
+ int option = getopt_long(argc, argv, "fkVhnsBZbti", long_options, &option_index);
if(option != -1) {
switch(option) {
case 'f':
@@ -1700,20 +1722,32 @@ void hstr_getopt(int argc, char **argv)
printf("%s", VERSION_STRING);
hstr_exit(EXIT_SUCCESS);
break;
+ case 't':
+ if(is_tiocsti) {
+ printf("y\n");
+ } else {
+ printf("n\n");
+ }
+ hstr_exit(EXIT_SUCCESS);
+ break;
case 'h':
printf("%s", HELP_STRING);
hstr_exit(EXIT_SUCCESS);
break;
- case 'z':
- printf("%s", INSTALL_ZSH_STRING);
+ case 'B':
+ print_bash_install_code();
+ hstr_exit(EXIT_SUCCESS);
+ break;
+ case 'Z':
+ print_zsh_install_code();
hstr_exit(EXIT_SUCCESS);
break;
case 's':
// ZSH_VERSION is not exported by zsh > detected by parent process name
- if(isZshParentShell()) {
- printf("%s", INSTALL_ZSH_STRING);
+ if(is_zsh_parent_shell()) {
+ print_zsh_install_code();
} else {
- printf("%s", INSTALL_BASH_STRING);
+ print_bash_install_code();
}
hstr_exit(EXIT_SUCCESS);
break;
@@ -1733,6 +1767,13 @@ int hstr_main(int argc, char* argv[])
{
setlocale(LC_ALL, "");
+ // initialize global TIOCSTI indicator
+#ifdef DEBUG_NO_TIOCSTI
+ is_tiocsti = false;
+#else
+ is_tiocsti = is_tiocsti_supported();
+#endif
+
hstr=malloc(sizeof(Hstr));
hstr_init();
diff --git a/src/hstr_blacklist.c b/src/hstr_blacklist.c
index bf90e5f..c382aa1 100644
--- a/src/hstr_blacklist.c
+++ b/src/hstr_blacklist.c
@@ -1,7 +1,7 @@
/*
hstr_blacklist.c commands to be skipped from history
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/hstr_curses.c b/src/hstr_curses.c
index 0974ab2..e5aa288 100644
--- a/src/hstr_curses.c
+++ b/src/hstr_curses.c
@@ -2,7 +2,7 @@
hstr_curses.c Curses utilities
http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/hstr_favorites.c b/src/hstr_favorites.c
index 667ecee..a55724f 100644
--- a/src/hstr_favorites.c
+++ b/src/hstr_favorites.c
@@ -1,7 +1,7 @@
/*
hstr_favorites.c favorite commands
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/hstr_history.c b/src/hstr_history.c
index 57bb534..f8b8f69 100644
--- a/src/hstr_history.c
+++ b/src/hstr_history.c
@@ -1,7 +1,7 @@
/*
hstr_history.c loading and processing of BASH history
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ char* get_history_file_name(void)
{
char* historyFile = getenv(ENV_VAR_HISTFILE);
if(!historyFile || strlen(historyFile)==0) {
- if(isZshParentShell()) {
+ if(is_zsh_parent_shell()) {
historyFile = get_home_file_path(FILE_ZSH_HISTORY);
if(access(historyFile, F_OK) == -1) {
free(historyFile);
@@ -104,7 +104,7 @@ char* parse_history_line(char *l)
#ifndef HSTR_TESTS_UNIT
static bool isZsh, c;
if(!c) {
- isZsh=isZshParentShell();
+ isZsh=is_zsh_parent_shell();
c=true;
}
#endif
@@ -405,7 +405,7 @@ int history_mgmt_remove_from_ranked(char *cmd, HistoryItems *history) {
void history_mgmt_flush(void)
{
- if(dirty && !isZshParentShell()) {
+ if(dirty && !is_zsh_parent_shell()) {
fill_terminal_input("history -r\n", false);
}
}
diff --git a/src/hstr_regexp.c b/src/hstr_regexp.c
index 1252e33..33b09a2 100644
--- a/src/hstr_regexp.c
+++ b/src/hstr_regexp.c
@@ -1,7 +1,7 @@
/*
hstr_regexp.c simplified regexp that suits HSTR needs - matching and caching
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/hstr_utils.c b/src/hstr_utils.c
index cb3b238..c37f3ed 100644
--- a/src/hstr_utils.c
+++ b/src/hstr_utils.c
@@ -1,7 +1,7 @@
/*
hstr_utils.c utilities
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -23,10 +23,15 @@
// TODO PID_BUFFER 20+ characters might be enough
#define PID_BUFFER_SIZE 128
-// This define is used to compile out code which inserts command to console - thus
-// define allows to activate and debug shell script workaround that is used on WSL
-// and Cygwin.
-//#define DEBUG_NO_TIOCSTI
+/*
+ * global variables
+ */
+
+bool is_tiocsti = false;
+
+/*
+ * functions
+ */
// strdup() not in ISO C
char* hstr_strdup(const char* s)
@@ -106,13 +111,48 @@ void hstr_chop(char *s)
}
}
-#if !defined(__MS_WSL__) && !defined(__CYGWIN__) && !defined(DEBUG_NO_TIOCSTI)
-void tiocsti()
+bool is_tiocsti_supported(void)
+{
+#if defined(__MS_WSL__) || defined(__CYGWIN__)
+ return false;
+#else
+ int fd;
+ struct termios t;
+
+ fd = open("/dev/tty", O_RDWR);
+ if (fd < 0) {
+ printf("Error: unable to detect whether TIOCSTI is supported by the kernel");
+ perror("open /dev/tty");
+ return false;
+ }
+ if (tcgetattr(fd, &t) < 0) {
+ printf("Error: unable to detect whether TIOCSTI is supported by the kernel");
+ perror("tcgetattr");
+ return false;
+ }
+
+ bool is_supported = false;
+ // probe TIOCSTI by sending (and clearing) the character
+ if (!ioctl(fd, TIOCSTI, " ")) { // send probe character
+ tcflush(fd, TCIOFLUSH); // flush probe character (avoid insert to prompt)
+ return true;
+ }
+ close(fd);
+
+ return is_supported;
+#endif
+}
+
+#if !defined(__MS_WSL__) && !defined(__CYGWIN__)
+void tiocsti(void)
{
char buf[] = DEFAULT_COMMAND;
unsigned i;
for (i=0; i<sizeof buf-1; i++) {
- ioctl(0, TIOCSTI, &buf[i]);
+ if (ioctl(0, TIOCSTI, &buf[i]) < 0) {
+ perror("Unable to execute TIOCSTI using ioctl()");
+ exit(1);
+ }
}
}
#endif
@@ -120,21 +160,21 @@ void tiocsti()
void fill_terminal_input(char* cmd, bool padding)
{
if(cmd && strlen(cmd)>0) {
-#if defined(__MS_WSL__) || defined(__CYGWIN__) || defined(DEBUG_NO_TIOCSTI)
- fprintf(stderr, "%s", cmd);
- if(padding) fprintf(stderr, "%s", "\n");
-#else
- size_t size = strlen(cmd);
- unsigned i;
- char *c;
- for (i = 0; i < size; i++) {
- // terminal I/O control, simulate terminal input
- c=(cmd+i);
- ioctl(0, TIOCSTI, c);
+ if(is_tiocsti) {
+ size_t size = strlen(cmd);
+ unsigned i;
+ char *c;
+ for (i = 0; i < size; i++) {
+ // terminal I/O control, simulate terminal input
+ c=(cmd+i);
+ ioctl(0, TIOCSTI, c);
+ }
+ // echo, but don't flush to terminal
+ if(padding) printf("\n");
+ } else {
+ fprintf(stderr, "%s", cmd);
+ if(padding) fprintf(stderr, "%s", "\n");
}
- // echo, but don't flush to terminal
- if(padding) printf("\n");
-#endif
}
}
@@ -227,7 +267,7 @@ char *get_shell_name_by_ppid(const int pid)
return name;
}
-bool isZshParentShell(void) {
+bool is_zsh_parent_shell(void) {
pid_t parentPid=getppid();
char* cmdline=get_shell_name_by_ppid(parentPid);
bool result=cmdline && strstr(cmdline, "zsh");
diff --git a/src/include/hashset.h b/src/include/hashset.h
index cc65264..ac1004c 100644
--- a/src/include/hashset.h
+++ b/src/include/hashset.h
@@ -1,7 +1,7 @@
/*
hashset.h header file for hash set
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/include/hstr.h b/src/include/hstr.h
index c547998..25383d8 100644
--- a/src/include/hstr.h
+++ b/src/include/hstr.h
@@ -1,7 +1,7 @@
/*
hstr.h header file for HSTR shell history completion utility
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/include/hstr_blacklist.h b/src/include/hstr_blacklist.h
index 3f6c8d6..6ae9925 100644
--- a/src/include/hstr_blacklist.h
+++ b/src/include/hstr_blacklist.h
@@ -1,7 +1,7 @@
/*
hstr_blacklist.h header file for commands to be skipped from history
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/include/hstr_curses.h b/src/include/hstr_curses.h
index 49a6760..5544c23 100644
--- a/src/include/hstr_curses.h
+++ b/src/include/hstr_curses.h
@@ -1,7 +1,7 @@
/*
hstr_curses.h header file for curses helpers
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/include/hstr_favorites.h b/src/include/hstr_favorites.h
index dadd4aa..21a9648 100644
--- a/src/include/hstr_favorites.h
+++ b/src/include/hstr_favorites.h
@@ -1,7 +1,7 @@
/*
hstr_favorites.h header file for favorite commands
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/include/hstr_history.h b/src/include/hstr_history.h
index d7834f6..4138767 100644
--- a/src/include/hstr_history.h
+++ b/src/include/hstr_history.h
@@ -1,7 +1,7 @@
/*
hstr_history.h header file for loading and processing of BASH history
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/include/hstr_regexp.h b/src/include/hstr_regexp.h
index 877d999..94fd734 100644
--- a/src/include/hstr_regexp.h
+++ b/src/include/hstr_regexp.h
@@ -1,7 +1,7 @@
/*
hstr_regexp.h header file for simplified regexp that suits HSTR needs
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/include/hstr_utils.h b/src/include/hstr_utils.h
index 4c5c32f..f2a6a00 100644
--- a/src/include/hstr_utils.h
+++ b/src/include/hstr_utils.h
@@ -1,7 +1,7 @@
/*
hstr_utils.h header file for HSTR utilities
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -20,12 +20,14 @@
#define HSTR_UTILS_H
#include <ctype.h>
+#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
+#include <termios.h>
#include <unistd.h>
#define ENV_VAR_HOME "HOME"
@@ -36,19 +38,63 @@
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
+// TIOCSTI is an acronym for "Terminal Input Output Control STack Input",
+// and it is a system call used in Unix-like operating systems. The TIOCSTI
+// system call allows to insert data into the input buffer of a terminal
+// as if it had been typed by the user.
+//
+// TIOCSTI is NOT available on:
+// - Linux kernel >=6.2.0
+// - Cygwin
+// - WSL
+//
+// HSTR uses TIOCSTI to insert a command chosen by the user in HSTR
+// to shell prompt - if TIOCSTI is available. Otherwise shell features
+// must be used.
+//
+// HSTR modus operandi:
+//
+// - user runs `hstr` command
+// - `hstr` checks whether TIOCSTI is supported by the kernel or not
+// - if TIOCSTI SUPPORTED, then HSTR continues as it is able to insert
+// any chosen command into Bash/Zsh prompt
+// - if TIOCSTI NOT supported, then:
+// - HSTR checks for `HSTR_TIOCSTI` environment variable:
+// - if `HSTR_TIOCSTI` is NOT defined, then it prints an error and asks
+// user to configure HSTR (--show-configuration >> .*rc)
+// - if `HSTR_TIOCSTI` is DEFINED, then:
+// - if it is SET to `n`, then HSTR presumes that it has
+// been configured and that the shell function (which replaces TIOCSTI)
+// is defined > HSTR uses the function to insert command > DONE
+// - OTHERWISE HSTR prints and error and ask user to configure HSTR
+// with --show-configuration >> .*rc
+//
+// HSTR features related to TIOCSTI
+//
+// - HSTR can detect whether TIOCSTI is supported by the kernel:
+// hstr --is-tiocsti
+// the command returns "y" or "n" (and exit code: 0 or 1)
+// - HSTR checks for the following env variable if TIOCSTI is not detected
+// HSTR_TIOCSTI=y or HSTR_TIOCSTI=n
+//
+
+// global TIOCSTI indicator declaration
+extern bool is_tiocsti;
+
char* hstr_strdup(const char* s);
int hstr_strlen(const char* s);
char* hstr_strelide(char* buffer, const char* s, unsigned maxlength);
void hstr_chop(char* s);
-#ifndef __CYGWIN__
-void tiocsti();
+bool is_tiocsti_supported(void);
+#if !defined(__MS_WSL__) && !defined(__CYGWIN__)
+void tiocsti(void);
#endif
void fill_terminal_input(char* cmd, bool padding);
void reverse_char_pointer_array(char** array, unsigned length);
void get_hostname(int bufferSize, char* buffer);
char* get_home_file_path(char* filename);
void toggle_case(char* str, bool lowercase);
-bool isZshParentShell(void);
+bool is_zsh_parent_shell(void);
char* zsh_unmetafy(char* s, int* len);
#endif
diff --git a/src/include/radixsort.h b/src/include/radixsort.h
index b75e4ce..baf468c 100644
--- a/src/include/radixsort.h
+++ b/src/include/radixsort.h
@@ -1,7 +1,7 @@
/*
radixsort.h header file for radix sort implementation
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/main.c b/src/main.c
index 3d642bc..cca285e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,7 @@
/*
main.c HSTR shell history completion utility main
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/radixsort.c b/src/radixsort.c
index 334fc42..2a752f3 100644
--- a/src/radixsort.c
+++ b/src/radixsort.c
@@ -1,7 +1,7 @@
/*
radixsort.c radix sort
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/test/hstr-unit-tests.pro b/test/hstr-unit-tests.pro
index 0093e11..9d71cd2 100644
--- a/test/hstr-unit-tests.pro
+++ b/test/hstr-unit-tests.pro
@@ -1,6 +1,6 @@
# hstr-unit-tests.pro Qt project file of UNIT tests for HSTR
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/test/sh/tiotcsi-function-bash.sh b/test/sh/tiotcsi-function-bash.sh
new file mode 100755
index 0000000..863967d
--- /dev/null
+++ b/test/sh/tiotcsi-function-bash.sh
@@ -0,0 +1,198 @@
+#!/usr/bin/env bash
+# This script is used to experiment with Bash functions in order to set
+# the content of the terminal prompt without TIOCSTI ioctl() call.
+#
+# IMPORTANT: to use the functions below @ Bash
+#
+# - check the bind command at the end of the file
+# in order to control which function to use
+# - source this file in the current shell
+# . ./tiotcsi-functions.h
+# - use ^R to test the function
+
+# ORIGINAL FUNCTION VERSION
+#
+# - function contributed by a HSTR user for Cygwin
+# - Bash only (does not work in Zsh)
+# - I don't understand {hstrout} trick (actually I do, however, it seems to work in non-interactive mode only)
+function hstrcygwin {
+ offset=${READLINE_POINT}
+ READLINE_POINT=0
+ { READLINE_LINE=$(</dev/tty hstr ${READLINE_LINE:0:offset} 2>&1 1>&$hstrout); } {hstrout}>&1
+ READLINE_POINT=${#READLINE_LINE}
+}
+
+# MY FUNCTION VERSION
+#
+# - hstr gets current prompt string using READLINE_LINE
+# - function sets what to show by changing the content of READLINE_LINE
+# - ... which is much simpler than the original function, but is it good enough?
+
+function foohstr {
+ echo "hstr-cmd-out ${1}"
+}
+
+function mysimple {
+ # prompt command content BEFORE
+ PROMPT_STR_BEFORE=${READLINE_LINE}
+ # cursor position at prompt BEFORE
+ PROMPT_LNG_BEFORE=${READLINE_POINT}
+
+ # HSTR gets PROMPT_STR_BEFORE
+ # HSTR prints out command which user selected after using ^
+ # ^ is set to READLINE_LINE
+ # prompt cursor is set to the end of line by setting READLINE_POINT to 1000 (blindly)
+
+ { READLINE_LINE=$(foohstr ${PROMPT_STR_BEFORE}) 2>&1; }
+ # move cursor to the end of prompt
+ READLINE_POINT=${#READLINE_LINE}
+}
+
+
+# EXPERIMENTAL LAB
+#
+# - understanding bash-fu
+
+function hstrdebug {
+ # content of the current terminal prompt
+ echo "Readline line : '${READLINE_LINE}'"
+ # how many characters is @ current terminal prompt
+ echo "Readline point: '${READLINE_POINT}'"
+
+ READLINE_POINT=0
+
+ # OBSERVATIONS:
+ # {hstrout}>&1 ... is VALID expression
+ # {hstrout} > &1 ... is INVALID expression
+
+ # command:
+ # - runs $() and redirects 2 and 1 to STDOUT
+ #{ READLINE_LINE=$(echo COMMAND) 2>&1 1>&$hstrout; } {hstrout}>&1
+ # - < /dev/tty
+ # ... read what is @ current prompt from /dev/tty (but I could use READLINE_LINE for it!)
+ # - offset=${READLINE_POINT}
+ # ... how long is the string @ prompt
+ # - ${READLINE_LINE:0:offset}
+ # ... substring of prompt from 0 to cursor position
+ # { READLINE_LINE=$(< /dev/tty echo ${READLINE_LINE:0:offset}) 2>&1; }
+
+ # store read line lenghth to read line POINT to set curser to the end of line
+ READLINE_POINT=${#READLINE_LINE}
+ # in principle I can do and it will have the same effect
+ # READLINE_POINT=1000
+
+ # after:
+ echo "Readline line : '${READLINE_LINE}'"
+ echo "Readline point: '${READLINE_POINT}'"
+}
+
+#
+# BINDING
+#
+
+# bind '"\C-r": "\C-a hstr -- \C-j"'
+# - bind
+# ... Bash command which binds key sequence (Ctrl-r) to a command,
+# bind INSERTS the command to the terminal
+# - "\C-r"
+# ... key sequence to bind
+# - "\C-a hstr -- \C-j"
+# ... command to execute ~ text to be inserted to the terminal:
+# \C-a ... moves cursor to the beginning of line
+# hstr -- ... inserts "hstr -- " to the terminal
+# \C-j ... RUNs the command by INSERTing new line
+# (without Ctrl-j, text would be just inserted, but not run)
+
+# bind -x '"\C-r": "hstrfunction"'
+# ... Bash command which binds key sequence (Ctrl-r) to a command,
+# bind INSERTS the command to the terminal
+# - -x
+# ... enables READLINE_LINE and READLINE_POINT
+# - hstrfunction
+# ... function which uses READLINE_LINE and READLINE_POINT variables
+#
+
+#
+# IMPORTANT bind -x
+#
+# - bind -x must be used in order to enable READLINE_LINE, READLINE_POINT
+# - see also: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-READLINE_005fLINE
+#
+# READLINE_LINE
+# The contents of the Readline line buffer, for use with ‘bind -x’ (see Bash Builtin Commands).
+#
+# READLINE_POINT
+# The position of the insertion point in the Readline line buffer, for use with ‘bind -x’ (see Bash Builtin Commands).
+
+if [[ $- =~ .*i.* ]]; then bind -x '"\C-r": "mysimple"'; fi
+#if [[ $- =~ .*i.* ]]; then bind -x '"\C-r": "hstrdebug"'; fi
+#if [[ $- =~ .*i.* ]]; then bind -x '"\C-r": "hstrcygwin"'; fi
+
+# ##################################################################
+#
+# EXAMPLE: WORKING insert into prompt
+#
+
+function mytest {
+ READLINE_LINE="XYZ"
+ READLINE_POINT=3
+}
+bind -x '"\C-r": "mytest"'
+
+# ##################################################################
+#
+# EXAMPLE: WORKING foo HSTR w/ a lot of debugs
+#
+# get terminal input > send it to HSTR > get command from HSTR > insert it
+
+function foohstr {
+ echo "CMD_BY_HSTR: >>>${1}<<<"
+}
+
+function hstrdebug {
+ # content of the current terminal prompt
+ echo "Readline line : '${READLINE_LINE}'"
+ # how many characters is @ current terminal prompt
+ echo "Readline point: '${READLINE_POINT}'"
+
+ TO_SET=$(foohstr ${READLINE_LINE})
+
+ READLINE_POINT=0
+
+ # insert text to terminal
+ echo "Setting: '${TO_SET}'"
+ READLINE_LINE="${TO_SET}"
+
+ # store read line length to read line POINT to set cursor to the end of line
+ READLINE_POINT=${#READLINE_LINE}
+
+ # after:
+ echo "Readline line : '${READLINE_LINE}'"
+ echo "Readline point: '${READLINE_POINT}'"
+}
+
+bind -x '"\C-r": "hstrdebug"'
+
+# ##################################################################
+#
+# EXAMPLE: WORKING minimal production version w/ foo HSTR
+
+# HSTR configuration - add this to ~/.bashrc
+alias hh=hstr # hh to be alias for hstr
+export HSTR_CONFIG=hicolor # get more colors
+shopt -s histappend # append new history items to .bash_history
+export HISTCONTROL=ignorespace # leading space hides commands from history
+export HISTFILESIZE=10000 # increase history file size (default is 500)
+export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
+# ensure synchronization between bash memory and history file
+export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
+# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
+function hstrnotiocsti {
+ { HSTR_OUT="$( { </dev/tty hstr ${READLINE_LINE}; } 2>&1 1>&3 3>&- )"; } 3>&1;
+ READLINE_LINE="${HSTR_OUT}"
+ READLINE_POINT=${#READLINE_LINE}
+}
+if [[ $- =~ .*i.* ]]; then bind -x '"\C-r": "hstrnotiocsti"'; fi
+export HSTR_TIOCSTI=n
+
+# eof
diff --git a/test/sh/tiotcsi-function-zsh.sh b/test/sh/tiotcsi-function-zsh.sh
new file mode 100755
index 0000000..80ee968
--- /dev/null
+++ b/test/sh/tiotcsi-function-zsh.sh
@@ -0,0 +1,98 @@
+#!/usr/bin/env bash
+
+# ##################################################################
+# EXAMPLE: NOT WORKING version
+
+# Define a function to replace a word in the current line
+replace-word() {
+ local oldword newword
+ zle -I # switch to insert mode
+ read -k "oldword?Enter word to replace: "
+ read -k "newword?Enter replacement word: "
+ BUFFER=${BUFFER//$oldword/$newword} # replace old word with new word
+ zle redisplay # update the display
+}
+
+# Bind the function to a key sequence
+bindkey '^Xr' replace-word
+
+# ##################################################################
+#
+# EXAMPLE: WORKING version w/ foo HSTR
+
+foohstr() {
+ echo "command-by-hstr-${1}"
+}
+
+hstrnotiocsti() {
+ local word
+ # we need the WHOLE buffer, not just 0 to cursor: word=${BUFFER[0,CURSOR]}
+ BUFFER="$(foohstr ${BUFFER})"
+ CURSOR=${#BUFFER}
+ # update the display
+ zle redisplay
+}
+
+# create ZLE widget ~ readline function
+zle -N hstrnotiocsti
+# bind widget to keyboard shortcut
+bindkey '\C-r' hstrnotiocsti
+
+# ##################################################################
+#
+# EXAMPLE: WORKING minimal production version w/ foo HSTR
+#
+# PROBLEM:
+# - active ZLE takes over the terminal input & output streams
+# - attempt to run HSTR using $(), ``, ... BLOCKS active ZLE progress
+# - w/o ZLE it is not possible to insert text into the terminal
+#
+# SOLUTION:
+# - HSTR input: can be enable by reading from </dev/tty
+# - HSTR output: is sent to stderr (as stdout is occupied by Curses)
+
+hstr_notiocsti() {
+ zle -I
+ TMPFILE=$(mktemp)
+ </dev/tty hstr ${BUFFER} 2> ${TMPFILE}
+ BUFFER="$(cat ${TMPFILE})"
+ CURSOR=${#BUFFER}
+ zle redisplay
+ rm TMPFILE > /dev/null 2>&1
+}
+zle -N hstr_notiocsti
+bindkey '\C-r' hstr_notiocsti
+
+export HSTR_TIOCSTI=n
+
+# ##################################################################
+#
+# EXAMPLE: WORKING minimal production version w/ foo HSTR
+#
+# PROBLEM:
+# - active ZLE takes over the terminal input & output streams
+# - attempt to run HSTR using $(), ``, ... BLOCKS active ZLE progress
+# - w/o ZLE it is not possible to insert text into the terminal
+#
+# SOLUTION:
+# - HSTR input: can be enable by reading from </dev/tty
+# - HSTR output: we use CUSTOM file handle to get stderr output ONLY
+# 1. 2>&1 ... redirect stderr to stdout
+# 2. 1>&3 ... redirect stdout to custom file handle
+# (thus ONLY stderr is sent to stdout)
+# 3. 3>&- ... close custom file handle
+# (thus close stdout i.e. stdout won't be sent anywhere)
+# { ... } ... to execute in the current shell & set HSTR_OUT
+# 3>&1 ... restore stdout to custom file handle
+
+hstr_no_tiocsti() {
+ zle -I
+ { HSTR_OUT="$( { </dev/tty hstr ${BUFFER}; } 2>&1 1>&3 3>&- )"; } 3>&1;
+ BUFFER="${HSTR_OUT}"
+ CURSOR=${#BUFFER}
+ zle redisplay
+}
+zle -N hstr_no_tiocsti
+bindkey '\C-r' hstr_no_tiocsti
+
+# eof
diff --git a/test/sh/tiotcsi-learning-bashfu.sh b/test/sh/tiotcsi-learning-bashfu.sh
new file mode 100755
index 0000000..a065741
--- /dev/null
+++ b/test/sh/tiotcsi-learning-bashfu.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+
+# group commands in a sub-shell: ( )
+# (list)
+# group commands in the CURRENT shell: { }
+# { list; }
+# test - return the binary result of an expression: [[ ]]
+# [[ expression ]]
+# arithmetic expansion
+# $(( expression ))
+# (( expression ))
+
+# { can be used to GROUP output of multiple commands into one BLOB
+# - https://www.linux.com/topic/desktop/all-about-curly-braces-bash/
+# - ; to separate commands
+# - executed in the curren shell
+{ echo a; echo B; echo c; }
+echo "-------------------"
+
+# string operations @ var
+MY_VAR="abcde"
+echo ${MY_VAR:0:1} # a
+echo ${MY_VAR:0:2} # ab
+echo ${MY_VAR:0:3} # abc
+echo "-------------------"
+
+# new and suggested execution
+MY_VAR="$(pwd)"
+echo $MY_VAR
+
+
+# Bash bind:
+#
+# bash -x keyseq:shell-command
+# Cause SHELL-COMMAND to be executed when KEYSEQ is entered
+#
+# Bash VARIABLES doc:
+#
+# READLINE_LINE
+# The contents of the Readline line buffer, for use with ‘bind -x’
+# READLINE_POINT
+# The position of the insertion point in the Readline line buffer, for use with ‘bind -x’
+#
+
+echo "Readline line : '${READLINE_LINE}'"
+echo "Readline point: '${READLINE_POINT}'"
+
+# TODO
+# TODO
+# TODO
+# TODO ^ must be tested @ .bashrc @ bind -x where these variable are set (not set elsewhere)
+# TODO
+# TODO
+
+echo "- expression: ------------------"
+
+# TODO
+# execute COMMAND in the CURRENT shell and store it to variable READLINE_LINE
+#{ READLINE_LINE=$(echo COMMAND) 2>&1 1>&$hstrout; } {hstrout} > &1
+
+echo "^------------------"
+
+#
+# DECODING CRAZY EXPRESSION
+#
+# { READLINE_LINE=$(</dev/tty hstr ${READLINE_LINE:0:offset} 2>&1 1>&$hstrout); } {hstrout}>&1
+echo "- expression 1: ------------------"
+# execute COMMAND in the CURRENT shell and store it to variable READLINE_LINE
+{ READLINE_LINE=$(echo COMMAND); }
+echo $READLINE_LINE
+echo "^------------------"
+
+# read input for the command from file
+grep abc < without-tiotcsh.sh
+# EQUIVALENT way how to write it (reads input for command from file):
+< without-tiotcsh.sh grep abc
+
+echo "- expression 2: ------------------"
+# execute COMMAND in the CURRENT shell and store it to variable READLINE_LINE
+
+# {hstrout} >&1
+# ... run command which is in the hstrout
+function myfun {
+ # { READLINE_LINE=$(echo COMMAND) 2>&1 1>&$hstrout; } {hstrout} >&1
+ hstrout=ls
+ { READLINE_LINE=$(echo COMMAND) 2>&1 1>&$hstrout; } {hstrout}
+}
+myfun
+echo "^------------------"
+
+# CMD > &${hstrout}
+# ... redirect standard output of the command CMD to the FILE whose name is stored in hstrout variable
+
+################################################################################
+# zsh version by fzf
+#
+# https://github.com/junegunn/fzf/blob/c387689d1cd45f0d8eb122fe95ee72ccc61d3bff/shell/key-bindings.bash#L41
+
+
+# eof
diff --git a/test/src/test.c b/test/src/test.c
index 4e35f77..9abfedf 100644
--- a/test/src/test.c
+++ b/test/src/test.c
@@ -1,7 +1,7 @@
/*
test.c UNIT tests main for HSTR shell history completion utility
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/src/test_curses_keyb.c b/test/src/test_curses_keyb.c
index 93afcf5..ecafae5 100644
--- a/test/src/test_curses_keyb.c
+++ b/test/src/test_curses_keyb.c
@@ -1,7 +1,7 @@
/*
test_*.c HSTR test
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/src/test_history_generator.c b/test/src/test_history_generator.c
index dd37107..45d7f1f 100644
--- a/test/src/test_history_generator.c
+++ b/test/src/test_history_generator.c
@@ -1,7 +1,7 @@
/*
test_*.c HSTR test
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/src/test_keyb.c b/test/src/test_keyb.c
index 0926c57..50571d1 100644
--- a/test/src/test_keyb.c
+++ b/test/src/test_keyb.c
@@ -1,7 +1,7 @@
/*
test_*.c HSTR test
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/src/test_utf8.c b/test/src/test_utf8.c
index e2f50aa..4a4d083 100644
--- a/test/src/test_utf8.c
+++ b/test/src/test_utf8.c
@@ -1,7 +1,7 @@
/*
test_*.c HSTR test
- Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+ Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/test/test-bug-124.sh b/test/test-bug-124.sh
index 48c9d26..339ffdf 100755
--- a/test/test-bug-124.sh
+++ b/test/test-bug-124.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/test/test-bug-163.sh b/test/test-bug-163.sh
index d7a15cb..418c6f6 100755
--- a/test/test-bug-163.sh
+++ b/test/test-bug-163.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/test/test-bug-175.sh b/test/test-bug-175.sh
index 10fb5ad..c8373f1 100755
--- a/test/test-bug-175.sh
+++ b/test/test-bug-175.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/test/test-bug-176.sh b/test/test-bug-176.sh
index 90ebd51..548ca0b 100755
--- a/test/test-bug-176.sh
+++ b/test/test-bug-176.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/test/test-bug-228.sh b/test/test-bug-228.sh
index f23cfe2..8b51762 100755
--- a/test/test-bug-228.sh
+++ b/test/test-bug-228.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/test/test-curses-keyb.sh b/test/test-curses-keyb.sh
index 5d538f7..7c0920c 100755
--- a/test/test-curses-keyb.sh
+++ b/test/test-curses-keyb.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/test/test-history-generator.sh b/test/test-history-generator.sh
index 602d097..75e71af 100755
--- a/test/test-history-generator.sh
+++ b/test/test-history-generator.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/test/test-keyb.sh b/test/test-keyb.sh
index b17591c..2d961a9 100755
--- a/test/test-keyb.sh
+++ b/test/test-keyb.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/test/test-utf8.sh b/test/test-utf8.sh
index 0746c48..94d4f69 100755
--- a/test/test-utf8.sh
+++ b/test/test-utf8.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2014-2022 Martin Dvorak <martin.dvorak@mindforger.com>
+# Copyright (C) 2014-2023 Martin Dvorak <martin.dvorak@mindforger.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.