https://bugs.kde.org/show_bug.cgi?id=422730
Bug ID: 422730 Summary: "Trim leading spaces" shouldn't apply to multiline copies Product: konsole Version: 20.04.1 Platform: Archlinux Packages OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: copy-paste Assignee: konsole-de...@kde.org Reporter: redbeard0...@gmail.com Target Milestone: --- SUMMARY Trim leading spaces is a useful setting when copying from the middle of a line since there seems to be a 50% chance that I accidentally select the space before the word I want to start copying at. It is also nice when I copy a single line of code, since I can just triple click and usually don't want the indentation in that case. However it is very problematic when copying multiple lines of code, since it strips all indentation. IMO it would be best to ignore a leading or trailing newline when deciding whether a selection is multi-line. Eg when copying "\n asdf\n", I think I'd expect just "asdf", but with " foo:\n bar\n", I'd expect " foo:\n bar" (assuming trim trailing spaces was enabled). A possible enhancement would be to dedent all lines by the indentation of the least indented line, possibly only if there are no lines less indented than the first. Then " foo:\n bar\n" would become "foo:\n bar". Not 100% sure if that is a good idea or not. For multiline strings, I'm not sure whether "trim trailing spaces" should apply to each line or just the last one, although I lean toward trimming all lines. IIRC there are some cases where programs write gratuitous extra spaces at the end of lines, and I can't think of any case where I'd actually want to preserve them. STEPS TO REPRODUCE 1. enable the "trim leading spaces setting" 2. cat a file with some well-indented code, using python for maximum fun 3. copy several lines of code, such as a whole function 4. paste it somewhere 5. curse loudly while reindenting it all OBSERVED RESULT indentation is removed and all code starts at column 0 EXPECTED RESULT indentation should be preserved -- You are receiving this mail because: You are watching all bug changes.