Expose bracket text function
This commit is contained in:
+10
-5
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user