Please make backward and forward search slash agnostic, or add an option to do so

Open
#2,696 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
cli

Research direction

Start by tracing the Ctrl+R history-search entry point described in the issue and how the query is compared with stored commands. Reproduce the Windows slash-mismatch scenario, then define whether matching is always slash-agnostic or controlled by an option. Done means a forward-slash query finds the recorded backslash command, with coverage for the selected behavior.

Written by the indexing model from the issue text.

Description

Issue-Enhancement

Description of the new feature/enhancement

As a PSReadline user,
When I press Ctrl+R and start typing a command that includes a path,
I would like to be able to type either slash (backward or forward) and have it match whatever slash is in PSReadline history.

Justification

I have become accustomed to typing in forward slashes in PowerShell, because they work regardless of the environment I am in. I also use tab completion. Tab completion in PowerShell on Windows changes forward slashes to backward slashes. This is fine, but it makes it difficult to work with command history because later on, when I want to repeat a command with the same path, and I press Ctrl+R and then start typing the path with forward slashes, on Windows it doesn't match what I ran before because what I ran before was converted to using backward slashes. If instead PSReadline had an option (or worked by default) to match forward slashes with backward slashes in command history, this wouldn't be a problem, and I could access historic commands on Windows using the forward slash that I naturally type with.

Steps to reproduce the issue that this would resolve

  1. Run a command that includes a path with slashes. For example: & ./MySolutionFolder/MySolution.sln. Use tab completion as you type that command in on Windows so that the command that actually gets run is & .\MySolutionFolder\MySolution.sln.
  2. Press Ctrl+R.
  3. Type in & ./MySolut and notice how it does not present your historic & .\MySolutionFolder\MySolution.sln command from history. Although this command was typed in using forward slashes, what was run and recorded was a command using backward slashes on Windows, so it doesn't match.
Dominant language
C#
Stars
4.4k
Forks
341
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PowerShell/PSReadLine

All issues in PowerShell/PSReadLine

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.