Commit Graph
1073 Commits
Author SHA1 Message Date
Dongbo Wang 4e2cb6030e Add screen reader support to PSReadLine (#4854) 2025-08-28 11:22:05 -07:00
Andy Jordan 06e3b4bcb6 Add fixture to enable existing tests for screen reader mode
Tests that depend on supported features such as menu completions, list
view, inline predictions, continuation prompt, and colors are skipped.

The "helper" module for running tests from the command-line and in
AppVeyor is minimally updated to not skip the new fixture.

A `BlankRestOfBuffer()` function implements the semantics of the `0J`
control sequence in the mock console.
2025-08-27 17:46:47 -07:00
Andy Jordan 7b6f602405 Add accessible screen reader mode
This adds the `EnableScreenReaderMode` command-line switch which
defaults to true if an active screen reader is detected.

In screen reader mode, the existing `ForceRender()` function is replaced
by `RenderForScreenReader()` which uses a differential rendering
approach to minimize extraneous output to the terminal, allowing the use
of screen readers better than ever before.

The differential rendering relies on calculating the common prefix of
the `buffer` and `previousRender` strings. Nearly all necessary changes
are consolidated in the new rendering function.

Features known not to be supported:

* Colors: as this necessitates redrawing to insert color sequences after
  the input is received and the AST parsed.
* Inline predictions: as this by definition changes the suffix and thus
  requires endless redrawing.
* List view predictions: since the render implementation never calls
  into the prediction engine, this is not available either.
* Menu completion: well, it "works" since it's not disabled and does its
  own rendering, but no effort has been made to improve `DrawMenu()`, so
  it's not accessible (and I'm not sure it could be given our current
  constraints).

Features known to be partially supported:

* Text selection: mark and select commands work as intended, but provide
  no visual indication.
* Multiple lines: as in newlines work fine, but there is no continuation
  prompt.
* Visually wrapped lines: editing above a wrapped line redraws all
  subsequent lines and hence is noisy.
* Status prompt based commands: what-is-key, digit-argument, and most
  notably, forward/backward incremental history search all render a
  "status prompt" on the line below the user's input buffer. This _is_
  supported; however, it can be noisy since it necessarily has to render
  the whole buffer when the input buffer changes, including the status
  prompt (and search text). But what it's reading is almost always going
  to be relevant.

Everything else should generally work, even Vi mode, and the tests pass.
That said, this isn't perfect, and moreover the approach specifically
doesn't attempt to enable things from the ground up. There may be
features that are available but turn out not to be accessible (like
`MenuComplete`) and I believe they should be left as-is.

Specifically tested with NVDA on Windows and VoiceOver on macOS within
VS Code's integrated terminal, with shell integration loaded, and Code's
screen reader optimizations enabled.
2025-08-27 17:46:47 -07:00
Andy Jordan 7a5826bac3 Fix hard-coded continuation prompt in tests
These tests were using a hard-coded continuation prompt (and its length)
which blocks tests for the upcoming screen reader mode.

This is also simply a reasonable refactor, thanks Claude (for trying).
2025-08-27 16:52:03 -07:00
Andy Jordan 5e72587cca Improve IsScreenReaderActive()
This supports checking for the built-in screen readers VoiceOver on
macOS and Windows Narrator, as well as the popular open-source option,
NVDA.

The VoiceOver check spawns a quick `defaults` process since in .NET
using the macOS events is difficult, but this is quick and easy.

The Windows Narrator check inspects a system mutex. Notably though this
screen reader handles re-rendering better than others.

The check for NVDA et. al. inspects the system parameter information.
While this approach is known to be buggy, the preferable and commonly
used algorithm (as implemented by Electron) which checks for loaded
libraries was tested and found to be unsupported for a non-windowed
program like PowerShell.

It's unknown if the SPI check will detect JAWS, Window-Eyes, or
ZoomText, so a command-line option for the upcoming screen reader mode
should also be provided.

Linux is not yet supported.
2025-08-27 16:51:48 -07:00
Andy Jordan 49071163a1 Fix ellipsis / continuation character encoding issue in tests
This character was always meant to be an ellipsis. I'm unsure exactly
why Visual Studio interprets it so, but VS Code and GitHub do not. This
commit replaces it with the actual Unicode character which ensures the
tests continue to pass when these files are edited and saved in VS Code.
2025-08-27 16:46:15 -07:00
Dongbo Wang ceaad10f3d Merge the v2.4.3-beta3 release branch back to master 2025-07-23 12:07:53 -07:00
Dongbo Wang 26c25ae56a Prepare for the v2.4.3-beta3 release of PSReadLine v2.4.3-beta3 2025-07-23 10:03:22 -07:00
Andy Jordan 782afd977d Remove configuration selection from default build task (#4855) 2025-07-21 09:27:59 -07:00
Dongbo Wang a7d988fb5e Allow accepting the current input automatically from within an OnIdle event handler (#4830) 2025-07-17 11:08:42 -07:00
Andy Jordan 5863e8d81c Add a VS Code launch target for debugging 2025-07-11 11:26:13 -07:00
Andy Jordan a1c82791e4 Add build script support to VS Code tasks 2025-07-11 11:26:13 -07:00
jftkcs addd1a6f1f Add bound check for the cursor top value to InvokePrompt (#4791) 2025-07-09 16:32:13 -07:00
Mahir Cadirci 9b6a47d798 Fix typo in SamplePSReadLineProfile.ps1 (#4725) 2025-05-13 12:10:26 -07:00
Dongbo Wang 7b840fdef0 Fix line ending and cache some reflection operations (#4709) 2025-04-17 12:06:56 -07:00
Maxime Labelle b1f8c8979f Improve test reliability by making sure the PSReadLine one-time initialization is done (#4686) 2025-04-17 11:08:30 -07:00
Dongbo Wang e317d844dd Merge the v2.4.2-beta2 release branch to the master branch 2025-04-16 13:19:10 -07:00
Dongbo Wang 69c6f032cc Prepare for the v2.4.2-beta2 release of PSReadLine v2.4.2-beta2 2025-04-16 11:01:11 -07:00
Dongbo Wang b926959840 Add a private field to indicate if PSReadLine is initialized and ready (#4706) 2025-04-16 10:09:46 -07:00
Dongbo Wang 4a2bf98ac4 Use CFS for installing module and deploy box for module publish (#4700)
1. Add pipeline parameter to control whether to release
2. Handle bootstrapping explicitly
3. Use 'server' instead of 'agentless' for manual job
2025-04-14 16:57:12 -07:00
Dongbo Wang e06e5bc7bc Merge the v2.4.1-beta1 release branch back to master 2025-02-28 15:39:52 -08:00
Dongbo Wang 9a9b4dfff4 Prepare for the v2.4.1-beta1 release of PSReadLine v2.4.1-beta1 2025-02-28 13:36:15 -08:00
Dongbo Wang 49604e89ec Update PSReadLine build to target netstandard2.0 (#4584)
By retargeting PSReadLine to `netstandard2.0`, we can simplify the build a lot and produce the same assembly no matter building on Windows or non-Windows.

- Update PSReadLine build to target `netstandard2.0`, including the CI and release pipeline YAML files.
- Update the test to target `net472` and `net6.0`, so that we can run tests with both .NET Framework and .NET
- Rename `Microsoft.PowerShell.PSReadLine2.dll` to `Microsoft.PowerShell.PSReadLine.dll`
- Update and clean up the `README.md` with the up-to-date information
2025-02-28 11:09:08 -08:00
Dongbo Wang a272810fc4 Avoid querying for cursor position when it's not necessary (#4448) 2025-02-04 14:02:19 -08:00
Fabrice Sanga 455eebeeb8 Update documentation about the building of PSReadLine (#4286) 2025-02-03 17:40:17 -08:00
Dongbo Wang 1ea00df7d2 Handle buffer changes made by an event handler (#4442) 2025-02-03 17:36:27 -08:00
Sean Wheeler 9e946af050 Update HelpInfoUri for 7.5 (#4284) 2024-11-22 09:59:59 -08:00
Dongbo Wang e87a265ef8 Update the release pipeline to remove AzFeed from display name (#4204) 2024-10-03 16:30:01 -07:00
Dongbo Wang 11974f8fa4 Merge the v2.3.6 changelog to GitHub (#4202) 2024-10-03 14:09:31 -07:00
Dongbo Wang a1130b5190 Release SBOM (#4201) 2024-10-02 16:08:06 -07:00
Dongbo Wang e9122d38e9 Make sure the CodeQL result from release pipeline gets uploaded (#4082) 2024-07-29 12:20:13 -07:00
Dongbo Wang eff1452a64 Add 'ob_restore_phase' for every task before the signing task to work around the signing issue (#4046) 2024-06-20 16:56:52 -07:00
Dongbo Wang 6327a1a963 Change the NuGet feed to use the governed PowerShell feed (#4044) 2024-06-19 15:00:04 -07:00
Andy Jordan cb6037f41e Update "Code of Conduct" and "Security Policy" (#4037) 2024-06-12 16:17:17 -07:00
Dongbo Wang 61f598d8a7 Update SelectCommandArgument to properly handle POSIX style options for CLI commands (#4016) 2024-05-14 13:34:37 -07:00
Dongbo Wang 4023f0607d Disable SBOM, signing, and codeQL for the publish job (#3986) 2024-04-03 15:32:55 -07:00
Dongbo Wang fdac7def40 Update triage messages to use the latest stable version (#3985) 2024-04-03 10:20:45 -07:00
Dongbo Wang 789bb848f7 Fix the release stage and update the changelog for v2.3.5 servicing release (#3984) 2024-04-03 09:59:59 -07:00
Dongbo Wang d7fe398d5b Add the release stage to the pipeline and exclude test folders from Component Governance (#3982) 2024-04-02 11:24:22 -07:00
Dongbo Wang b162aef91e Change back to 'external_distribution' for nupkg signing (#3977) 2024-03-21 16:08:57 -07:00
Dongbo Wang 5e63f147f5 Migrate PSReadLine release build pipeline to OneBranch (#3975) 2024-03-20 16:06:19 -07:00
Dongbo Wang 5efe2ef55f Prepare for the v2.4.0-beta0 release of PSReadLine (#3962) v2.4.0-beta0 2024-03-01 16:24:34 -08:00
Dongbo Wang ce2302c526 Fix the null-reference exception when running Debug-Job on a thread job (#3957) 2024-02-26 13:29:54 -08:00
Dongbo Wang d332e21415 Add needed permission to the workflow (attempt 2) (#3946) 2024-02-12 11:58:26 -08:00
Dongbo Wang 5c69ba0951 Add needed permission to the workflow (#3945) 2024-02-12 11:55:02 -08:00
Dongbo Wang d6cc8ad74c Update actions/checkout to v4 (#3944) 2024-02-12 11:03:29 -08:00
Dongbo Wang 826f73e508 Fix copying text to system clipboard on Linux using xclip (#3937) 2024-02-01 16:14:22 -08:00
Dongbo Wang 5fa2a21abd Use the correct directory separator for tab completion based on the platform we are working with (#3935) 2024-01-31 21:46:13 -08:00
Dongbo Wang d4ef931235 Update the minimal PS version required to be 5.1 (#3936) 2024-01-31 13:41:59 -08:00
Dongbo Wang e57f7d691d Little code style cleanup for the GetCompletions() method (#3898) 2023-12-11 10:55:13 -08:00