Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:david-smid:kde-4.9.0
konsole
kde4-kdebase-bug-188528-4.9.0.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kde4-kdebase-bug-188528-4.9.0.patch of Package konsole
--- src/EditProfileDialog.cpp.orig 2012-07-25 01:33:23.000000000 +0200 +++ src/EditProfileDialog.cpp 2012-08-31 13:40:57.561807476 +0200 @@ -990,6 +990,10 @@ void EditProfileDialog::setupMousePage(c _ui->copyTextToClipboardButton , Profile::AutoCopySelectedText, SLOT(toggleCopyTextToClipboard(bool)) }, + { + _ui->trimTrailingSpacesButton , Profile::TrimTrailingSpacesInSelectedText, + SLOT(toggleTrimTrailingSpacesInSelectedText(bool)) + }, { 0 , Profile::Property(0) , 0 } }; setupCheckBoxes(options , profile); @@ -1108,6 +1112,10 @@ void EditProfileDialog::toggleCopyTextTo { updateTempProfileProperty(Profile::AutoCopySelectedText, enable); } +void EditProfileDialog::toggleTrimTrailingSpacesInSelectedText(bool enable) +{ + updateTempProfileProperty(Profile::TrimTrailingSpacesInSelectedText, enable); +} void EditProfileDialog::pasteFromX11Selection() { updateTempProfileProperty(Profile::MiddleClickPasteMode, Enum::PasteFromX11Selection); --- src/EditProfileDialog.h.orig 2012-05-23 02:29:12.000000000 +0200 +++ src/EditProfileDialog.h 2012-08-31 11:26:56.669512618 +0200 @@ -151,6 +151,7 @@ private slots: // mouse page void toggleUnderlineLinks(bool); void toggleCopyTextToClipboard(bool); + void toggleTrimTrailingSpacesInSelectedText(bool); void pasteFromX11Selection(); void pasteFromClipboard(); --- src/EditProfileDialog.ui.orig 2012-05-23 02:29:12.000000000 +0200 +++ src/EditProfileDialog.ui 2012-08-31 11:53:19.342108181 +0200 @@ -783,6 +783,16 @@ </widget> </item> <item> + <widget class="QCheckBox" name="trimTrailingSpacesButton"> + <property name="toolTip"> + <string>Trim trailing spaces in selected text, useful in some editors</string> + </property> + <property name="text"> + <string>Trim trailing spaces</string> + </property> + </widget> + </item> + <item> <spacer name="horizontalSpacer_5"> <property name="orientation"> <enum>Qt::Horizontal</enum> --- src/Profile.cpp.orig 2012-05-23 02:29:12.000000000 +0200 +++ src/Profile.cpp 2012-08-31 11:26:56.670512605 +0200 @@ -104,6 +104,7 @@ const Profile::PropertyInfo Profile::Def , { TripleClickMode , "TripleClickMode" , INTERACTION_GROUP , QVariant::Int } , { UnderlineLinksEnabled , "UnderlineLinksEnabled" , INTERACTION_GROUP , QVariant::Bool } , { AutoCopySelectedText , "AutoCopySelectedText" , INTERACTION_GROUP , QVariant::Bool } + , { TrimTrailingSpacesInSelectedText , "TrimTrailingSpacesInSelectedText" , INTERACTION_GROUP , QVariant::Bool } , { PasteFromSelectionEnabled , "PasteFromSelectionEnabled" , INTERACTION_GROUP , QVariant::Bool } , { PasteFromClipboardEnabled , "PasteFromClipboardEnabled" , INTERACTION_GROUP , QVariant::Bool } , { MiddleClickPasteMode, "MiddleClickPasteMode" , INTERACTION_GROUP , QVariant::Int } @@ -168,6 +169,7 @@ FallbackProfile::FallbackProfile() setProperty(BlinkingTextEnabled, true); setProperty(UnderlineLinksEnabled, true); setProperty(AutoCopySelectedText, false); + setProperty(TrimTrailingSpacesInSelectedText, false); setProperty(PasteFromSelectionEnabled, true); setProperty(PasteFromClipboardEnabled, false); setProperty(MiddleClickPasteMode, Enum::PasteFromX11Selection); --- src/Profile.h.orig 2012-05-23 02:29:12.000000000 +0200 +++ src/Profile.h 2012-08-31 11:26:56.671512593 +0200 @@ -198,6 +198,8 @@ public: UnderlineLinksEnabled, /** (bool) If true, automatically copy selected text into the clipboard */ AutoCopySelectedText, + /** (bool) If true, trailing spaces are trimmed in selected text */ + TrimTrailingSpacesInSelectedText, /** (bool) If true, middle mouse button pastes from X Selection */ PasteFromSelectionEnabled, /** (bool) If true, middle mouse button pastes from Clipboard */ --- src/Screen.cpp.orig 2012-05-23 16:11:09.000000000 +0200 +++ src/Screen.cpp 2012-08-31 13:10:45.135282116 +0200 @@ -1096,22 +1096,22 @@ bool Screen::isSelected(const int x, con return pos >= _selTopLeft && pos <= _selBottomRight && columnInSelection; } -QString Screen::selectedText(bool preserveLineBreaks) const +QString Screen::selectedText(bool preserveLineBreaks, bool trimTrailingSpaces) const { if (!isSelectionValid()) return QString(); - return text(_selTopLeft, _selBottomRight, preserveLineBreaks); + return text(_selTopLeft, _selBottomRight, preserveLineBreaks, trimTrailingSpaces); } -QString Screen::text(int startIndex, int endIndex, bool preserveLineBreaks) const +QString Screen::text(int startIndex, int endIndex, bool preserveLineBreaks, bool trimTrailingSpaces) const { QString result; QTextStream stream(&result, QIODevice::ReadWrite); PlainTextDecoder decoder; decoder.begin(&stream); - writeToStream(&decoder, startIndex, endIndex, preserveLineBreaks); + writeToStream(&decoder, startIndex, endIndex, preserveLineBreaks, trimTrailingSpaces); decoder.end(); return result; @@ -1123,16 +1123,18 @@ bool Screen::isSelectionValid() const } void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder , - bool preserveLineBreaks) const + bool preserveLineBreaks, + bool trimTrailingSpaces) const { if (!isSelectionValid()) return; - writeToStream(decoder, _selTopLeft, _selBottomRight, preserveLineBreaks); + writeToStream(decoder, _selTopLeft, _selBottomRight, preserveLineBreaks, trimTrailingSpaces); } void Screen::writeToStream(TerminalCharacterDecoder* decoder, int startIndex, int endIndex, - bool preserveLineBreaks) const + bool preserveLineBreaks, + bool trimTrailingSpaces) const { const int top = startIndex / _columns; const int left = startIndex % _columns; @@ -1155,7 +1157,8 @@ void Screen::writeToStream(TerminalChara count, decoder, appendNewLine, - preserveLineBreaks); + preserveLineBreaks, + trimTrailingSpaces); // if the selection goes beyond the end of the last line then // append a new line character. @@ -1175,7 +1178,8 @@ int Screen::copyLineToStream(int line , int count, TerminalCharacterDecoder* decoder, bool appendNewLine, - bool preserveLineBreaks) const + bool preserveLineBreaks, + bool trimTrailingSpaces) const { //buffer to hold characters for decoding //the buffer is static to avoid initialising every @@ -1222,7 +1226,20 @@ int Screen::copyLineToStream(int line , const int screenLine = line - _history->getLines(); Character* data = _screenLines[screenLine].data(); - const int length = _screenLines[screenLine].count(); + int length = _screenLines[screenLine].count(); + + // Don't remove end spaces in lines that wrap + if (trimTrailingSpaces && !(_lineProperties[screenLine] & LINE_WRAPPED)) + { + // ignore trailing white space at the end of the line + for (int i = length-1; i >= 0; i--) + { + if (data[i].character == ' ') + length--; + else + break; + } + } //retrieve line from screen image for (int i = start; i < qMin(start + count, length); i++) { --- src/Screen.h.orig 2012-05-23 16:11:09.000000000 +0200 +++ src/Screen.h 2012-08-31 11:47:24.909539198 +0200 @@ -444,15 +444,19 @@ public: * Convenience method. Returns the currently selected text. * @param preserveLineBreaks Specifies whether new line characters should * be inserted into the returned text at the end of each terminal line. + * @param trimTrailingSpaces Specifies whether trailing spaces should be + * trimmed in the returned text. */ - QString selectedText(bool preserveLineBreaks) const; + QString selectedText(bool preserveLineBreaks, bool trimTrailingSpaces = false) const; /** * Convenience method. Returns the text from @p startIndex to @p endIndex. * @param preserveLineBreaks Specifies whether new line characters should * be inserted into the returned text at the end of each terminal line. + * @param trimTrailingSpaces Specifies whether trailing spaces should be + * trimmed in the returned text. */ - QString text(int startIndex, int endIndex, bool preserveLineBreaks) const; + QString text(int startIndex, int endIndex, bool preserveLineBreaks, bool trimTrailingSpaces = false) const; /** * Copies part of the output to a stream. @@ -470,11 +474,12 @@ public: * @param decoder A decoder which converts terminal characters into text. * PlainTextDecoder is the most commonly used decoder which converts characters * into plain text with no formatting. - * @param preserveLineBreaks Specifies whether new line characters should - * be inserted into the returned text at the end of each terminal line. + * @param trimTrailingSpaces Specifies whether trailing spaces should be + * trimmed in the returned text. */ void writeSelectionToStream(TerminalCharacterDecoder* decoder , bool - preserveLineBreaks = true) const; + preserveLineBreaks = true, + bool trimTrailingSpaces = false) const; /** * Checks if the text between from and to is inside the current @@ -593,7 +598,8 @@ private: int count, TerminalCharacterDecoder* decoder, bool appendNewLine, - bool preserveLineBreaks) const; + bool preserveLineBreaks, + bool trimTrailingSpaces) const; //fills a section of the screen image with the character 'c' //the parameters are specified as offsets from the start of the screen image. @@ -625,7 +631,7 @@ private: // copies text from 'startIndex' to 'endIndex' to a stream // startIndex and endIndex are positions generated using the loc(x,y) macro void writeToStream(TerminalCharacterDecoder* decoder, int startIndex, - int endIndex, bool preserveLineBreaks = true) const; + int endIndex, bool preserveLineBreaks = true, bool trimTrailingSpaces = false) const; // copies 'count' lines from the screen buffer into 'dest', // starting from 'startLine', where 0 is the first line in the screen buffer void copyFromScreen(Character* dest, int startLine, int count) const; --- src/ScreenWindow.cpp.orig 2012-06-19 23:54:21.000000000 +0200 +++ src/ScreenWindow.cpp 2012-08-31 11:26:56.673512569 +0200 @@ -117,9 +117,9 @@ QVector<LineProperty> ScreenWindow::getL return result; } -QString ScreenWindow::selectedText(bool preserveLineBreaks) const +QString ScreenWindow::selectedText(bool preserveLineBreaks, bool trimTrailingSpaces) const { - return _screen->selectedText(preserveLineBreaks); + return _screen->selectedText(preserveLineBreaks, trimTrailingSpaces); } void ScreenWindow::getSelectionStart(int& column , int& line) --- src/ScreenWindow.h.orig 2012-05-23 02:29:12.000000000 +0200 +++ src/ScreenWindow.h 2012-08-31 11:26:56.673512569 +0200 @@ -222,8 +222,9 @@ public: * Returns the text which is currently selected. * * @param preserveLineBreaks See Screen::selectedText() + * @param trimTrailingSpaces See Screen::selectedText() */ - QString selectedText(bool preserveLineBreaks) const; + QString selectedText(bool preserveLineBreaks, bool trimTrailingSpaces = false) const; public slots: /** --- src/TerminalDisplay.cpp.orig 2012-06-24 17:48:37.000000000 +0200 +++ src/TerminalDisplay.cpp 2012-08-31 13:51:47.399586346 +0200 @@ -327,6 +327,7 @@ TerminalDisplay::TerminalDisplay(QWidget , _cursorShape(Enum::BlockCursor) , _antialiasText(true) , _sessionController(0) + , _trimTrailingSpaces(false) { // terminal applications are not designed with Right-To-Left in mind, // so the layout is forced to Left-To-Right @@ -2521,7 +2522,7 @@ void TerminalDisplay::copyToX11Selection if (!_screenWindow) return; - QString text = _screenWindow->selectedText(_preserveLineBreaks); + QString text = _screenWindow->selectedText(_preserveLineBreaks, _trimTrailingSpaces); if (text.isEmpty()) return; @@ -2536,7 +2537,7 @@ void TerminalDisplay::copyToClipboard() if (!_screenWindow) return; - QString text = _screenWindow->selectedText(_preserveLineBreaks); + QString text = _screenWindow->selectedText(_preserveLineBreaks, _trimTrailingSpaces); if (text.isEmpty()) return; --- src/TerminalDisplay.h.orig 2012-05-23 02:29:12.000000000 +0200 +++ src/TerminalDisplay.h 2012-08-31 11:45:24.207048186 +0200 @@ -181,6 +181,20 @@ public: return _underlineLinks; } + /** + * Sets whether trailing spaces should be trimmed in selected text. + */ + void setTrimTrailingSpaces(bool enabled) { + _trimTrailingSpaces = enabled; + } + + /** + * Returns true if trailing spaces should be trimmed in selected text. + */ + bool trimTrailingSpaces() const { + return _trimTrailingSpaces; + } + void setLineSpacing(uint); uint lineSpacing() const; @@ -818,6 +832,9 @@ private: static const int DEFAULT_TOP_MARGIN = 1; SessionController* _sessionController; + + bool _trimTrailingSpaces; // trim trailing spaces in selected text + friend class TerminalDisplayAccessible; }; --- src/ViewManager.cpp.orig 2012-06-05 10:54:14.000000000 +0200 +++ src/ViewManager.cpp 2012-08-31 11:33:08.315038762 +0200 @@ -804,6 +804,7 @@ void ViewManager::applyProfileToView(Ter view->setAutoCopySelectedText(profile->autoCopySelectedText()); view->setUnderlineLinks(profile->underlineLinksEnabled()); view->setBidiEnabled(profile->bidiRenderingEnabled()); + view->setTrimTrailingSpaces(profile->property<bool>(Profile::TrimTrailingSpacesInSelectedText)); int middleClickPasteMode = profile->property<int>(Profile::MiddleClickPasteMode); if (middleClickPasteMode == Enum::PasteFromX11Selection)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor