fixup history syncing for ingorespace and ignoreboth, update NEWS

parent 6d083f84
......@@ -67,15 +67,13 @@ Overview of changes in v9.2 "Galvanize"
* History Sync changes:
+ BashStyle-NG 9.1 introduced a custom history sync functionality (for syncing
history over simultaneously running sessions), which turned out not to properly
operate when the History Control Type was set to "Erase Duplicates", or
"Ignore Duplicates"
history over simultaneously running sessions), which turned out to break
Bash ${HISTCONTROL}, as it modified the history from outside.
.
This is now worked around by _erasehistorydups respectively _ingorehistorydups
functions, which do the clean-up where Bash fails due to the custom history
handling functions.
This is now worked around by custom functions replacing the ${HISTCONROL} of
Bash since it fails due to the custom history handling functions.
.
please note that this might slow down Bash a bit if you have a huge history
please note that this might slow down Bash a bit if you have a huge history.
=== Configure ===
......
......@@ -209,6 +209,17 @@ if [[ $(ini_get history_sync) == True ]]; then
mv ${HISTFILE}.tmp ${HISTFILE}
}
_ignorehistoryspc () {
sed '$!N;s/\n/HISTDILIMITER/' ${HISTFILE} | \
sed -e '/HISTDILIMITER /d' > ${HISTFILE}.tmp
mv ${HISTFILE}.tmp ${HISTFILE}
}
_ignorehistoryboth () {
_ignorehistoryspc
_ignorehistorydups
}
_synchistory () {
builtin history -a
builtin history -c
......@@ -220,6 +231,8 @@ if [[ $(ini_get history_sync) == True ]]; then
[[ ${HISTCONTROL} == erasedups ]] && trap_add '_erasehistorydups' DEBUG
[[ ${HISTCONTROl} == ignoredups ]] && trap_add '_ignorehistorydups' DEBUG
[[ ${HISTCONTROL} == ignorespace ]] && trap_add '_ignorehistorspc' DEBUG
[[ ${HISTCONTROL} == ignoreboth ]] && trap_add '_ignorehistoryboth' DEBUG
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment