inshellisense icon indicating copy to clipboard operation
inshellisense copied to clipboard

PowerShell: Command history is not available using up and down arrows

Open philibertperusse opened this issue 2 years ago • 5 comments

When inside inshellisence, using up or down arrows will not bring up commands from the command history.

Applicable to PowerShell, not tested with bash or other shells.

philibertperusse avatar Nov 06 '23 23:11 philibertperusse

Closing as this was fixed in 0.0.1-rc.5

cpendery avatar Dec 05 '23 21:12 cpendery

node: v20.18.0 inshellisense: 0.0.1-rc.16 powershell

Name Value
PSVersion 5.1.19041.5007
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.5007
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

it stuck in

cd ~\Developer\intro-to-react-by-day\day-10-ts\ ; bun run dev

Image

This Might Help:

  • if i add trailing spaces in ConsoleHost_history.txt file after run dev it's doesn't stuck
  • but trailing spaces doesn't always help eg:
    1. with trailing spaces code --user-data-dir="${HOME}/.vscode-root" ❌ stuck
    2. without trailing spaces code --user-data-dir="${HOME}/.vscode-root" ❌ stuck
    3. with .exe code.exe --user-data-dir="${HOME}/.vscode-root" ✔ doesn't stuck

@cpendery is there a workaround like

[bindings.previousSuggestion] 
key = "up"
ctrl = true

this is really annoying

assiless avatar Oct 26 '24 14:10 assiless

node: v20.18.0 inshellisense: 0.0.1-rc.16 powershell

Name Value PSVersion 5.1.19041.5007 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.5007 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 it stuck in

cd ~\Developer\intro-to-react-by-day\day-10-ts\ ; bun run dev Image Image

This Might Help:

  • if i add trailing spaces in ConsoleHost_history.txt file after run dev it's doesn't stuck

  • but trailing spaces doesn't always help eg:

    1. with trailing spaces code --user-data-dir="${HOME}/.vscode-root" ❌ stuck
    2. without trailing spaces code --user-data-dir="${HOME}/.vscode-root" ❌ stuck
    3. with .exe code.exe --user-data-dir="${HOME}/.vscode-root" ✔ doesn't stuck

@cpendery is there a workaround like

[bindings.previousSuggestion] key = "up" ctrl = true this is really annoying

I can't replicate this on 0.0.1-rc.16. Can you try on 0.0.1-rc.18 and run inshellisense with the -V option? The logs will be at ~/.inshellisense/inshellisense.log and it would help alot if you could provide them here

cpendery avatar Nov 09 '24 03:11 cpendery

  • the bug was caused by putting plugging at top of "C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1"
  • putting plugging at the end of file solve the issue
# ---------------- inshellisense shell plugin ----------------
$__IsCommandFlag = ([Environment]::GetCommandLineArgs() | ForEach-Object { $_.contains("-Command") }) -contains $true
$__IsNoExitFlag = ([Environment]::GetCommandLineArgs() | ForEach-Object { $_.contains("-NoExit") }) -contains $true
$__IsInteractive = -not $__IsCommandFlag -or ($__IsCommandFlag -and $__IsNoExitFlag)
if ([string]::IsNullOrEmpty($env:ISTERM) -and [Environment]::UserInteractive -and $__IsInteractive) {
  is -s powershell
  Stop-Process -Id $pid
}
# end of file

nb: but this bug still occurs with git-bash-windows "C:\Program Files\Git\etc\bash.bashrc" for 0.0.1-rc.16 and 0.0.1-rc.18

# ---------------- inshellisense shell plugin ----------------
if [[ -z "${ISTERM}" && $- = *i* && $- != *c* ]]; then
	shopt -q login_shell
	login_shell=$?
	if [ $login_shell -eq 0 ]; then
		is -s bash --login ; exit
	else
		is -s bash ; exit
	fi
fi
# end of file

assiless avatar Nov 28 '24 18:11 assiless

I would like to report and add another very similar problem in this discussion, the problem is that you cannot delete the whole word when pressing Ctrl + delete key. This happens when the inshellisense session is live, you can only delete one letter at a time, I noticed this in my powershell terminal using windows 11.

FlashAmarillo avatar Jan 03 '25 21:01 FlashAmarillo

I would like to report and add another very similar problem in this discussion, the problem is that you cannot delete the whole word when pressing Ctrl + delete key. This happens when the inshellisense session is live, you can only delete one letter at a time, I noticed this in my powershell terminal using windows 11.

should be working in 0.0.1-rc.21

cpendery avatar May 23 '25 08:05 cpendery

why this closed when the issue still exist step to reproduce:

  1. put bellow in C:\Users\username\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
ls
watchman trigger-list .
  1. restart powershell
  2. then stuck in watchman trigger-list .

assiless avatar May 25 '25 12:05 assiless

@cpendery do you reproduce on your end or i missing something is esc the only way? is esc necessary here?

assiless avatar Jul 27 '25 08:07 assiless