ANSI escape sequences in custom prompt cause visual artifact ('m' character) during syntax error recoloring

Aberta
#5,196 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
58/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
csharp, powershell
Domínio
cli

Direção de pesquisa

Start by reproducing the issue with the supplied PowerShell prompt function, an opening quote, and the stated PSReadLine environment. Trace the real-time syntax-error prompt recoloring and how ANSI escape sequences affect character offsets. Done means the prompt delimiter recolors without leaving an orphaned “m” or overwriting the “>” character.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Needs-Triage :mag:
Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.
Exception report
N/A
Summary

ANSI escape sequences returned by a custom prompt function cause character offset miscalculations during real-time syntax-error prompt recoloring, leaving an orphaned 'm' character or overwriting the prompt delimiter.

Screenshot
Image Image
Environment data
PS Version: 7.6.5
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.4.5
PSReadLine EditMode: Windows
OS: 10.0.26100.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 30
Steps to reproduce
  1. Start PowerShell with the following prompt function:

    function prompt {
        "`e[1;33mPS `e[1;34m$pwd`e[1;32m$('>' * ($nestedPromptLevel + 1)) `e[0m"
    }
    
  2. Type an opening quotation mark (" or ').

Expected behavior

The prompt delimiter (>) recolors cleanly to indicate an incomplete/syntax error state without visual artifacts.

Actual behavior

An orphaned m (from the trailing \e[0m SGR sequence) is printed at the end of the prompt or overwrites the > character.

Linguagem predominante
C#
Estrelas
4.4k
Forks
341
Métricas de merge de PRs
Nenhum PR com merge em 30d

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de PowerShell/PSReadLine

Todas as issues de PowerShell/PSReadLine

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.