Vi Mode: Allow setting "Cursor" and "Prompt" ViModeIndicator at the same time

Open
#5,006 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, powershell
Domain
cli

Research direction

No file or test is named. Start by tracing how Set-PSReadLineOption handles ViModeIndicator and how ViModeChangeHandler affects the rendered prompt; compare the existing Cursor and Prompt behaviors. Done means both indicators can be enabled together and update correctly when switching Vi modes.

Written by the indexing model from the issue text.

Description

Issue-Enhancement Needs-Triage :mag:
Prerequisites
  • Write a descriptive title.
Description of the new feature/enhancement

Currently you can do both:

Set-PSReadLineOption -ViModeIndicator Cursor

and,

Set-PSReadLineOption -ViModeIndicator Prompt

But you can't set both at the same time.

Note that this is possible with readline, for example with:

set editing-mode vi

# vi INSERT prompt
# - "\e[6 q" is line caret
# - "\e[30;44m" is black on blue
# - "\e[0m" is reset
# = "\1" and "\2" are used to escape the non-printing characters
set vi-ins-mode-string "\1\e[6 q\e[30;44m\2 INS \1\e[0m\2 "

# vi NORMAL prompt
# - "\e[2 q" is block caret
# - "\e[30;47m" is black on white
# - "\e[0m" is reset
# = "\1" and "\2" are used to escape the non-printing characters
set vi-cmd-mode-string "\1\e[2 q\e[30;47m\2 NOR \1\e[0m\2 "

I understand that you can run a script block on -ViModeChangeHandler, but it's not trivial how to programatically change the already rendered prompt when this fires.

Proposed technical implementation details (optional)

No response

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.