Commit 4b293197 authored by Robert Knight's avatar Robert Knight

Change default triple click behaviour to select the whole line, rather than...

Change default triple click behaviour to select the whole line, rather than just that forwards of the cursor.  This is in line with KDE 3.  Replaced the API which controls this behaviour in the TerminalDisplay class with a clearer one.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=748979
parent dc3e9fbf
......@@ -268,7 +268,7 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
,_cursorBlinking(false)
,_hasBlinkingCursor(false)
,_ctrlDrag(false)
,_cutToBeginningOfLine(false)
,_tripleClickMode(SelectWholeLine)
,_isFixedSize(false)
,_possibleTripleClick(false)
,_resizeWidget(0)
......@@ -2079,7 +2079,7 @@ void TerminalDisplay::mouseTripleClickEvent(QMouseEvent* ev)
while (_iPntSel.y()>0 && (_lineProperties[_iPntSel.y()-1] & LINE_WRAPPED) )
_iPntSel.ry()--;
if (_cutToBeginningOfLine) {
if (_tripleClickMode == SelectForwardsFromCursor) {
// find word boundary start
int i = loc(_iPntSel.x(),_iPntSel.y());
int selClass = charClass(_image[i].character);
......@@ -2103,7 +2103,7 @@ void TerminalDisplay::mouseTripleClickEvent(QMouseEvent* ev)
_screenWindow->setSelectionStart( x , _iPntSel.y() , false );
_tripleSelBegin = QPoint( x, _iPntSel.y() );
}
else {
else if (_tripleClickMode == SelectWholeLine) {
_screenWindow->setSelectionStart( 0 , _iPntSel.y() , false );
_tripleSelBegin = QPoint( 0, _iPntSel.y() );
}
......
......@@ -158,8 +158,21 @@ public:
void setCtrlDrag(bool enable) { _ctrlDrag=enable; }
bool ctrlDrag() { return _ctrlDrag; }
void setCutToBeginningOfLine(bool enable) { _cutToBeginningOfLine=enable; }
bool cutToBeginningOfLine() { return _cutToBeginningOfLine; }
/**
* This enum describes the methods for selecting text when
* the user triple-clicks within the display.
*/
enum TripleClickMode
{
/** Select the whole line underneath the cursor. */
SelectWholeLine,
/** Select from the current cursor position to the end of the line. */
SelectForwardsFromCursor
};
/** Sets how the text is selected when the user triple clicks within the display. */
void setTripleClickMode(TripleClickMode mode) { _tripleClickMode = mode; }
/** See setTripleClickSelectionMode() */
TripleClickMode tripleClickMode() { return _tripleClickMode; }
void setLineSpacing(uint);
uint lineSpacing() const;
......@@ -661,7 +674,7 @@ private:
bool _cursorBlinking; // hide cursor in paintEvent
bool _hasBlinkingCursor; // has blinking cursor enabled
bool _ctrlDrag; // require Ctrl key for drag
bool _cutToBeginningOfLine; // triple click only selects forward
TripleClickMode _tripleClickMode;
bool _isFixedSize; //Columns / lines are locked.
QTimer* _blinkTimer; // active when hasBlinker
QTimer* _blinkCursorTimer; // active when hasBlinkingCursor
......
......@@ -581,7 +581,7 @@ TerminalDisplay* ViewManager::createTerminalDisplay(Session* session)
//TODO Temporary settings used here
display->setBellMode(0);
display->setTerminalSizeHint(false);
display->setCutToBeginningOfLine(true);
display->setTripleClickMode(TerminalDisplay::SelectWholeLine);
display->setTerminalSizeStartup(false);
display->setScrollBarPosition(TerminalDisplay::ScrollBarRight);
display->setRandomSeed(session->sessionId() * 31);
......
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