47 Commits
Author SHA1 Message Date
Dongbo Wang f5a7ebda97 Update the use of the prediction interface to adapt to the breaking changes introduced in PowerShell 7.2.0-preview.6 (#2524) 2021-06-01 10:32:44 -07:00
Dongbo Wang 8df5b6ba08 Update PSReadLine corresponding to the prediction interface update (#2225) 2021-02-22 18:17:26 -08:00
Dongbo Wang 6ed95a23d5 Add the SelectCommandArgument bind-able function (#2222) 2021-02-17 15:25:27 -08: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 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
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 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 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
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 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 b27ea9d85d Add check for negative index in Replace api 2017-11-02 21:58:54 -07:00
Jason Shirk bff16f4beb Correct resources namespace 2017-09-04 23:20:37 -07:00
Josh Soref ff80a13550 Spelling comments
* spelling: comments in src/Microsoft.PowerShell.PSReadLine
2017-09-02 21:03:11 -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 602ecd496f Move more Win32 specific apis out of IConsole 2017-08-29 23:38:38 -07:00
Jason Shirk e2fb174742 Fix rendering artifacts from shorter renders 2017-08-27 15:38:32 -07:00
Jason Shirk 96772e404f Moving onwards towards minimal P/Invokes 2017-08-14 08:56:22 -07:00
Jason Shirk 4d67c6b39d MenuComplete mostly working 2017-08-14 08:56:22 -07:00
Jason Shirk a2ae486d0d Make East Asian character support more portable
Character ranges are probably sufficient for detecting which characters
need to be rendered in cells, so I removed the Win32 specific code that
used information about the font.

We also probably don't need to detect the code page - instead assume if
a wide character is to be rendered, that the correct font is in use,
otherwise the command line looks like garbage anyway, so if we're wrong,
there is a low likelihood of it mattering.
2017-07-31 18:17:20 -07:00
Jason Shirk 855ed7f78c Unify internal and visible cursor updates 2017-07-31 18:08:07 -07:00
Jason Shirk 443b9a5240 use nameof 2017-07-31 17:22:23 -07:00
Jason Shirk (POWERSHELL) f96bd94ece Avoid reporting an error w/ stdin/out is redirected
When stdin or stdout is redirected, PSReadLine fails with an error message that isn't very helpful.

As long as redirected stdin/out is not supported, we'll just throw an exception and let PowerShell
fall back on calling Console.ReadLine or whatever it normally does when PSConsoleHostReadline throws.
2016-09-06 11:23:47 -07:00
Jason Shirk (POWERSHELL) cc6eaa711e Update xmldoc comments 2016-01-17 09:01:02 -08:00
Jason Shirk (POWERSHELL) 618b4971ef Move some apis to be internal 2016-01-17 08:52:40 -08:00
jason@truewheels.net accc20dfe9 Finish refactoring so unit tests run in VS2015
The mock of the console api is complete enough so unit tests run.

It's still a hack, not exactly factored nicely to support other hosts,
but at least some of the real interface is in one place, not scattered
about.
2015-12-16 22:56:25 -08:00
Dan Thompson 89b3b0d7b7 CaptureScreen: scroll buffer with selection, add alternate movement keys. 2015-12-13 17:55:04 -08:00
jason@truewheels.net 8691e88595 Initial refactor console api usage
To get the unit tests passing in VS2015, and to help w/ possible future hosts,
I've moved most of the console api usage to a class, which is then mocked
in the unit tests.
2015-12-06 09:05:37 -08:00
srdubya 638fac894e Fixed tests and reformatted some code to fix a reported exception. 2015-08-05 07:33:55 -06:00
Eduardo Antunes C. de Sousa b88865a00f Fix exception for use completion when a edit group is already started. 2015-07-30 15:34:54 -03:00
srdubya ab52d2b642 1st attempt at merge with #251. 2015-06-20 16:47:33 -06:00
Jason Shirk (POWERSHELL) dc36a49ce9 Move one-time initialization out of psm1 2015-06-18 20:01:49 -07:00
Jason Shirk (POWERSHELL) 94a6ba40c9 Fix/suppress various FxCop errors 2015-06-18 18:24:23 -07:00
Jason Shirk (POWERSHELL) c986e0eae5 Rename namespace PSConsoleUtilities to Microsoft.PowerShell 2015-06-18 15:32:20 -07:00
Jason Shirk (POWERSHELL) 6408a4c96c Add copyright header 2015-06-18 15:04:49 -07:00
srdubya aabfe24b87 Fixed "<esc>h<space>ih" bug. 2015-03-03 20:32:57 -07:00
srdubya 16f0ad9c5c Sync'd with Upstream. 2014-12-22 18:27:22 -07:00
srdubya 4b0acf08ba Merge remote-tracking branch 'upstream/master'
Conflicts:
	PSReadLine/History.cs
	PSReadLine/Movement.cs
	PSReadLine/PSReadLineResources.resx
	PSReadLine/UndoRedo.cs
2014-04-19 18:06:06 -06:00
jason@truewheels.net 2773504139 Revert "Use runtime check to allow other console-based hosts to use PSReadline."
This reverts commit f5c94f7fe2.

Conflicts:
	PSReadLine/PublicAPI.cs
2014-04-16 10:58:03 -07:00
jason@truewheels.net 32668ba5bb Add api to get selection state. 2014-04-16 09:14:47 -07:00
jason@truewheels.net 2d74f3e6e2 Support digit args for word/character movement 2014-04-13 10:43:57 -07:00
srdubya 50d5f13091 Cleaned up formatting changes in common files.
Further minimized changes to originals.
2014-03-29 07:00:30 -06:00
srdubya 5d649163bc Adding VI edit mode, along with unit tests.
Note, these items need work:
 - No support for Yank/Paste yet.
 - No support for 'G' history goto yet.
 - Undo works, but not as desired in some cases.
2014-03-22 08:16:03 -06:00
jason@truewheels.net 9b9e022d8c Merge branch 'master' of https://github.com/lzybkr/PSReadLine
Conflicts:
	PSReadLine/PublicAPI.cs
2014-03-08 16:15:27 -08:00
jason@truewheels.net ee37df867e Replace Fakes with simple mock object
Fakes are handy, but require Visual Studio Professional.
To enable folks using Express, I added a mock interface
for the bits that need mocking.
2014-03-08 15:52:44 -08:00
jazzdelightsme f5c94f7fe2 Use runtime check to allow other console-based hosts to use PSReadline.
The host check in the .psd1 only allows you to specify one host. To allow
other hosts to use PSReadline, but still try to give a helpful error to
people trying to use PSReadline in other, non-console hosts (like the ISE),
we instead do a runtime check using IModuleAssemblyInitializer, wherein we
check to see if the current process has a non-hidden console window, and
emit an error if not.
2014-03-04 18:12:42 -08:00
jason@truewheels.net 68b8d5a3b3 PublicAPI tests 2014-01-26 23:35:33 -08:00
jason@truewheels.net 0adc651828 Refactor code to multiple files 2014-01-12 14:11:04 -08:00