752 Commits
Author SHA1 Message Date
Steve Lee 09300c0990 Return error if color property or value is invalid with Set-PSReadLineOption -Colors (#1124) 2019-11-07 22:57:25 -08:00
Tyler James Leonhardt 65be868acd Fix for a nullref thrown when PSES calls ForcePSEventHandling (#1097) 2019-10-30 14:21:39 -07:00
Maxime Labelle 197a3fdc83 In VI mode, moving left or right should stick cursor on logical line (#1120) 2019-10-29 16:56:59 -07:00
Carl Morris 175d42e60b Correct cursor jumping from line 2 to line 1 due to line 1 being empty. (#1108)
- Reduce code duplication by reusing GetBeginningOfLinePos in InsertLineAbove.
- Correct newline search in GetBeginningOfLinePos (HOME) and InsertLineAbove to not ignore first character in the buffer which
might be a new line.
- Manifests as cursor jumps to line 1, because line 1 is blank, when triggered with cursor anywhere on line 2.
2019-10-29 16:10:14 -07: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
Dongbo Wang 11d5e5081e Handle 'PSObject' correctly so that script block handlers works for 'AddToHistoryHandler' (#1068) 2019-09-26 10:17:21 -07:00
Dongbo Wang 394bacc1b5 Make the history file mutext name unique across sessions (#1061) 2019-09-23 16:16:35 -07:00
Dongbo Wang 239955c035 Filter sensitive history items and avoid writing them to the history file (#1058) 2019-09-23 13:20:15 -07:00
Dongbo Wang 2e12332d58 Fix GenerateRender to not throw 'IndexOutOfRangeException' and 'NullReferenceException' (#1049) 2019-09-16 13:21:06 -07:00
Dongbo Wang 809c2872c0 Update ChangeLog and version for 2.0.0-beta5 release (#1046) 2019-09-13 13:23:54 -07:00
Tyler James Leonhardt 5afeced01f Revert "Change the key binding 'Alt+D' to 'Alt+Shift+D' for the windows edit mode (#1037)" (#1040)
This reverts commit 3f6975c1a0.
2019-09-12 23:03:57 -07:00
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