Add select all option

pull/2/head
reionwong
parent ee490280c8
commit e8b841fe08

@ -1110,6 +1110,14 @@ void Screen::setSelectionEnd( const int x, const int y)
}
}
void Screen::selectAll()
{
selBegin = 0;
selTopLeft = 0;
int endPos = (getHistLines() + getCursorY() + 1) * columns - 1;
selBottomRight = endPos;
}
bool Screen::isSelected( const int x,const int y) const
{
bool columnInSelection = true;

@ -423,6 +423,8 @@ public:
*/
void setSelectionEnd(const int column, const int line);
void selectAll();
/**
* Retrieves the start of the selection or the cursor position if there
* is no selection.

@ -262,6 +262,14 @@ QRect ScreenWindow::scrollRegion() const
return QRect(0,0,windowColumns(),windowLines());
}
void ScreenWindow::selectAll()
{
_screen->selectAll();
_bufferNeedsUpdate = true;
emit selectionChanged();
}
void ScreenWindow::notifyOutputChanged()
{
// move window to the bottom of the screen and update scroll count

@ -114,6 +114,8 @@ public:
*/
QRect scrollRegion() const;
void selectAll();
/**
* Sets the start of the selection to the given @p line and @p column within
* the window.

@ -2616,6 +2616,15 @@ bool TerminalDisplay::selectedText()
return !m_screenWindow->selectedText(false).isEmpty();
}
void TerminalDisplay::selectAll()
{
if (!m_screenWindow)
return;
m_screenWindow->selectAll();
setSelection(m_screenWindow->selectedText(_preserveLineBreaks));
}
void TerminalDisplay::copyClipboard()
{
if ( !m_screenWindow )

@ -355,6 +355,8 @@ public:
void setSelection(const QString &t);
bool selectedText();
Q_INVOKABLE void selectAll();
/**
* Reimplemented. Has no effect. Use setVTFont() to change the font
* used to draw characters in the display.

@ -51,6 +51,13 @@ Page {
}
onKeyPressed: {
if ((event.key === Qt.Key_A)
&& (event.modifiers & Qt.ControlModifier)
&& (event.modifiers & Qt.ShiftModifier)) {
_terminal.selectAll()
event.accepted = true
}
if ((event.key === Qt.Key_C)
&& (event.modifiers & Qt.ControlModifier)
&& (event.modifiers & Qt.ShiftModifier)) {
@ -185,6 +192,12 @@ Page {
action: _pasteAction
}
MenuItem {
id: selectAllItem
text: qsTr("Select All")
onTriggered: _terminal.selectAll()
}
MenuItem {
text: qsTr("Open File Manager")
onTriggered: Process.openFileManager(_session.currentDir)

Loading…
Cancel
Save