Replies: 1 comment 1 reply
-
|
Did you ever find an acceptable way to do this? Currently trying to implement this gist for zsh in powershell and running into a similar limitation |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, does anyone know if/how it may be possible to insert text into the buffer without accepting/clearing it?
More Details
Ideally, I want to insert some multi-line text into the prompt but still allow for further editing of that text.
Specifically, I'm using PowerShell v7 on Win11 in Windows Terminal and already have the ability to paste a multi-line blob of text into my prompt without invoking the command/text.
So for instance, if I copy/paste this code into my prompt:
I am still able to use my arrow keys to move around & edit the text before invoking it via enter key (once all statements are terminated, otherwise a blank line is inserted).
I'm trying to recreate that same behavior but obviously not using the clipboard and instead via a PowerShell function I'm writing that would call the static methods from this lib.
What I've Tried
I've gone thru the examples in this repo (which are really cool btw), and I thought it would be as simple as using the
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("0..9 |%{ $_")or::Replace(string)methods, but alas, I'm struggling to keep the buffer open at all.Once I insert text with either of those methods, I can't seem to prevent the prompt from immediately clearing the buffer.
Anyone have any suggestions? Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions