<table><tr><td style="">michalhumpula created this revision.<br />michalhumpula added a reviewer: Konsole.<br />Restricted Application added a project: Konsole.<br />michalhumpula requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D11859">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>It's quite a common practice today to copy&paste pieces of code/commands from web to editor/terminal. As shown here [1], it's not always apparent what the copied content would be. Konsole implements the bracketed paste mode, which places special escape sequences on the start and end of the pasted text. The shell/editor can later decide how to interpret them.</p>
<p>Current konsole implementation limits only the first variant. The second variant evades the escapes sequences, by terminating the first one. The easiest solution is to remove the problematic sequences from the pasted text, which prevents the snippet from escaping the bracketed mode.</p>
<p>Questions:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">is there a better way, how to protect the shell from harm?</li>
<li class="remarkup-list-item">can figure out the scenario, where it would be valid to paste such escape sequences and expect them to be honored, but maybe there is?</li>
<li class="remarkup-list-item">should it be configurable? If the answer to 2. is there is no such scenario, then it doesn't seem practical to let user disable the paste cleanup.</li>
</ol>
<p>[1]: <a href="http://thejh.net/misc/website-terminal-copy-paste" class="remarkup-link" target="_blank" rel="noreferrer">http://thejh.net/misc/website-terminal-copy-paste</a></p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R319 Konsole</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D11859">https://phabricator.kde.org/D11859</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/TerminalDisplay.cpp</div></div></div><br /><div><strong>To: </strong>michalhumpula, Konsole<br /><strong>Cc: </strong>herrold, ngraham, hindenburg<br /></div>