Expose bracket text function

This commit is contained in:
Zang MingJie
2017-12-29 19:40:06 +08:00
committed by Alf Gaida
parent ba85185c40
commit 1d4ddc8afd
4 changed files with 20 additions and 5 deletions
+10 -5
View File
@@ -2662,11 +2662,7 @@ void TerminalDisplay::emitSelection(bool useXselection,bool appendReturn)
if ( ! text.isEmpty() )
{
text.replace('\n', '\r');
if ( bracketedPasteMode() )
{
text.prepend("\e[200~");
text.append("\e[201~");
}
bracketText(text);
QKeyEvent e(QEvent::KeyPress, 0, Qt::NoModifier, text);
emit keyPressedSignal(&e); // expose as a big fat keypress event
@@ -2674,6 +2670,15 @@ void TerminalDisplay::emitSelection(bool useXselection,bool appendReturn)
}
}
void TerminalDisplay::bracketText(QString& text)
{
if (bracketedPasteMode())
{
text.prepend("\033[200~");
text.append("\033[201~");
}
}
void TerminalDisplay::setSelection(const QString& t)
{
QApplication::clipboard()->setText(t, QClipboard::Selection);
+3
View File
@@ -192,6 +192,9 @@ public:
void emitSelection(bool useXselection,bool appendReturn);
/** change and wrap text corresponding to paste mode **/
void bracketText(QString& text);
/**
* Sets the shape of the keyboard cursor. This is the cursor drawn
* at the position in the terminal where keyboard input will appear.
+5
View File
@@ -531,6 +531,11 @@ void QTermWidget::sessionFinished()
emit finished();
}
void QTermWidget::bracketText(QString& text)
{
m_impl->m_terminalDisplay->bracketText(text);
}
void QTermWidget::copyClipboard()
{
m_impl->m_terminalDisplay->copyClipboard();
+2
View File
@@ -219,6 +219,8 @@ public:
/** True if the title() or icon() was (ever) changed by the session. */
bool isTitleChanged() const;
/** change and wrap text corresponding to paste mode **/
void bracketText(QString& text);
signals:
void finished();
void copyAvailable(bool);