Skip to content

PowerShell with imported CompletionPredictor crashes on git diff command #22

@kborowinski

Description

@kborowinski

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

Environment:

  1. Latest daily PowerShell Core 7.4.0.preview-2 build
  2. Latest CompletionPredictor module build (with git completion support)
  3. PSReadLine 2.3.0-beta0
  4. PowerShell profile:
Import-Module -Name 'CompletionPredictor'

Set-PSReadLineOption -HistoryNoDuplicates
Set-PSReadLineOption -PredictionSource 'HistoryAndPlugin'

Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward

$Parameters = @{
	Key			= 'RightArrow'
	BriefDescription	= 'ForwardCharAndAcceptNextSuggestionWord'
	ScriptBlock		= {
		param($key, $arg)
		$line = $null
		$cursor = $null
		[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([Ref]$line, [Ref]$cursor)
		if ($cursor -lt $line.Length) {
			[Microsoft.PowerShell.PSConsoleReadLine]::ForwardChar($key, $arg)
		} else {
			[Microsoft.PowerShell.PSConsoleReadLine]::AcceptNextSuggestionWord($key, $arg)
		}
	}
}
Set-PSReadlineKeyHandler @Parameters

Steps:

mkdir test
cd .\test\
git init
mkdir empty
git diff

Expected behavior

git diff should not crash PowerShell session

Actual behavior

PowerShell session crashes

Error details

N/A

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.0-preview.2
PSEdition                      Core
GitCommitId                    7.4.0-preview.2-35-g78f1406fd2fed68aa6348df565b6824f8c187ef9
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

0.1.0

Visuals

crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions