Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Cursor position needs to be adjusted in some uncommon cases when rendering in screen reader mode

Open
#4,912 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
accessibility, cli

Research direction

Start with the screen reader rendering flow described in the issue and review the original discussion in PR #4854. Reproduce the cursor-at-d example by pasting defghi into abcdef, then verify that the terminal displays abcdefghidef rather than abcghidef.

Written by the indexing model from the issue text.

Description

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
Screenshot

N/A

Environment data
PS Version: 7.5.2
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.4.3-beta3
PSReadLine EditMode: Windows
OS: 10.0.26100.1 (WinBuild.160101.0800)
BufferWidth: 150
BufferHeight: 40
Steps to reproduce

In Screen Reader mode, the way rendering works is to first calculate the common prefix between the last rendered string and the current string, and then move cursor (as needed) to the position of commonPrefixLength to erase the rest of the previous rendering and write the diff part from the current string.

There could be a problem when user moves the cursor and then inserts (or select-then-delete) a sequence of characters.

One example:

  • Previous line is abcdef, cursor is at the letter d
  • Press ctrl+v to paste defghi

In this case, the new buffer is abcdefghidef, and commonPrefixLength == previousBuffer.Length, but the cursor is still at the first letter d when code flow reaches here. Then writting out the new diff ghidef will result in abcghidef displayed in terminal.

When execution reaches the screen reader rendering, _current is already changed -- it no longer reflects where the cursor is at. This uncommon scenario is tricky, and it potentially could affect the commonPrefixLength != previousBuffer.Length case.

The original discussion is at https://github.com/PowerShell/PSReadLine/pull/4854#discussion_r2286301586

Expected behavior

Cursor position needs to be adjusted in those cases. For the specific example described above, the result text on terminal should be abcdefghidef.

Actual behavior

For the example described above, the result text on terminal should be abcghidef.

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.