812 Commits
Author SHA1 Message Date
sharpchen 2984546f62 Fix ViFindBrace to search for brace the same as vim when current char is not a brace (#4862) 2026-04-08 11:38:08 -07:00
Snowy e266ca6f67 Fix BackwardKillLine length calculation for multiline input (#5102) 2026-03-11 13:23:22 -07:00
Justin Chung e563a2fc15 Migrate PSReadLine to target .NET 8.0 (#5055) 2026-01-20 11:05:10 -08:00
Dongbo Wang 98d5610f72 Prepare for the v2.4.5 release of PSReadLine 2025-10-22 12:12:04 -07:00
Dongbo Wang b6c3e4810c Fix a null reference exception when showing parameter help (#4971) 2025-10-16 10:25:03 -07:00
Dongbo Wang 4a724547a8 Add the ScreenReaderModeEnabled property to formatting (#4970)
Add the `ScreenReaderModeEnabled` property to formatting so it's displayed in the default formatting for `Get-PSReadLineOption`.
2025-10-14 12:24:07 -07:00
Dongbo Wang b5aac30d26 Prepare for the v2.4.4-beta4 release of PSReadLine 2025-08-28 15:32:25 -07:00
Andy Jordan 1cdbf46c9e Fix IsMutexPresent() to avoid incorrect use of GetLastWin32Error() (#4910) 2025-08-28 14:21:42 -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 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
Dongbo Wang 26c25ae56a Prepare for the v2.4.3-beta3 release of PSReadLine 2025-07-23 10:03:22 -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
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
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 69c6f032cc Prepare for the v2.4.2-beta2 release of PSReadLine 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 9a9b4dfff4 Prepare for the v2.4.1-beta1 release of PSReadLine 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
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 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 61f598d8a7 Update SelectCommandArgument to properly handle POSIX style options for CLI commands (#4016) 2024-05-14 13:34:37 -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 5efe2ef55f Prepare for the v2.4.0-beta0 release of PSReadLine (#3962) 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 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
Dongbo Wang f2207f4259 Stop trying to de-duplicate completion results (#3897) 2023-12-11 10:44:20 -08:00
Friedrich von Never ff4bbd5ee0 Windows keyboard layout handling: get the current layout from the parent terminal process (#3786) 2023-11-03 11:40:25 -07:00
Dongbo Wang fbdf7faf0b Fix a few VI key handlers to close edit group properly (#3845) 2023-10-24 09:46:18 -07:00
Dongbo Wang ac69010fec Handle large history file properly by reading lines in the streaming way (#3810) 2023-10-02 18:33:42 -07:00
Dongbo Wang 3b21582525 Prepare for the v2.3.4 release of PSReadLine (#3819) 2023-10-02 17:33:59 -07:00
Dongbo Wang d045b508f4 Choose the inline prediction color based on the environment (#3808) 2023-09-26 15:51:45 -07:00
Dongbo Wang 97f85b93a5 Prepare for the v2.3.3 release of PSReadLine (#3802) 2023-09-18 16:37:17 -07:00
Dongbo Wang 423cb47324 Prepare for the v2.3.2-beta2 release of PSReadLine (#3783) 2023-08-17 14:10:13 -07:00
Dongbo Wang fbff10ccdd Point to F7History in the comment of the F7 sample (#3782) 2023-08-17 09:59:57 -07:00
Dongbo Wang 4e456f0205 Fix NullReferenceException when processing event subscribers (#3781) 2023-08-17 09:37:47 -07:00
Maxime Labelle d7b9f82ba0 [vi-mode] Supports the text-object command diw (#2059) 2023-08-14 15:56:46 -07:00
Dan Thompson 4d78ce153d Add the TerminateOrphanedConsoleApps option on Windows to kill orphaned console-attached process that may mess up reading from Console input (#3764) 2023-08-09 10:51:26 -07:00
Dan Thompson e5537d814b Work around InvalidOperationException from Console API (#3755) 2023-07-27 11:47:06 -07:00
Dongbo Wang 9e7b1fe524 Prepare for the v2.3.1-beta1 release of PSReadLine (#3672) 2023-05-03 15:19:11 -07:00
Dongbo Wang 6b7c48a279 Fix a bug in tooltip rendering that caused incorrect calculation of the tooltip height (#3671) 2023-05-03 14:24:05 -07:00
Dongbo Wang 0032acbeaf Append reset VT sequence before rendering the ineline prediction (#3669) 2023-05-02 22:20:10 -07:00
Dongbo Wang ae08ca6caf Support tooltip rendering in the prediction list view (#3667) 2023-05-02 16:52:19 -07:00
Dongbo Wang 23882b7719 Add a sample for transforming Unicode code point to Unicode char by Alt+x (#3652) 2023-04-10 11:42:12 -07:00