Description
When using RESH search (Ctrl+R), selecting a command, pressing Right arrow to paste it to the command line, editing the pasted command, and then executing it, the edited command is not saved to history. Only the original (unedited) command that was pasted appears in history.
Steps to Reproduce
- Start a bash session with RESH installed
- Execute some test commands (e.g.,
echo "test1", echo "test2")
- Press
Ctrl+R to open RESH search
- Find and select a previous command
- Press Right arrow to paste the command into the readline buffer (instead of Enter)
- Edit the pasted command (e.g., change
echo "test1" to echo "test3")
- Press Enter to execute the edited command
- Search history again - the edited command is missing
Expected Behavior
The edited command (e.g., echo "test3") should be saved to RESH history after execution.
Actual Behavior
Only the original pasted command appears in history. The edited version is not captured by RESH.
System Information
- RESH version: 3.0.2
- Bash version: GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
- OS: Linux 6.17.0-20-generic
- bash-preexec: Installed at
~/.bash-preexec.sh
Configuration
BindControlR: true
- bash-preexec is sourced before RESH shellrc in
~/.bashrc
- Functions registered:
preexec_functions=(__resh_preexec), precmd_functions=(__resh_precmd)
Analysis
Looking at ~/.resh/hooks.sh (lines 109-113), there's a comment about bash-preexec widget interaction issues:
# This is a very bad workaround.
# Force bash-preexec to run repeatedly because otherwise premature run
# of bash-preexec overshadows the next proper run.
# I honestly think that it's impossible to make widgets work in bash without hacks like this.
__bp_preexec_interactive_mode="on"
This suggests there may be a known issue with how bash-preexec captures commands that are pasted via the RESH widget and then edited before execution.
Workaround
Using Enter to execute commands directly from RESH search (instead of Right arrow) works correctly and saves to history.
Question
Is there a configuration option or fix to ensure edited pasted commands are captured? Or is this a limitation of the bash-preexec/readline integration?
Description
When using RESH search (Ctrl+R), selecting a command, pressing Right arrow to paste it to the command line, editing the pasted command, and then executing it, the edited command is not saved to history. Only the original (unedited) command that was pasted appears in history.
Steps to Reproduce
echo "test1",echo "test2")Ctrl+Rto open RESH searchecho "test1"toecho "test3")Expected Behavior
The edited command (e.g.,
echo "test3") should be saved to RESH history after execution.Actual Behavior
Only the original pasted command appears in history. The edited version is not captured by RESH.
System Information
~/.bash-preexec.shConfiguration
BindControlR: true~/.bashrcpreexec_functions=(__resh_preexec),precmd_functions=(__resh_precmd)Analysis
Looking at
~/.resh/hooks.sh(lines 109-113), there's a comment about bash-preexec widget interaction issues:This suggests there may be a known issue with how bash-preexec captures commands that are pasted via the RESH widget and then edited before execution.
Workaround
Using Enter to execute commands directly from RESH search (instead of Right arrow) works correctly and saves to history.
Question
Is there a configuration option or fix to ensure edited pasted commands are captured? Or is this a limitation of the bash-preexec/readline integration?