Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 9fa8c11d authored by Mariusz Glebocki's avatar Mariusz Glebocki Committed by Kurt Hindenburg

Always preserve line breaks on "Select All" action

Summary:
`_preserveLineBreaks` was set/reset only in mousePressEvent, and was
initially disabled. This led to use of the last setting from mouse
selection, or initial value, by "Select All".

BUG: 352616

Test Plan:
* Start Konsole
* Run `seq 100`
* (optional, test should give the same effect with and without this step)
  Press {key Ctrl} and select some text
* Edit → Select All
* Copy
* Paste in any text editor

**Expected result:** text should be in multiple lines (like on
    Konsole screen)
**Actual result:** text is pasted as one line

=== Regression tests ===

* Run `seq 100`
* Select few lines using mouse
* Copy
* Paste in any text editor

**Expected result:** text should be in multiple lines (like on
   Konsole screen)

* Run `seq 100`
* Press {key Ctrl} and select few lines using mouse
* Copy
* Paste in any text editor

**Expected result:** text should be pasted as one line

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D12058

(cherry picked from commit 10a41f41)
parent 08281e58
......@@ -984,9 +984,7 @@ void SessionController::pasteFromX11Selection()
}
void SessionController::selectAll()
{
ScreenWindow * screenWindow = _view->screenWindow();
screenWindow->setSelectionByLineRange(0, _session->emulation()->lineCount());
_view->copyToX11Selection();
_view->selectAll();
}
void SessionController::selectLine()
{
......
......@@ -371,7 +371,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
, _actSel(0)
, _wordSelectionMode(false)
, _lineSelectionMode(false)
, _preserveLineBreaks(false)
, _preserveLineBreaks(true)
, _columnSelectionMode(false)
, _autoCopySelectedText(false)
, _copyTextAsHTML(true)
......@@ -3054,6 +3054,17 @@ void TerminalDisplay::selectCurrentLine()
selectLine(cursorPosition(), true);
}
void TerminalDisplay::selectAll()
{
if (_screenWindow.isNull()) {
return;
}
_preserveLineBreaks = true;
_screenWindow->setSelectionByLineRange(0, _screenWindow->lineCount());
copyToX11Selection();
}
bool TerminalDisplay::focusNextPrevChild(bool next)
{
// for 'Tab', always disable focus switching among widgets
......
......@@ -528,6 +528,11 @@ public:
// Select the current line.
void selectCurrentLine();
/**
* Selects everything in the terminal
*/
void selectAll();
void printContent(QPainter &painter, bool friendly);
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment