kelleyma49 / PSFzf

A PowerShell wrapper around the fuzzy finder fzf
MIT License
813 stars 37 forks source link

Case sensitive? #16

Closed CollinChaffin closed 4 years ago

CollinChaffin commented 6 years ago

Win7x64 here and all the instructions are accurate, but all case sensitive. Even if I disable my entire PS profile and run vanilla and only enable psreadline and then psfzf.

So, I literally have to also hold the SHIFT key along with the CTRL and T keys and CTRL and G for this:

Import-Module PSFzf -ArgumentList 'Ctrl+T','Ctrl+G'

But, I only have to press CTRL and T and CTRL and G for this:

Import-Module PSFzf -ArgumentList 'Ctrl+t','Ctrl+g'

And to even further prove that's what's happening, I could not figure out for the life of me why the built-in ALT+ A key and ALT+ C key as listed in the Readme also did nothing. It sure seemed like the module was just broken. Then, once I figured out the above, I also went back (in any of the shells since it's a default binding) and first held down SHIFT and then pressed the SHIFT+ALT+a and SHIFT+ALT+c, and wholla only with shift to make the literal uppercase "A" and "C" true did the default bindings suddenly work.

This seems to be the case on mult systems I am testing, so is this a new bug or ?

TIA!

kelleyma49 commented 6 years ago

I use capitals key chords in my profile when I import PSFzF. I am using Emacs, but I tried Vi edit mode and capital key chords worked fine for me.

Unfortunately I couldn't recreate your issue. Here's my output from Get-PSReadlineOption and Get-PsReadlineKeyHandler - maybe you can add your results so I can see if its something in your settings:

> Get-PsReadlineOption | Out-Clipboard
EditMode                               : Emacs
ContinuationPrompt                     : >>
ContinuationPromptForegroundColor      : Gray
ContinuationPromptBackgroundColor      : Black
ExtraPromptLineCount                   : 0
AddToHistoryHandler                    :
CommandValidationHandler               :
CommandsToValidateScriptBlockArguments : {ForEach-Object, %, Invoke-Command, icm...}
HistoryNoDuplicates                    : False
MaximumHistoryCount                    : 4096
MaximumKillRingCount                   : 10
HistorySearchCursorMovesToEnd          : False
ShowToolTips                           : False
DingTone                               : 1221
CompletionQueryItems                   : 100
WordDelimiters                         : ;:,.[]{}()/\|^&*-=+'"–—―
DingDuration                           : 50
BellStyle                              : None
HistorySearchCaseSensitive             : False
ViModeIndicator                        : None
HistorySavePath                        : C:\Users\mikelley\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
HistorySaveStyle                       : SaveIncrementally
DefaultTokenForegroundColor            : Gray
CommentForegroundColor                 : DarkGreen
KeywordForegroundColor                 : Green
StringForegroundColor                  : DarkCyan
OperatorForegroundColor                : DarkGray
VariableForegroundColor                : Green
CommandForegroundColor                 : Yellow
ParameterForegroundColor               : Yellow
TypeForegroundColor                    : Gray
NumberForegroundColor                  : White
MemberForegroundColor                  : White
DefaultTokenBackgroundColor            : Black
CommentBackgroundColor                 : Black
KeywordBackgroundColor                 : Black
StringBackgroundColor                  : Black
OperatorBackgroundColor                : Black
VariableBackgroundColor                : Black
CommandBackgroundColor                 : Black
ParameterBackgroundColor               : Black
TypeBackgroundColor                    : Black
NumberBackgroundColor                  : Black
MemberBackgroundColor                  : Black
EmphasisForegroundColor                : Cyan
EmphasisBackgroundColor                : Black
ErrorForegroundColor                   : Red
ErrorBackgroundColor                   : Black
> Get-PsReadlineKeyHandler | Out-Clipboard

Key              Function                       Description
---              --------                       -----------
Backspace        BackwardDeleteChar             Delete the charcter before the cursor
Enter            AcceptLine                     Accept the input or move to the next line if input is missing a closing token.
Shift+Enter      AddLine                        Move the cursor to the next line without attempting to execute the input
LeftArrow        BackwardChar                   Move the cursor back one character
RightArrow       ForwardChar                    Move the cursor forward one character
Shift+LeftArrow  SelectBackwardChar             Adjust the current selection to include the previous character
Shift+RightArrow SelectForwardChar              Adjust the current selection to include the next character
UpArrow          PreviousHistory                Replace the input with the previous item in the history
DownArrow        NextHistory                    Replace the input with the next item in the history
Alt+<            BeginningOfHistory             Move to the first item in the history
Alt+>            EndOfHistory                   Move to the last item (the current input) in the history
Home             BeginningOfLine                Move the cursor to the beginning of the line
End              EndOfLine                      Move the cursor to the end of the line
Shift+Home       SelectBackwardsLine            Adjust the current selection to include from the cursor to the end of the line
Shift+End        SelectLine                     Adjust the current selection to include from the cursor to the start of the line
Delete           DeleteChar                     Delete the character under the cusor
Tab              MenuComplete                   Complete the input if there is a single completion, otherwise complete the input by selecting from a menu of possible completions.
Ctrl+a           BeginningOfLine                Move the cursor to the beginning of the line
Ctrl+b           BackwardChar                   Move the cursor back one character
Ctrl+c           CopyOrCancelLine               Either copy selected text to the clipboard, or if no text is selected, cancel editing the line with CancelLine.
Ctrl+d           DeleteCharOrExit               Delete the character under the cusor, or if the line is empty, exit the process.
Ctrl+e           EndOfLine                      Move the cursor to the end of the line
Ctrl+f           ForwardChar                    Move the cursor forward one character
Ctrl+g           Abort                          Abort the current operation, e.g. incremental history search
Ctrl+h           BackwardDeleteChar             Delete the charcter before the cursor
Ctrl+l           ClearScreen                    Clear the screen and redraw the current line at the top of the screen
Ctrl+k           KillLine                       Move the text from the cursor to the end of the input to the kill ring
Ctrl+m           ValidateAndAcceptLine          Accept the input or move to the next line if input is missing a closing token....
Ctrl+n           NextHistory                    Replace the input with the next item in the history
Ctrl+o           AcceptAndGetNext               Accept the current line and recall the next line from history after the current line finishes executing
Ctrl+p           PreviousHistory                Replace the input with the previous item in the history
Ctrl+r           Fzf Reverse History Select     Run fzf to search through PSReadline history
Ctrl+s           ForwardSearchHistory           Search history forward interactively
Ctrl+u           BackwardKillLine               Move the text from the cursor to the beginning of the line to the kill ring
Ctrl+w           UnixWordRubout                 Move the text from the cursor to the start of the current or previous whitespace delimited word to the kill ring
Ctrl+y           Yank                           Copy the text from the current kill ring position to the input
Ctrl+@           SetMark                        Mark the location of the cursor
Ctrl+_           Undo                           Undo a previous edit
Ctrl+]           CharacterSearch                Read a character and move the cursor to the next occurence of that character
Ctrl+Alt+]       CharacterSearchBackward        Read a character and move the cursor to the previous occurence of that character
Alt+0            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+1            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+2            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+3            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+4            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+5            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+6            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+7            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+8            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+9            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+-            DigitArgument                  Start or accumulate a numeric argument to other functions
Alt+b            BackwardWord                   Move the cursor to the beginning of the current or previous word
Alt+B            SelectBackwardWord             Adjust the current selection to include the previous word
Alt+d            KillWord                       Move the text from the cursor to the end of the current or next word to the kill ring
Alt+f            ForwardWord                    Move the cursor forward to the end of the current word, or if between words, to the end of the next word.
Alt+F            SelectForwardWord              Adjust the current selection to include the next word using ForwardWord
Alt+r            RevertLine                     Equivalent to undo all edits (clears the line except lines imported from history)
Alt+y            YankPop                        Replace the previously yanked text with the text from the next kill ring position
Alt+Backspace    BackwardKillWord               Move the text from the start of the current or previous word to the cursor to the kill ring
Alt+=            PossibleCompletions            Display the possible completions without changing the input
Ctrl+Spacebar    Complete                       Complete the input if there is a single completion, otherwise complete the input with common prefix for all completions.  Show possible completions if pressed a ...
Ctrl+Alt+?       ShowKeyBindings                Show all key bindings
Alt+?            WhatIsKey                      Show the key binding for the next chord entered
Alt+Spacebar     SetMark                        Mark the location of the cursor
Alt+.            YankLastArg                    Copy the text of the last argument to the input
Alt+_            YankLastArg                    Copy the text of the last argument to the input
Ctrl+Alt+y       YankNthArg                     Copy the text of the first argument to the input
PageUp           ScrollDisplayUp                Scroll the display up one screen
Ctrl+PageUp      ScrollDisplayUpLine            Scroll the display up one line
PageDown         ScrollDisplayDown              Scroll the display down one screen
Ctrl+PageDown    ScrollDisplayDownLine          Scroll the display down one line
Ctrl+Home        ScrollDisplayTop               Scroll the display to the top
Ctrl+End         ScrollDisplayToCursor          Scroll the display to the cursor
Ctrl+t           Fzf Provider Select            Run fzf for current provider based on current token
Alt+c            Fzf Set Location               Run fzf to select directory to set current location
Alt+a            Fzf Reverse History Arg Select Run fzf to search through command line arguments in PSReadline history
Escape,b         BackwardWord                   Move the cursor to the beginning of the current or previous word
Escape,d         KillWord                       Move the text from the cursor to the end of the current or next word to the kill ring
Escape,f         ForwardWord                    Move the cursor forward to the end of the current word, or if between words, to the end of the next word.
Escape,r         RevertLine                     Equivalent to undo all edits (clears the line except lines imported from history)
Escape,y         YankPop                        Replace the previously yanked text with the text from the next kill ring position
Escape,Ctrl+y    YankNthArg                     Copy the text of the first argument to the input
Escape,Backspace BackwardKillWord               Move the text from the start of the current or previous word to the cursor to the kill ring
Escape,.         YankLastArg                    Copy the text of the last argument to the input
Escape,_         YankLastArg                    Copy the text of the last argument to the input
Ctrl+x,Backspace BackwardKillLine               Move the text from the cursor to the beginning of the line to the kill ring
Ctrl+x,Ctrl+u    Undo                           Undo a previous edit
Ctrl+x,Ctrl+x    ExchangePointAndMark           Mark the location of the cursor and move the cursor to the position of the previous mark
Unbound          CaptureScreen                  Allows you to select multiple lines from the console using Shift+UpArrow/DownArrow and copy the selected lines to clipboard by pressing Enter.
Unbound          Redo                           Redo an undo
Unbound          UndoAll                        Undoes all commands for this line.
Unbound          ViEditVisually                 Invokes the console compatible editor specified by $env:VISUAL or $env:$EDITOR on the current command line.
Unbound          PasteAfter                     Write the contents of the local clipboard after the cursor.
Unbound          PasteBefore                    Write the contents of the local clipboard before the cursor.
Unbound          ViYankLine                     Place all characters in the current line into the local clipboard.
Unbound          ViYankRight                    Place the character at the cursor into the local clipboard.
Unbound          ViYankLeft                     Place the character to the left of the cursor into the local clipboard.
Unbound          ViYankToEndOfLine              Place all characters at and after the cursor into the local clipboard.
Unbound          ViYankPreviousWord             Place all characters from before the cursor to the beginning of the previous word, as delimted by white space and common delimiters, into the local clipboard.
Unbound          ViYankNextWord                 Place all characters from the cursor to the end of the word, as delimited by white space and common delimiters, into the local clipboard.
Unbound          ViYankEndOfWord                Place the characters from the cursor to the end of the next word, as delimited by white space and common delimiters, into the local clipboard.
Unbound          ViYankEndOfGlob                Place the characters from the cursor to the end of the next white space delimited word into the local clipboard.
Unbound          ViYankBeginningOfLine          Place the characters before the cursor into the local clipboard.
Unbound          ViYankToFirstChar              Place all characters before the cursor and to the 1st non-white space character into the local clipboard.
Unbound          ViYankPercent                  Place all characters between the matching brace and the cursor into the local clipboard.
Unbound          ViYankPreviousGlob             Place all characters from before the cursor to the beginning of the previous word, as delimited by white space, into the local clipboard.
Unbound          ViYankNextGlob                 Place all characters from the cursor to the end of the word, as delimited by white space, into the local clipboard.
Unbound          ViNextWord                     Move the cursor to the beginning of the next word, as delimited by white space and common delimiters.
Unbound          ViBackwardWord                 Delete backward to the beginning of the previous word, as delimited by white space and common delimiters, and enter insert mode.
Unbound          ViBackwardGlob                 Move the cursor to the beginning of the previous word, as delimited by white space.
Unbound          MoveToEndOfLine                Move to the end of the line.
Unbound          NextWordEnd                    Moves the cursor forward to the end of the next word.
Unbound          GotoColumn                     Moves the cursor to the perscribed column.
Unbound          GotoFirstNonBlankOfLine        Positions the cursor at the first non-blank character.
Unbound          ViGotoBrace                    Move the cursor to the matching brace.
Unbound          InvokePrompt                   Erases the current prompt and calls the prompt function to redisplay the prompt
Unbound          RepeatLastCharSearch           Repeat the last recorded character search.
Unbound          RepeatLastCharSearchBackwards  Repeat the last recorded character search in the opposite direction.
Unbound          SearchChar                     Move to the next occurance of the specified character.
Unbound          SearchCharBackward             Move to the previous occurance of the specified character.
Unbound          SearchCharWithBackoff          Move to he next occurance of the specified character and then back one character.
Unbound          SearchCharBackwardWithBackoff  Move to the previous occurance of the specified character and then forward one character.
Unbound          ViExit                         Exit the shell.
Unbound          DeleteToEnd                    Deletes from the cursor to the end of the line.
Unbound          DeleteWord                     Deletes the current word.
Unbound          ViDeleteGlob                   Delete the current word, as delimited by white space.
Unbound          DeleteEndOfWord                Delete to the end of the current word, as delimited by white space and common delimiters.
Unbound          ViDeleteEndOfGlob              Delete to the end of this word, as delimited by white space.
Unbound          ViCommandMode                  Switch to VI's command mode.
Unbound          ViInsertMode                   Switches to insert mode.
Unbound          ViInsertAtBegining             Moves the cursor to the beginning of the line and switches to insert mode.
Unbound          ViInsertAtEnd                  Moves the cursor to the end of the line and switches to insert mode.
Unbound          ViInsertWithAppend             Switch to insert mode, appending at the current line position.
Unbound          ViInsertWithDelete             Deletes the current character and switches to insert mode.
Unbound          ViAcceptLine                   Accept the line and switch to Vi's insert mode.
Unbound          PrependAndAccept               Inserts the entered character at the beginning and accepts the line.
Unbound          InvertCase                     Inverts the case of the current character and advances the cursor.
Unbound          SwapCharacters                 Swap the current character with the character before it.
Unbound          DeleteLineToFirstChar          Deletes all of the line except for leading whitespace.
Unbound          DeleteLine                     Deletes the current line.
Unbound          BackwardDeleteWord             Delete the previous word in the line.
Unbound          ViBackwardDeleteGlob           Delete backward to the beginning of the previous word, as delimited by white space.
Unbound          ViDeleteBrace                  Deletes all characters between the cursor position and the matching brace.
Unbound          ViSearchHistoryBackward        Starts a new seach backward in the history.
Unbound          SearchForward                  Prompts for a search string and initiates a search upon AcceptLine.
Unbound          RepeatSearch                   Repeat the last search.
Unbound          RepeatSearchBackward           Repeat the last search, but in the opposite direction.
Unbound          RepeatLastCommand              Repeats the last modification command.
Unbound          ViDigitArgumentInChord         Handles the processing of a number argument after the first key of a chord.
Unbound          ViAcceptLineOrExit             If the line is empty, exit, otherwise accept the line as input.
Unbound          ViInsertLine                   Inserts a new multi-line edit mode line in front of the current line.
Unbound          ViAppendLine                   Appends a new multi-line edit mode line to the current line.
Unbound          ViJoinLines                    Joins the current multi-line edit mode line with the next.
Unbound          CancelLine                     Abort editing the current line and re-evaluate the prompt
Unbound          ForwardDeleteLine              Delete text from the cursor to the end of the line
Unbound          BackwardDeleteLine             Delete text from the cursor to the start of the line
Unbound          InsertLineAbove                Inserts a new empty line above the current line without attempting to execute the input
Unbound          InsertLineBelow                Inserts a new empty line below the current line without attempting to execute the input
Unbound          TabCompleteNext                Complete the input using the next completion
Unbound          TabCompletePrevious            Complete the input using the previous completion
Unbound          ViTabCompleteNext              Invokes TabCompleteNext after doing some vi-specific clean up.
Unbound          ViTabCompletePrevious          Invokes TabCompletePrevious after doing some vi-specific clean up.
Unbound          ClearHistory                   Remove all items from the command line history (not PowerShell history)
Unbound          HistorySearchBackward          Search for the previous item in the history that starts with the current input - like PreviousHistory if the input is empty
Unbound          HistorySearchForward           Search for the next item in the history that starts with the current input - like NextHistory if the input is empty
Unbound          ReverseSearchHistory           Search history backwards interactively
Unbound          ShellKillWord                  Move the text from the cursor to the end of the current or next token to the kill ring
Unbound          ShellBackwardKillWord          Move the text from the cursor to the start of the current or previous token to the kill ring
Unbound          KillRegion                     Kill the text between the cursor and the mark
Unbound          SelectNextWord                 Adjust the current selection to include the next word
Unbound          SelectShellForwardWord         Adjust the current selection to include the next word using ShellForwardWord
Unbound          SelectShellNextWord            Adjust the current selection to include the next word using ShellNextWord
Unbound          SelectShellBackwardWord        Adjust the current selection to include the previous word using ShellBackwardWord
Unbound          SelectAll                      Select the entire line. Moves the cursor to the end of the line
Unbound          Paste                          Paste text from the system clipboard
Unbound          Copy                           Copy selected region to the system clipboard.  If no region is selected, copy the whole line
Unbound          Cut                            Delete selected region placing deleted text in the system clipboard
Unbound          PreviousLine                   Move the cursor to the previous line if the input has multiple lines.
Unbound          NextLine                       Move the cursor to the next line if the input has multiple lines.
Unbound          NextWord                       Move the cursor forward to the start of the next word
Unbound          ShellNextWord                  Move the cursor to the end of the current token
Unbound          ShellForwardWord               Move the cursor to the beginning of the next token or end of line
Unbound          ShellBackwardWord              Move the cursor to the beginning of the current or previous token or start of the line
Unbound          GotoBrace                      Go to matching brace
kelleyma49 commented 6 years ago

Try https://www.powershellgallery.com/packages/PSFzf/1.1.17. I made a fix for PsReadline 2.0 and it might be a similar issue to what you're seeing.

lzybkr commented 5 years ago

PSReadLine 2.0 is case sensitive, so the defaults like:

    [parameter(Position=0,Mandatory=$false)][string]$PSReadlineChordProvider = 'Ctrl+T',
    [parameter(Position=1,Mandatory=$false)][string]$PSReadlineChordReverseHistory = 'Ctrl+R',
    [parameter(Position=1,Mandatory=$false)][string]$PSReadlineChordSetLocation = 'Alt+C',
    [parameter(Position=1,Mandatory=$false)][string]$PSReadlineChordReverseHistoryArgs = 'Alt+A')

should change to

    [parameter(Position=0,Mandatory=$false)][string]$PSReadlineChordProvider = 'Ctrl+t',
    [parameter(Position=1,Mandatory=$false)][string]$PSReadlineChordReverseHistory = 'Ctrl+r',
    [parameter(Position=1,Mandatory=$false)][string]$PSReadlineChordSetLocation = 'Alt+c',
    [parameter(Position=1,Mandatory=$false)][string]$PSReadlineChordReverseHistoryArgs = 'Alt+a')

and SetPsReadlineShortcut will need to be smarter in how it compares the strings.

kelleyma49 commented 5 years ago

@lzybkr: SetPsReadlineShortcut forces the compared parameters to lower case - shouldn't that be smart enough?

lzybkr commented 5 years ago

@kelleyma49 - Maybe sufficient for most people, but you can bind Ctrl+r and Ctrl+R differently, the latter meaning Ctrl+Shift+r.

So say someone rebinds Ctrl+r to Ctrl+R, you'd incorrectly determine Ctrl+r is still bound.

kelleyma49 commented 5 years ago

The latest version (https://www.powershellgallery.com/packages/PSFzf/1.1.22) is now case sensitive. Thanks for the help!

kelleyma49 commented 4 years ago

Closing this issue as I haven't heard back from the reporter.