[Konsole-devel] [Bug 89299] prevent paste of newline characters

Reeted reeted at shiftmail.org
Mon Oct 3 10:55:00 UTC 2011


https://bugs.kde.org/show_bug.cgi?id=89299





--- Comment #43 from Reeted <reeted shiftmail org>  2011-10-03 10:54:59 ---
Alain, you are right about the pipe followed by (whitespaces and then) a
newline, I wasn't aware that it was possible, so this is to be handled
separately. 
Also newline within a string should be handled differently, but actually this
one is not easy because its behaviour depends on whether there is already an
opened doublequote in the part of text before the paste point. So let's
disregard this (people can still use the normal paste).
However the substitution proposed by many (newlines --> semicolon) makes sense
in most cases.

I maintain my proposal of an additional "paste without newlines" (or "paste
special") hotkey.

I think that such new hotkey could be connected to either a confirmation
dialogbox showing the text being pasted, as you proposed (especially useful if
it shows the FULL text and it is editable), or a predetermined substitution
algorithm, as I proposed. The choice between the two should be configurable
from the Profiles-configuration.

The old normal "paste" hotkey should still be accessible.

I update my "substitution sequence" proposal:
- If there is only one newline at the end of the text being pasted, remove
that. 
        End.
- Else:
    - removal of \r from everywhere
    - replacement of \t from everywhere where with a customizable number of 
        whitespaces, so to not trigger bash completion which would break
everything. 
        (I have now noticed that bash substitution happens everywhere and not 
        only at the start of a line)
    - replacement of \n with "; \\\n" (semicolon, whitespace, backslash,
newline) 
        EXCEPT when the last nonblank-nontab charachter of the line is a pipe. 
        For the pipe case, replace \n with " \\\n" (space, backslash, newline)

This substitution algorithm should also be available in the confirmation
dialogbox, in a button called like "replace newlines" or "sanify code" or
similar.

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the konsole-devel mailing list