79 Commits
Author SHA1 Message Date
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 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
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 f1b2043481 Fix the menu completion to better handle the backspace key (#3574) 2023-02-27 11:01:48 -08:00
spaette 486388c59f Fix some typos in this repository (#3547) 2023-01-23 14:22:59 -08:00
Dominik Kaszewski 4bfc4e94d9 Make tab completion show results whose ListItemText are different by case only (#3456) 2022-10-24 11:56:09 -07:00
James Truher [MSFT] c8db4f587a Do not filter out duplicate completions on non-Windows systems (#3454) 2022-10-21 15:04:29 -07:00
Dongbo Wang e9d42424bf Fix wrong cursor position in menu completion (#3373) 2022-07-08 15:32:07 -07:00
Dongbo Wang 39761f9fb8 No need to clear lines when it's not a menu completion rendering (#3199) 2022-02-02 10:38:28 -08:00
Dongbo Wang b76883665b Add BasicScrollingConsole to support test cases for scrolling up scenarios (#3081) 2021-12-14 15:14:03 -08:00
Dongbo Wang 81bf8669fd Fix 2 menu completion issues that happen when we need to scroll screen buffer (#2949) 2021-11-04 14:24:05 -07:00
Aditya Patwardhan 6cf129ee35 Add the "Dynamic Help" feature to PSReadLine (#1777)
- Adds a way to view help on alternate screen buffer for full help and uses a Pager from `Microsoft.PowerShell.Pager`.
- Implements dynamic help for parameters by showing it below the current command line like `MenuComplete`.
2021-02-10 17:04:50 -08:00
Dongbo Wang 7fb13ea5c8 Add readonly modifier to some private fields (#1984) 2020-11-24 13:40:30 -08:00
Dongbo Wang 9f786b3397 Fix three issues with the menu completion (#1946)
1. Fix menu completion to work with the predictive list view (fix #1935 -- regression introduced in 2.2.0-beta1)
2. Fix menu completion to clear lines properly when the menu top changes on re-drawing (regression introduced in 2.2.0-beta1)
3. Fix how `RightArrow`, `LeftArrow`, `UpArrow`, and `DownArrow` navigate in the menu view (enhancement)
2020-11-13 11:20:51 -08:00
Dongbo Wang fd1265e385 Add the prediction ListView and also hook up with the CommandPrediction APIs introduced in PS 7.1 (#1909) 2020-11-03 14:17:37 -08:00
Dongbo Wang a6b0e762b6 Use const strings for some often used ANSI control sequences (#1809) 2020-09-14 12:40:25 -07:00
Dongbo Wang 9e6c6b9481 Add basic support for inline predictive suggestion (#1496) 2020-05-09 15:44:04 -07:00
Carl Morris f31538e3e7 Utilize LengthInBufferCells when creating Completions Menu (#1214)
* Use LenthInBufferCells for Completions
* Remove unused ShortenLongCompletions

Use LengthInBufferCells() for determining the display width of menu items
in CreateCompletionMenu() to correct support of CJK characters in
completion items.
2019-12-06 00:45:35 -08:00
Steve Lee 664b168be2 Fix correct way to get substring based on buffercells when encountering CJK chars (#1100) 2019-10-16 11:37:22 -07:00
Dongbo Wang 288e3c09eb Clear the previous menu rendering correctly (#1073) 2019-09-27 22:47:36 -07:00
Carl Morris 76f9c4ce92 Prevent 'ArgumentOutOfRangeException' when showing the tab completion menu (#984)
- Prevent adjustment of `userCompletionText` in `FindUserCompletionTextPosition` when the match contains `{` in CompletionText[1] if the `userCompletionText` is not longer than 1 char
- Preserve the splat sigil at start of completions of type `Variable`.

Adjusting `userCompletionText` blindly led to `ArgumentOutOfRangeException` on incorrectly braced splats on input `@?`.
Loss of the sigil of splats led to the splat sigil always being marked as replaced, and in situations where the PowerShell completion logic returned incorrect completions of splats with braces, led to a `ArgumentOutOfRangeException`.
2019-09-06 15:36:16 -07:00
Carl Morris 3ed06e11dc Add missing single and double curly quotes (#985) 2019-07-31 10:53:12 -07:00
Parker Snell 05f528ddb6 Fix duplicate menu at end of buffer (#937) 2019-06-13 10:39:28 -07:00
Jason Shirk a7af25aa37 Stop dispatching on ConsoleKeyInfo (#831)
There are likely issues introduced by this PR,
but I'm merging for a new Beta so this code gets more testing.

* Introduce PSKeyInfo type alias
* Explicit conversions b/w ConsoleKeyInfo and PSKeyInfo
* Change tests to use actual ConsoleKeyInfo data
* Add fr-FR keyboard layout tests
* Add KeyInfo-ru-RU-windows.json (#839)

All impossible without Shift shortcuts labeled as "Investigate: true"
Alt+Spacebar tracked by windows itself

* Add KeyInfo for Polish (Programmers) layout on Windows and Linux (#870)

On Windows *Alt+Spacebar* is hijacked by Windows
On Linux any *Alt+F1-12* combination was not detected
2019-03-20 16:14:05 -07:00
Steve Lee d7da9d395c Fix cursor position during menu complete (#809)
Fix #805
2018-11-09 22:11:26 -08:00
Steve Lee acdf73a402 Fix rendering issue when menu complete shifts due to length of completion (#802) 2018-11-09 10:34:37 -08:00
Jason Shirk d781e3922e Avoid LanguagePrimitives.TryConvertTo (#784)
LanguagePrimitives.TryConvertTo raises (and catches) exceptions on
failed convertions to an enum type like ConsoleColor.

These exceptions were affecting debugging performance of the menu and we
never want exceptions if it's easy to avoid, which in this case it is.
2018-10-23 12:28:56 -07:00
Jason Shirk dfd5ae16a0 Fix tooltips and menu at bottom of buffer (#783)
A recent PR disabled the display of tooltips, and there were
some problems with the menu display when the command line
was at the bottom of the buffer and scrolling was necessary.

Fix #763 and probably #765
2018-10-22 21:51:06 -07:00
Jianyun fbccefc63c Fix exception w/ small buffer and completion (#704)
If the console buffer is small, we sometimes tried to move the cursor outside the buffer when displaying possible completions or the completion menu.

The fix:

* avoids displaying the tooltip if it doesn't fit in the buffer
* places the cursor without scrolling when simply printing the completions (no menu selection)
2018-08-21 12:40:52 -07:00
Jianyun e5d1426f10 Handle scroll from custom tab completion (#708)
Write-Progress or some other UI might scroll the screen while computing completions and that needs to be detected to properly render after fetching the completions.
2018-08-14 23:43:43 -07:00
srdubya 8e7900b486 Fixed CompleteMenu in vi insert mode (#656)
Fix by exiting insert mode to clear the GroupEdit and then re-entering insert mode.

Fixes #651
2018-03-25 10:14:52 -07:00
Jason Shirk 8bc665daed Add support for pre-Win10
Introduced a very minimal terminal emulator, enough to support the
colors used by default (ConsoleColor).

There could be some more error checking or just somehow ignoring unknown
escapes, but we'll see if this is sufficient for now.

Fix #596
2017-12-02 12:02:51 -08:00
Jason Shirk 4be9473e90 Change selection coloring to not use inverse
Adds Selection as a configuration option for colors.

Fix #597
2017-12-01 13:41:21 -08:00
Jason Shirk 8ba9d8267e Fix rendering boundary conditions
Fix #598
2017-12-01 11:10:21 -08:00
Jason Shirk 48c11ae969 Relax correctness check on completion results
Fix #586
2017-11-16 22:53:30 -08:00
Jason Shirk da44f14d65 Get new completions on 2nd tab if 1st had 1 result
Fix #238
2017-11-12 08:16:27 -08:00
Jason Shirk 275ea75634 Better handling of very long items in menu completion 2017-11-06 22:04:06 -08:00
Jason Shirk b82ec75a25 Fix tooltip rendering artifacts
Fix #315
2017-11-05 11:40:10 -08:00
Jason Shirk 0b7a189536 Filter out apparent duplicates during tab completion
Fix #413
2017-11-04 10:43:34 -07:00
Jason Shirk 8c51c85d8e Handle invalid index/length in completion results
Fix #534
2017-11-02 21:57:25 -07:00
Jason Shirk 63d2dcf6da Portable custom key bindings
Rewrote the custom key binding code to be more portable.

Some runtime checks are necessary because of impossible to reconcile
differences.

Some Win32 P/Invoke calls are still needed due to lack of information in
the ConsoleKeyInfo.

Some keys are currently not available on Linux due to a CLR bug, others
aren't available ever because terminals don't unique character sequences
for a given key press that might differ in just the Shift or Ctrl state.
2017-10-15 22:03:56 -07:00
Jason Shirk fb10c6d9c3 Show tooltips by default in MenuComplete 2017-09-09 15:00:24 -07:00
Jason Shirk bff16f4beb Correct resources namespace 2017-09-04 23:20:37 -07:00
Andrew Schwartzmeyer f0a93e679a Fix directory completion for different file-systems
Use the file-system agnostic `System.IO.Path.DirectorySeparatorChar` for
`GetReplacementTextForDirectory`, instead of hard-coded backslashes.
2017-09-04 22:27:34 -07:00
Jason Shirk 1d009a324e More Windows refactoring
Isolate some odds and ends of Windows specific code so the mainline code
path is not Windows specific.
2017-09-02 16:26:39 -07:00
Jason Shirk 1a623b9327 Replace COORD with Point except in ScreenCapture 2017-09-02 14:43:03 -07:00
Jason Shirk 756d76474c More menu rendering at end of buffer fixes 2017-08-28 15:27:04 -07:00
Jason Shirk 8453d4c2c7 Fix completion at bottom of buffer 2017-08-27 15:39:33 -07:00
Jason Shirk 66d34c63d7 MenuComplete filtering working now 2017-08-14 08:56:22 -07:00