Commit Graph
590 Commits
Author SHA1 Message Date
Dongbo Wang 7d779cfd35 Fix UpArrow when the cursor is at the end of a wrapped line in a multiple-line text (#1028) 2019-09-12 16:42:08 -07:00
Dongbo Wang 9c25008a95 Fix the 'ArgumentOutOfRangeException' caused by top of the text being scrolled up-off the buffer (#979)
- Update `ReallyRender` to avoid writing everything every time when editing the text. Instead, we find the first different logical line, and starting writing from there.
 - Refactor `ReallyRender` by moving some logic to separate methods.
 - Support editing text even if the top of the text has been scrolled up-off the buffer.
 - Disallow cursor to be set to a position that is off the buffer.
 - Fix a bug in `ConvertLineAndColumnToOffset` so that a point can be translated to the offset correctly.
2019-09-12 15:12:15 -07:00
Tyler James Leonhardt 3f6975c1a0 Change the key binding 'Alt+D' to 'Alt+Shift+D' for the windows edit mode (#1037) 2019-09-12 13:37:28 -07:00
Dongbo Wang d6b120a99b Make PageUp/PageDown and CtrlPageUp/CtrlPageDown windows only (#1032)
On Unix platforms, `Console.SetWindowPosition` throw `PlatformNotSupportedException`.
2019-09-11 14:36:05 -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 820f1607d6 Prioritize highlight of command names, prevent bleed from aligned nested tokens (#989) 2019-09-06 13:37:28 -07:00
Carl Morris 4285cce99c Fix the color of operator token in the ArgumentMode (#1003) 2019-09-05 15:12:18 -07:00
Carl Morris 3ed06e11dc Add missing single and double curly quotes (#985) 2019-07-31 10:53:12 -07:00
Dongbo Wang b7b8f7bb1d Update .csproj files to depend on 'netcoreapp 2.1.12' and 'Microsoft.PowerShell.SDK 6.2.2' (#980) 2019-07-30 12:02:41 -07:00
Dongbo Wang fd9af03531 Fix ArgumentOutOfRangeException thrown when changing color of the error prompt (#967) 2019-07-19 21:40:18 -07:00
Steve Lee 527fa6abdc Add API to detect if the screen reader is active (#947) 2019-07-19 13:23:35 -07:00
Dongbo Wang f2f5531560 Avoid rendering dead keys (2nd attempt) (#945) 2019-06-17 13:38:46 -07:00
Parker Snell 05f528ddb6 Fix duplicate menu at end of buffer (#937) 2019-06-13 10:39:28 -07:00
Dongbo Wang 22ceb03a12 Handle the dead key on Windows properly (#933) 2019-06-07 09:50:09 -07:00
Dongbo Wang 7050b12edf 2.0.0-beta4 release preparation (#905)
- Update the `InformationalVersion` tag to `2.0.0-beta4`
- Update the change log
- Update URLs to point to the PowerShell GitHub org.
2019-05-01 18:09:07 -07:00
Dongbo Wang e64aceccdd Make sure to generate the 'OnIdle' event when there are other subscribers (#899) 2019-04-18 16:33:08 -07:00
Dongbo Wang c197e7e9b2 Fix 'Shift+Backspace/Escape' to work the same as 'Backspace/Escape' on Windows (#898) 2019-04-18 09:54:41 -07:00
Maxime Labelle 546dc199f8 Fix incorrect links to documentation files. (#894) 2019-04-17 21:46:35 -07:00
Dongbo Wang ef2f65f4ae Fix the regression to make long lines work properly at the end of screen buffer (#895) 2019-04-16 18:47:50 -07:00
Dongbo Wang fdd38b9761 Rename 'TestPSReadLine' to 'MockPSConsole' (#890) 2019-04-12 16:08:06 -07:00
Tyler James Leonhardt e48613665a added xtermjs keybindings (#878) 2019-04-07 11:18:04 -07:00
Maxime Labelle 929f4f9bf4 Supports '_' and '$' to move to the beginning and end of the logical line in Vi mode. (#812)
Fix #795
2019-03-21 15:27:53 -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
Jason Shirk a878b3686c Fix Raster font check (#825)
The original fix in #771 resulted in essentially never setting the UTF8
output encoding because it only tested the fixed width bit on the font
family, but every console font is fixed width.

The proper fix appears to be testing that all 4 lower bits in FontFamily
are not set.

Fix #823
2018-12-03 11:05:07 -08:00
Jason Shirk 3d246d935f Remove Keys.ShouldInsert (#822)
The method Keys.ShouldInsert was a misguided attempt to avoid inserting
keys where there is no binding but the key really doesn't make sense as
input.

Unfortunately it is just causing more pain and probably wasn't
addressing a serious problem, so I'm removing it.

Fix #798
2018-12-03 11:04:40 -08:00
Dongbo Wang ade48310d0 Remove dependency on the Utility module (#814) 2018-11-26 10:46:24 -08:00
Steve Lee d7da9d395c Fix cursor position during menu complete (#809)
Fix #805
2018-11-09 22:11:26 -08:00
Maxime Labelle 803008a092 ViAppendLine crashes with cursor at end of input on empty line (#797)
Fix #796
2018-11-09 10:57:57 -08:00
Dan Thompson 2101854bf6 Get-PSReadLineOption should show AnsiEscapeTimeout (#800) 2018-11-09 10:40:51 -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 52983255fc Disable stdin/stdout check for CI on non-Windows (#804)
Also - only run tests once in AppVeyor.
2018-11-09 10:06:13 -08:00
Jason Shirk 194c8dba42 Add internal clipboard (#803)
For Mac/Linux, if the commands to use the system clipboard are missing,
we can at least simulate a clipboard internally, just for PSReadLine.

This is allows the clipboard tests to run in the Azure DevOps CI for
Linux.
2018-11-09 09:43:21 -08:00
Maxime Labelle 274381a89e Support vi mode 'G' and 'gg' movements in multi-line buffers (#793)
Fix #789
2018-11-05 12:34:17 -08:00
Jason Shirk bc40ae6f6b Remove uses of CSI # S / ScrollConsoleScreenBuffer (#790)
This fixes some weird issues in WSL and some Linux terminals.

This also works around a Windows 1809 Console bug for the Ctrl+l binding
to clear the screen by using the same escape sequence that bash uses.

Fix #724
2018-11-04 19:12:52 -08:00
Jason Shirk 14ddf0c032 Check error condition in VkKeyScan (#788)
VkKeyScan returns -1 when there is no key mapping for the given
character.

This possiblity was not considered, resulting in an attempt to add
duplicate (but invalid) keys to the CtrlKeyToKeyMap.

Fixes #787
2018-10-28 20:32:24 -07:00
Jason Shirk 16ab1c6afe Only restore valid console colors (for non-Windows) 2018-10-23 12:49:58 -07:00
Jason Shirk 170fbde530 Save/restore initial fg/bg colors (#785)
Writing CSI 0 m resets the colors to the terminals initial colors, not
what the settings are before PSReadLine starts.

Fix #774
2018-10-23 12:29:54 -07: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
Steve Lee 1d8dd4a21c Fix unintentional font change in Windows console (#771)
conhost (Windows only) could change the font unexpectedly if the current font is a raster font and the code page changes to UTF8.

PSReadLine was switching to UTF8 output encoding to address some display issues with CJK,

This change skips the UTF8 output encoding change if it would cause conhost to change the font.
2018-10-10 09:16:07 -07:00
Jason Shirk 57bc3a65fd Report environment in execption report 2018-10-02 22:02:02 -07:00
Steve Lee f92ecfe085 Enable building with dotnet cli for non-Windows (#692)
* Enable building with PSCore6
* Fix tests to work on non-Windows
* Added clipboard capability for non-Windows
2018-09-29 22:17:03 -07:00
Jason Shirk e1c5b51486 Fix initialization for non-US keyboards (#768)
Closes #614.
2018-09-28 09:28:27 -07:00
Parker Snell c6dabcf9f9 Add script block vi mode indicator option 2018-09-12 10:23:59 -07:00
Parker Snell 0e96fd2e0c add Shift-Tab Windows ANSI escape 2018-09-12 10:23:59 -07:00
Jason Shirk c4929942cd Beta 3 2018-08-29 13:14:19 -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
Jason Shirk 0674f91a8e Correct the change log
Fix #718
2018-06-25 22:43:03 -07:00
Sergei Vorobev c940cd124e Include the code fences to OopsAnErrorMessage2 for easy github copy-paste (#710) 2018-06-25 21:51:16 -07:00