`KillRegion` function raises an unhandled exception on empty region
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 64/100
Línea de trabajo
Empieza reproduciendo el problema con los bindings documentados de KillRegion y SetMark, y sigue después el stack trace desde KillRegion hasta Kill. Confirma que el caso de una región vacía actualmente provoca una excepción. Se considera terminado cuando repetir KillRegion sobre una región vacía devuelve un ding sin producir una excepción no controlada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
### Environment
PSReadLine: 2.4.5
PowerShell: 7.6.0-preview.5
OS: Microsoft Windows 10.0.26100
BufferWidth: 120
BufferHeight: 9001
Last 200 Keys:
d l i n e o p Tab Tab Spacebar Spacebar Backspace - Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Shift+Tab Spacebar Tab Tab Tab Enter
d f d f Backspace Backspace Backspace Backspace s e t - p s r e a d l i n e k e y h a n d l e r Spacebar c Backspace - c h o r t Tab Backspace d Tab Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace n o t e p a d Spacebar . \ p r o f i l e . p s q Backspace 1 Enter
. Spacebar p r o Tab Enter
t h i s Spacebar i d Spacebar a Spacebar d Backspace Backspace Backspace Backspace Backspace s Spacebar a Spacebar d e b a Backspace u g Spacebar t e s t LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow Ctrl+a LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow Ctrl+b Ctrl+b
### Exception
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. (Parameter 'length')
at System.Text.StringBuilder.ToString(Int32 startIndex, Int32 length)
at Microsoft.PowerShell.PSConsoleReadLine.Kill(Int32 start, Int32 length, Boolean prepend)
at Microsoft.PowerShell.PSConsoleReadLine.KillRegion(Nullable`1 key, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)
Screenshot
Environment data
PS Version: 7.6.0-preview.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: 9001
Steps to reproduce
- Bind both the
KillRegionandSetMarkfunctions to a chord each (this is whatprofile.ps1does in the example above) - Set a mark with `SetMark anywhere on the line, except on the first column
- Move the cursor before the mark
- Kill the region of text between the cursor and the mark with
KillRegion - Try to kill the region again
Expected behavior
Since the region is empty and thus cannot be killed, the function should return a ding.
Actual behavior
An unhandled exception is raised.
- Lenguaje dominante
- C#
- Estrellas
- 4.4k
- Forks
- 341
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PowerShell/PSReadLine
-
Needs-Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PowerShell/PSReadLine#5205 ·
-
Needs-Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PowerShell/PSReadLine#5195 ·
-
Needs-Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PowerShell/PSReadLine#5121 ·
-
Area-CommandHelp Issue-Enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
PowerShell/PSReadLine#3470 · 3 reacciones ·
-
Needs-Triage :mag:
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
PowerShell/PSReadLine#5214 ·
Todos los issues de PowerShell/PSReadLine
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
azurenoops/spin_agent#975 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
SubtitleEdit/subtitleedit#15108 · 1 comentario ·