> Even if this doesn't get implemented, I'd love to hear why this is not a
> desired behavior :)
I think it's an interesting (and probably useful) behavior, but it probably
also cannot be the default. Here are a couple of reasons why from the top of
my head:
* What currently happens is that the pasted text is inserted as-is in the file
-- not "pasted at column 0" if you will. This means that you get exactly what
the content of the clipboard was inserted where you asked, which is great for
predictability, as well as handling all case a "smart" algorithm might get
wrong.
* What if the clipboard already *has* indentation for the subsequent lines?
* Strip the common indentation from all lines in the clipboard, and add back
the one at the current position?
* What about empty lines in the clipboard, do they count as "0-length
indentation" or "let's ignore this line"
* Or maybe strip the indentation from the first clipboard line, and then add
`(current - delta_from_first_line)`? (e.g. aiming for the first line's indent
to be the current position's indent, and then adding and removing indentation
to match the differences in the pasted content)
* And then, how to make up what an "indentation level" is in the clipboard?
Is it the same size as the current document's? Or is it inferred from the
clipboard?
* But then, what if you copied only a partial first line rather than the
whole thing? then applying delta is basically yielding the same as not
changing anything.
* Strip all indentation from the clipboard and past it all at the same level?
* Simply prepend the current position's indentation to all lines without
stripping anything from the clipboard?
All that might or might not make sense I guess, depending on the situation. I
*guess* the "best" algorithm is one that takes clipboard indentation deltas
into account and applies them, but it's also the most complex and could get
things wrong.
---
As a currently available workaround (which you might already know about), you
can easily adjust indentation of a whole series of lines by selecting it and
using <kbd>Tab</kdb> or <kbd>Shift+Tab</kdb>.
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/3845#issuecomment-2067343536
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany/issues/3845/[email protected]>