97 Commits
Author SHA1 Message Date
spaette 486388c59f Fix some typos in this repository (#3547) 2023-01-23 14:22:59 -08:00
Dongbo Wang f46f15d2d6 Improve RecomputeInitialCoords to be more robust and handle a couple special cases (#3074) 2022-01-03 16:40:25 -08:00
Dongbo Wang 7edfa93cd2 Reset all attributes before changing color in rendering to avoid color leaking (#2925) 2021-10-20 17:48:13 -07:00
Dongbo Wang 078a2b3cc4 Fix rendering when continuation prompt is an empty string (#2875) 2021-09-20 09:26:12 -07: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 e08072df24 Fix a rendering issue regarding cleanup of previous logical lines (#1865) 2020-10-09 10:26:28 -07:00
Dongbo Wang b33e222642 Rename 'PredictionColor' to 'InlinePredictionColor' (#1860) 2020-10-08 10:16:28 -07:00
Dongbo Wang 0c649bf88f Fix the inline prediction to not leak color (#1861) 2020-10-07 16:56:42 -07:00
Dongbo Wang a6b0e762b6 Use const strings for some often used ANSI control sequences (#1809) 2020-09-14 12:40:25 -07:00
Dustin L. Howett 90422ac2ad Teach PSReadline to not force the background color during render (#1626)
Upcoming versions of the Windows Console will be able to differentiate
a color set by the Win32 API from a color set by VT. This code
transforms a Win32 color into a VT color, and then uses that VT color
during rendering. When an enlightened console host receives this VT, it
may handle it differently (translate it differently, reverse it
differently, store it differently). Use `39;49` for the default foreground/background.

We'll also teach the various console implementations how to
handle it.
2020-07-03 15:59:28 -07:00
Dongbo Wang 65d332e277 Reset all VT attributes for PromptText if it contains VT sequences (#1544) 2020-05-21 22:48:15 -07:00
Dongbo Wang 9e6c6b9481 Add basic support for inline predictive suggestion (#1496) 2020-05-09 15:44:04 -07:00
Dongbo Wang d648aed6da Fix the exception when searching history with ctrl+r or ctrl+s (#1256) 2019-12-20 23:00:17 -08:00
Dongbo Wang 8c95f93b6a Make the continuation prompt's color sequence always explicitly specified. (#1238) 2019-12-10 16:06:59 -08:00
Carl Morris 1c41239b34 Correct cursor positioning (#1221)
Correct cursor positioning in cases where newline appears 1 character before
last column, or a CJK character ends the line but wraps to next display
line, and in cases where continuation prompt contains either CJK characters,
or VT color sequences.

Fixes #1216, #1217, #1188.
2019-12-06 00:12:54 -08:00
Dongbo Wang 6f0ccf40ca Fix an 'ArgumentOutOfRangeException' when error prompt contains CJK (#1206) 2019-11-25 17:30:45 -08:00
Jason Shirk 599e1784a9 Improve handling of color in prompts (#1180) 2019-11-25 12:59:09 -08:00
Carl Morris 4576a77329 MoveCursor should not call SetCursorPosition when there is a pending rendering. (#1141) 2019-11-08 22:54:02 -08:00
Carl Morris 7c825775eb Handle cursor being moved off the end of buffer in MoveCursor. (#1146) 2019-11-08 10:45:41 -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 2e12332d58 Fix GenerateRender to not throw 'IndexOutOfRangeException' and 'NullReferenceException' (#1049) 2019-09-16 13:21:06 -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
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
Dongbo Wang fd9af03531 Fix ArgumentOutOfRangeException thrown when changing color of the error prompt (#967) 2019-07-19 21:40:18 -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
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
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 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
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
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
Jason Shirk f1705e9bb2 Switch from MSTest to xUnit, enable tests in AppVeyor (#600) 2017-12-15 11:59:57 -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 b2979d1c15 Fix rendering after buffer resize
Fix #418
2017-11-06 10:39:37 -08:00
Jason Shirk 3fbb2408b3 Treat DingDuration=0 as BellStyle.None
Fix #364
2017-11-04 11:31:27 -07:00
Jason Shirk d785576437 Color long name parameters like --force as a parameter
Fix #398
2017-11-04 11:23:09 -07:00
Jason Shirk dab0176a1b Fix selection rendering across multiple lines 2017-11-02 17:06:18 -07:00
Jason Shirk 42d52108c8 Fix Beep on Linux to use implemented api 2017-10-16 11:54:06 -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 9e39cf04cc Fix some rendering issues 2017-09-17 21:35:10 -07:00
Jason Shirk fb10c6d9c3 Show tooltips by default in MenuComplete 2017-09-09 15:00:24 -07:00
Jason Shirk 245000c3b7 Remove #region 2017-09-02 21:09:40 -07:00
Jason Shirk 1a623b9327 Replace COORD with Point except in ScreenCapture 2017-09-02 14:43:03 -07:00
Jason Shirk ad7d580a8b More end of buffer rendering fixes 2017-08-28 14:21:05 -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