752 Commits
Author SHA1 Message Date
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
Staffan Gustafsson 3229956a19 Adding space as an essential PS character. (#711)
Space should be added even if a modifier is added.

Fix #719
2018-06-25 21:50:29 -07:00
Patrick Meinecke 46960b1fe4 Changes for Editor Hosts (VSCode/Atom) (#626) 2018-06-04 23:16:59 -07:00
Jason Shirk 2a3450d222 Beta2 2018-06-03 23:26:01 -07:00
Staffan Gustafsson bf36369f13 Always display special characters (#667)
Many of these are behind `AltGr` and we can't reliably determine when `AltGr` is needed.
2018-06-03 23:22:11 -07:00
Jianyun b83522b43d Fixed cursor position after resize (#694)
Add tracking of buffer height to recalculate initial coordinates.

Fix #682
2018-06-03 20:01:19 -07:00
Jianyun 9ca0326746 Fix PhysicalLineCount for proper rendering for a long line user input (#688)
Fixes #686
2018-05-30 22:40:39 -07:00
Dongbo Wang 708787f8f5 Fix Ctrl+Backspace/Ctrl+h in Linux (#661)
Fix #619
2018-04-02 21:38:51 -07:00
Dongbo Wang 21cd4e3850 Fix a few custom key binding on Windows (#657)
Fix #580.
2018-03-25 11:11:13 -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
Dongbo Wang 14c5ee0bb2 Fix ExtraPromptLineCount for ClearScreen (#655)
Fix #634.
2018-03-23 09:40:47 -07:00
Staffan Gustafsson 03c48994c1 Support explicit color in PromptText option (#653)
When the prompt is drawn with a different color than the default text,
after displaying the error prompt, the prompt is not restored correctly.

The option -PromptText will now recognize the use of escape sequences
for color so the prompt can be restored correctly after the error prompt
is removed.
2018-03-23 09:38:32 -07:00
Dongbo Wang 62cf9f84cc Disable PSReadline on Unix when stdin or stdout is redirected (#648)
Fixes #625.
2018-03-20 11:20:17 -07:00
srdubya 91d6eeda30 Support Ctrl+u in vi insert mode (#637)
Fixes #628
2018-03-20 11:17:58 -07:00
Jason Shirk e68ab02055 Fix keys that require AltGr for SelfInsert
Fix #617
2018-01-28 12:10:25 -08:00
srdubya c385dd5bcb Fix 2 vi-mode cursor placement issues (#627)
Fix cursor placement after `cf`
Also fix cursor placement with `s` at EOL.

Fix #623
2018-01-28 11:53:29 -08:00
Jason Shirk c3868e1250 Ignore exceptions Console.OutputEncoding
The output encoding is set for CJK characters, so if that fails, it
would be nice to know, but it comes up often (redirected input,
legacy conhost) so we just ignore the exception.
2017-12-17 22:24:25 -08:00
Jason Shirk be253cdacf Don't restore output encoding when closing
Setting Console.OutputEncoding can hang on Win7 if the console is closing
and there is no point, so don't bother doing that when closing.

Fix #609.
2017-12-16 23:27:11 -08:00
Jason Shirk 09b693014e Enable Ctrl+c on non-Windows
I missed `Console.TreatControlCAsInput` when refactoring the port from
PowerShell/PowerShell - this isn't needed on Windows because it was
handled more directly via SetConsoleMode.

Fix #610
2017-12-16 09:08:29 -08:00
Jason Shirk f1705e9bb2 Switch from MSTest to xUnit, enable tests in AppVeyor (#600) 2017-12-15 11:59:57 -08:00
Jason Shirk d9e156570a Better handling of VT emulation of ESC [ x ; y m (#611)
Also correctly handle partially invalid sequences by ignoring the whole sequence.

Fix #605
2017-12-15 11:09:42 -08:00
Jason Shirk d3b01e280c Add Publish task, generate prerelease tag
The Prerelease tag in the module manifest is generated from the
AssemblyInformationalAttribute in Microsoft.PowerShell.PSReadLine2.dll.
2017-12-05 23:28:28 -08:00
Jason Shirk c1c03cf1cf Infer Shift for A-Z in custom bindings 2017-12-04 14:04:47 -08: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 ef6654790d Fix exception in SwapCharacters with short line
Fix #599
2017-12-01 22:27:04 -08:00
Jason Shirk 73dfa57701 Fix P/Invoke used in clipboard support
The entrypoint for CopyMemory wasn't correct, for some reason it worked
with Desktop CLR but not Core CLR.
2017-12-01 17:07:14 -08:00
Jason Shirk 416ca3e4e3 Rename Microsoft.PowerShell.PSReadline.dll
To work around PowerShell Core not loading the dll from the same
directory as PSReadLine.psd1, I've renamed the dll.
2017-12-01 17:05:43 -08:00
Jason Shirk 217ab4fe88 Add SelectionColor to format.ps1xml 2017-12-01 17:04:13 -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 cf0ea9a4f7 Update Changes.txt 2017-11-27 10:20:24 -08:00
Jason Shirk d537d01ed5 Fix CursorSize w/ redirected output
Also add logging to see errors during help generation.

Fix #593
2017-11-27 07:15:50 -08:00
Jason Shirk c2ff21ef9a Honor HistorySearchCursorMovesToEnd in HistorySearch
Fix #438
2017-11-26 18:07:30 -08:00
Jason Shirk b2c04745e0 Don't add immediate duplicates to history
Also add a public api to access PSReadLine history (helpful in testing
this change.

Fix #562 #533
2017-11-26 17:51:46 -08:00
Jason Shirk 9d5621e05b Make ViReplaceLine public
Fix #581
2017-11-26 11:19:44 -08:00
Jason Shirk 22d8d66951 Ensure ENABLE_VIRTUAL_TERMINAL_PROCESSING is set
Windows PowerShell on Win10 before Fall Creators update would fail to
keep ENABLE_VIRTUAL_TERMINAL_PROCESSING set after running other
executables.

This change ensures that it is always.

The change can be removed when Fall Creators Update or later is
required.

Fix #582
2017-11-26 11:12:33 -08:00
Jason Shirk e33dabb46c Replace -*Color parameters with single parameter
To make it a bit easier to create themes, the various parameters to
Set-PSReadLineOption to set colors has been replaced with a single
parameter accepting a Hashtable.

The valid keys are:

-- ContinuationPrompt: The color of the continuation prompt.
-- Emphasis: The emphasis color, e.g. the matching text when searching history.
-- Error: The error color, e.g. in the prompt.
-- Default: The default token color.
-- Comment: The comment token color.
-- Keyword: The keyword token color.
-- String: The string token color.
-- Operator: The operator token color.
-- Variable: The variable token color.
-- Command: The command token color.
-- Parameter: The parameter token color.
-- Type: The type token color.
-- Number: The number token color.
-- Member: The member name token color.
2017-11-26 10:51:41 -08:00
Jason Shirk 46d232c22a s/PSReadline/PSReadLine/g
I was terribly inconsistent.

This is a breaking change, though unlikely to cause troubles.
The apis are mostly used in PowerShell scripts which is not
case sensitive.
The cmdlet name change is also mostly safe.

At any rate, this is version 2.0 and breaking changes should be OK.
2017-11-25 21:59:55 -08:00
Jason Shirk 193b4da3ac Fix cursor placement after history replacement
A fix for vi mode broke placing the cursor after recalling commands from
history.

There was also a small inconcistency in placing the cursor in vi mode
when in command mode.

Fix #592
2017-11-25 21:30:45 -08:00