New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fish_clipboard_paste: trim indentation when pasting multiple lines #7662
fish_clipboard_paste: trim indentation when pasting multiple lines #7662
Conversation
It's a dunderscored function, which we technically don't give guarantees for (but tbh we have sooo many of these, some we even recommend in the docs, that that's not a fantastic policy in practice - maybe we should undunder some?), but it's also a very specialized thing. I say go for it, if you think anyone is using it (my gut says probably not, but I have been wrong before) add a compatibility shim - see I have two questions here:
|
There are some occurrences on GitHub. It's probably still acceptable to rename it.
Hmm, sadly it doesn't handle quoted multiline strings. Pasting something like
drops the indent. This is fixable.
Could be. Adding this to We could also use the logic from A similar issue is when I edit a multiline command with Alt-E and run |
e67b06a
to
e334826
Compare
It might be a good idea to un-dunder functions that are likely to be copied by users (for example because they sample prompts). However, that will just add to the functions we'd want to un-dunder/document/keep supporting. So I'm not sure. I'm still not entirely happy with the name, maybe it should stay dundered.
|
e334826
to
6271a31
Compare
When pasting a multiline command with indented blocks, extra indentation from spaces, or tabs, is generally undesirable, because fish already indents pipes and blocks. Discard the indentation unless the cursor or the pasted part is inside quotes. Users who copied fish_clipboard_paste need to update it because __fish_commandline_is_singlequoted had an API change and was renamed.
…quoted It could be really annoying if Ctrl-V stopped working when switching between fish versions, for example when using different machines.
6271a31
to
114aa99
Compare
Description
When pasting a multiline command with indented blocks, extra indentation from
spaces, or tabs, is generally undesirable. Discard it unless the cursor is
inside quotes.
This is probably not always exactly what you wants, since sometimes you might paste multiline tokens that are not commands.
But it's surely better in the majority of all cases.
I also created this PR because I wasn't sure about
__fish_commandline_is_singlequoted
.Is it okay to rename it? It seems that some people are using it already, but not many.
Maybe it should be
fish_commandline_is_quoted single
for the old behavior, andfish_commandline_is_quoted single double
for "single or double", but the "print" variant is best forfish_clipboard_paste
, so we don't need to call it twice.TODOs: