Skip to content

Make PSReadLine more portable - #561

Merged
Jason Shirk (lzybkr) merged 65 commits into
masterfrom
ansi_render
Oct 16, 2017
Merged

Jason Shirk (lzybkr) merged 65 commits into
masterfrom
ansi_render

Conversation

@lzybkr

Copy link
Copy Markdown
Contributor

All of the changes from PowerShell/PowerShell have been integrated or redone.

All rendering is now down with ANSI escape sequences and the core rendering no longer uses Windows specific data structures or apis.

Custom key binding code was rewritten in an attempt to accommodate platform differences, but we still need some P/Invokes on Windows, t.b.d. on Linux.

The PR includes a few internationalization fixes - cursor placement for CJK, plus improved handling of key bindings for less common keyboard layouts.

One new feature in this PR - tooltips are always displayed unless they don't add anything useful (same as the completion). They are only displayed below the menu instead of the old style which truncated the tooltip.

With no portable way to scrape, displaying red in the prompt is harder.

To start, there is a new option to specify the end of the prompt text so
you can specify exactly what should turn red.

Many folks won't use this, so there are some smarts added at startup to
analyze the prompt function - if it's "pure", as in, doesn't call any
methods or commands, we call it and infer the invariant part of the
prompt, basically the last non-whitespace character plus the trailing
whitespace.
Colors can now be customized using RGB (like #RRGGBB) or with escape
sequences.
Fix selection to use escape sequence for invert - it doesn't look that
great when there are too many colors, but it will work with any
customization.

Also fix tests to work after previous commit.
In the move to producing a single binary for a protable module, we'll
need some runtime checks - so I've add a single one which also requires
a dependency on new NuGet package.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants