| 1 | /* |
| 2 | This file is part of Konsole, an X terminal. |
| 3 | |
| 4 | Copyright 2007-2008 by Robert Knight <[email protected]> |
| 5 | Copyright 1997,1998 by Lars Doelle <[email protected]> |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 20 | 02110-1301 USA. |
| 21 | */ |
| 22 | |
| 23 | // Own |
| 24 | #include "Screen.h"cxx . . $ `<file>/lib/Screen.h`/ |
| 25 | |
| 26 | // Standard |
| 27 | #include <cstdio> |
| 28 | #include <cstdlib> |
| 29 | #include <unistd.h> |
| 30 | #include <cstring> |
| 31 | #include <cctype> |
| 32 | |
| 33 | // Qt |
| 34 | #include <QTextStream> |
| 35 | #include <QDate> |
| 36 | |
| 37 | // KDE |
| 38 | //#include <kdebug.h> |
| 39 | |
| 40 | // Konsole |
| 41 | #include "konsole_wcwidth.h"cxx . . $ `<file>/lib/konsole_wcwidth.h`/ |
| 42 | #include "TerminalCharacterDecoder.h"cxx . . $ `<file>/lib/TerminalCharacterDecoder.h`/ |
| 43 | |
| 44 | using namespace Konsole; |
| 45 | |
| 46 | //FIXME: this is emulation specific. Use false for xterm, true for ANSI. |
| 47 | //FIXME: see if we can get this from terminfo. |
| 48 | #define BS_CLEARScxx . . $ `lib/Screen.cpp:48:9`! false |
| 49 | |
| 50 | //Macro to convert x,y position on screen to position within an image. |
| 51 | // |
| 52 | //Originally the image was stored as one large contiguous block of |
| 53 | //memory, so a position within the image could be represented as an |
| 54 | //offset from the beginning of the block. For efficiency reasons this |
| 55 | //is no longer the case. |
| 56 | //Many internal parts of this class still use this representation for parameters and so on, |
| 57 | //notably moveImage() and clearImage(). |
| 58 | //This macro converts from an X,Y position into an image offset. |
| 59 | #ifndef loc |
| 60 | #define loccxx . . $ `lib/Screen.cpp:60:9`!(X,Y) ((Y)*columns+(X)) |
| 61 | #endif |
| 62 | |
| 63 | |
| 64 | Charactercxx . . $ Konsole/Character# Screencxx . . $ Konsole/Screen#::defaultCharcxx . . $ Konsole/Screen#defaultChar. = Charactercxx . . $ Konsole/Character#Character(775c6e5ba34caf00).(' ', |
| 65 | CharacterColorcxx . . $ Konsole/CharacterColor#CharacterColor(d5cb1b1d97598ec6).(COLOR_SPACE_DEFAULTcxx . . $ `lib/CharacterColor.h:130:9`!,DEFAULT_FORE_COLORcxx . . $ `lib/CharacterColor.h:105:9`!), |
| 66 | CharacterColorcxx . . $ Konsole/CharacterColor#CharacterColor(d5cb1b1d97598ec6).(COLOR_SPACE_DEFAULTcxx . . $ `lib/CharacterColor.h:130:9`!,DEFAULT_BACK_COLORcxx . . $ `lib/CharacterColor.h:106:9`!), |
| 67 | DEFAULT_RENDITIONcxx . . $ `lib/Character.h:42:9`!); |
| 68 | |
| 69 | //#define REVERSE_WRAPPED_LINES // for wrapped line debug |
| 70 | |
| 71 | Screencxx . . $ Konsole/Screen#::Screencxx . . $ Konsole/Screen#Screen(3e454b8ccf442868).(int l, int c) |
| 72 | : linescxx . . $ Konsole/Screen#lines.(l), |
| 73 | columnscxx . . $ Konsole/Screen#columns.(c), |
| 74 | screenLinescxx . . $ Konsole/Screen#screenLines.(new ImageLinecxx . . $ Konsole/Screen#ImageLine#[linescxx . . $ Konsole/Screen#lines.+1] ), |
| 75 | _scrolledLinescxx . . $ Konsole/Screen#_scrolledLines.(0), |
| 76 | _droppedLinescxx . . $ Konsole/Screen#_droppedLines.(0), |
| 77 | historycxx . . $ Konsole/Screen#history.(new HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#()), |
| 78 | cuXcxx . . $ Konsole/Screen#cuX.(0), cuYcxx . . $ Konsole/Screen#cuY.(0), |
| 79 | currentRenditioncxx . . $ Konsole/Screen#currentRendition.(0), |
| 80 | _topMargincxx . . $ Konsole/Screen#_topMargin.(0), _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.(0), |
| 81 | selBegincxx . . $ Konsole/Screen#selBegin.(0), selTopLeftcxx . . $ Konsole/Screen#selTopLeft.(0), selBottomRightcxx . . $ Konsole/Screen#selBottomRight.(0), |
| 82 | blockSelectionModecxx . . $ Konsole/Screen#blockSelectionMode.(false), |
| 83 | effectiveForegroundcxx . . $ Konsole/Screen#effectiveForeground.(CharacterColorcxx . . $ Konsole/CharacterColor#CharacterColor(49f6e7a06ebc5aa8).()), effectiveBackgroundcxx . . $ Konsole/Screen#effectiveBackground.(CharacterColorcxx . . $ Konsole/CharacterColor#CharacterColor(49f6e7a06ebc5aa8).()), effectiveRenditioncxx . . $ Konsole/Screen#effectiveRendition.(0), |
| 84 | lastPoscxx . . $ Konsole/Screen#lastPos.(-1) |
| 85 | { |
| 86 | linePropertiescxx . . $ Konsole/Screen#lineProperties..resizecxx . . $ QVarLengthArray#resize(d4f767463ce0a6b3).(linescxx . . $ Konsole/Screen#lines.+1); |
| 87 | for (int i=0;i<linescxx . . $ Konsole/Screen#lines.+1;i++) |
| 88 | linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).i]=LINE_DEFAULTcxx . . $ Konsole/LINE_DEFAULT.; |
| 89 | |
| 90 | initTabStopscxx . . $ Konsole/Screen#initTabStops(49f6e7a06ebc5aa8).(); |
| 91 | clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).(); |
| 92 | resetcxx . . $ Konsole/Screen#reset(b45ddcbc8423892c).(); |
| 93 | } |
| 94 | |
| 95 | /*! Destructor |
| 96 | */ |
| 97 | |
| 98 | Screencxx . . $ Konsole/Screen#::~cxx . . $ Konsole/Screen#`~Screen`(ced63f7c635d850d).Screencxx . . $ Konsole/Screen#() |
| 99 | { |
| 100 | delete[] screenLinescxx . . $ Konsole/Screen#screenLines.; |
| 101 | delete historycxx . . $ Konsole/Screen#history.; |
| 102 | } |
| 103 | |
| 104 | void Screencxx . . $ Konsole/Screen#::cursorUpcxx . . $ Konsole/Screen#cursorUp(d4f767463ce0a6b3).(int n) |
| 105 | //=CUU |
| 106 | { |
| 107 | if (n == 0) n = 1; // Default |
| 108 | int stop = cuYcxx . . $ Konsole/Screen#cuY. < _topMargincxx . . $ Konsole/Screen#_topMargin. ? 0 : _topMargincxx . . $ Konsole/Screen#_topMargin.; |
| 109 | cuXcxx . . $ Konsole/Screen#cuX. = qMincxx . . $ qMin(2a338fce5842aa6a).(columnscxx . . $ Konsole/Screen#columns.-1,cuXcxx . . $ Konsole/Screen#cuX.); // nowrap! |
| 110 | cuYcxx . . $ Konsole/Screen#cuY. = qMaxcxx . . $ qMax(2a338fce5842aa6a).(stop,cuYcxx . . $ Konsole/Screen#cuY.-n); |
| 111 | } |
| 112 | |
| 113 | void Screencxx . . $ Konsole/Screen#::cursorDowncxx . . $ Konsole/Screen#cursorDown(d4f767463ce0a6b3).(int n) |
| 114 | //=CUD |
| 115 | { |
| 116 | if (n == 0) n = 1; // Default |
| 117 | int stop = cuYcxx . . $ Konsole/Screen#cuY. > _bottomMargincxx . . $ Konsole/Screen#_bottomMargin. ? linescxx . . $ Konsole/Screen#lines.-1 : _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.; |
| 118 | cuXcxx . . $ Konsole/Screen#cuX. = qMincxx . . $ qMin(2a338fce5842aa6a).(columnscxx . . $ Konsole/Screen#columns.-1,cuXcxx . . $ Konsole/Screen#cuX.); // nowrap! |
| 119 | cuYcxx . . $ Konsole/Screen#cuY. = qMincxx . . $ qMin(2a338fce5842aa6a).(stop,cuYcxx . . $ Konsole/Screen#cuY.+n); |
| 120 | } |
| 121 | |
| 122 | void Screencxx . . $ Konsole/Screen#::cursorLeftcxx . . $ Konsole/Screen#cursorLeft(d4f767463ce0a6b3).(int n) |
| 123 | //=CUB |
| 124 | { |
| 125 | if (n == 0) n = 1; // Default |
| 126 | cuXcxx . . $ Konsole/Screen#cuX. = qMincxx . . $ qMin(2a338fce5842aa6a).(columnscxx . . $ Konsole/Screen#columns.-1,cuXcxx . . $ Konsole/Screen#cuX.); // nowrap! |
| 127 | cuXcxx . . $ Konsole/Screen#cuX. = qMaxcxx . . $ qMax(2a338fce5842aa6a).(0,cuXcxx . . $ Konsole/Screen#cuX.-n); |
| 128 | } |
| 129 | |
| 130 | void Screencxx . . $ Konsole/Screen#::cursorRightcxx . . $ Konsole/Screen#cursorRight(d4f767463ce0a6b3).(int n) |
| 131 | //=CUF |
| 132 | { |
| 133 | if (n == 0) n = 1; // Default |
| 134 | cuXcxx . . $ Konsole/Screen#cuX. = qMincxx . . $ qMin(2a338fce5842aa6a).(columnscxx . . $ Konsole/Screen#columns.-1,cuXcxx . . $ Konsole/Screen#cuX.+n); |
| 135 | } |
| 136 | |
| 137 | void Screencxx . . $ Konsole/Screen#::setMarginscxx . . $ Konsole/Screen#setMargins(3e454b8ccf442868).(int top, int bot) |
| 138 | //=STBM |
| 139 | { |
| 140 | if (top == 0) top = 1; // Default |
| 141 | if (bot == 0) bot = linescxx . . $ Konsole/Screen#lines.; // Default |
| 142 | top = top - 1; // Adjust to internal lineno |
| 143 | bot = bot - 1; // Adjust to internal lineno |
| 144 | if ( !( 0 <= top && top < bot && bot < linescxx . . $ Konsole/Screen#lines. ) ) |
| 145 | { //Debug()<<" setRegion("<<top<<","<<bot<<") : bad range."; |
| 146 | return; // Default error action: ignore |
| 147 | } |
| 148 | _topMargincxx . . $ Konsole/Screen#_topMargin. = top; |
| 149 | _bottomMargincxx . . $ Konsole/Screen#_bottomMargin. = bot; |
| 150 | cuXcxx . . $ Konsole/Screen#cuX. = 0; |
| 151 | cuYcxx . . $ Konsole/Screen#cuY. = getModecxx . . $ Konsole/Screen#getMode(4a668f6de69bf818).(MODE_Origincxx . . $ `lib/Screen.h:35:9`!) ? top : 0; |
| 152 | |
| 153 | } |
| 154 | |
| 155 | int Screencxx . . $ Konsole/Screen#::topMargincxx . . $ Konsole/Screen#topMargin(455f465bc33b4cdf).() const |
| 156 | { |
| 157 | return _topMargincxx . . $ Konsole/Screen#_topMargin.; |
| 158 | } |
| 159 | int Screencxx . . $ Konsole/Screen#::bottomMargincxx . . $ Konsole/Screen#bottomMargin(455f465bc33b4cdf).() const |
| 160 | { |
| 161 | return _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.; |
| 162 | } |
| 163 | |
| 164 | void Screencxx . . $ Konsole/Screen#::indexcxx . . $ Konsole/Screen#index(49f6e7a06ebc5aa8).() |
| 165 | //=IND |
| 166 | { |
| 167 | if (cuYcxx . . $ Konsole/Screen#cuY. == _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.) |
| 168 | scrollUpcxx . . $ Konsole/Screen#scrollUp(d4f767463ce0a6b3).(1); |
| 169 | else if (cuYcxx . . $ Konsole/Screen#cuY. < linescxx . . $ Konsole/Screen#lines.-1) |
| 170 | cuYcxx . . $ Konsole/Screen#cuY. += 1; |
| 171 | } |
| 172 | |
| 173 | void Screencxx . . $ Konsole/Screen#::reverseIndexcxx . . $ Konsole/Screen#reverseIndex(49f6e7a06ebc5aa8).() |
| 174 | //=RI |
| 175 | { |
| 176 | if (cuYcxx . . $ Konsole/Screen#cuY. == _topMargincxx . . $ Konsole/Screen#_topMargin.) |
| 177 | scrollDowncxx . . $ Konsole/Screen#scrollDown(3e454b8ccf442868).(_topMargincxx . . $ Konsole/Screen#_topMargin.,1); |
| 178 | else if (cuYcxx . . $ Konsole/Screen#cuY. > 0) |
| 179 | cuYcxx . . $ Konsole/Screen#cuY. -= 1; |
| 180 | } |
| 181 | |
| 182 | void Screencxx . . $ Konsole/Screen#::nextLinecxx . . $ Konsole/Screen#nextLine(49f6e7a06ebc5aa8).() |
| 183 | //=NEL |
| 184 | { |
| 185 | toStartOfLinecxx . . $ Konsole/Screen#toStartOfLine(49f6e7a06ebc5aa8).(); indexcxx . . $ Konsole/Screen#index(49f6e7a06ebc5aa8).(); |
| 186 | } |
| 187 | |
| 188 | void Screencxx . . $ Konsole/Screen#::eraseCharscxx . . $ Konsole/Screen#eraseChars(d4f767463ce0a6b3).(int n) |
| 189 | { |
| 190 | if (n == 0) n = 1; // Default |
| 191 | int p = qMaxcxx . . $ qMax(2a338fce5842aa6a).(0,qMincxx . . $ qMin(2a338fce5842aa6a).(cuXcxx . . $ Konsole/Screen#cuX.+n-1,columnscxx . . $ Konsole/Screen#columns.-1)); |
| 192 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(cuX,cuY),loccxx . . $ `lib/Screen.cpp:60:9`!(p,cuY),' '); |
| 193 | } |
| 194 | |
| 195 | void Screencxx . . $ Konsole/Screen#::deleteCharscxx . . $ Konsole/Screen#deleteChars(d4f767463ce0a6b3).(int n) |
| 196 | { |
| 197 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( n >= 0 ); |
| 198 | |
| 199 | // always delete at least one char |
| 200 | if (n == 0) |
| 201 | n = 1; |
| 202 | |
| 203 | // if cursor is beyond the end of the line there is nothing to do |
| 204 | if ( cuXcxx . . $ Konsole/Screen#cuX. >= screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].countcxx . . $ QVector#count(455f465bc33b4cdf).() ) |
| 205 | return; |
| 206 | |
| 207 | if ( cuXcxx . . $ Konsole/Screen#cuX.+n > screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].countcxx . . $ QVector#count(455f465bc33b4cdf).() ) |
| 208 | n = screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].countcxx . . $ QVector#count(455f465bc33b4cdf).() - cuXcxx . . $ Konsole/Screen#cuX.; |
| 209 | |
| 210 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( n >= 0 ); |
| 211 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( cuX+n <= screenLines[cuY].count() ); |
| 212 | |
| 213 | screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].removecxx . . $ QVector#remove(3e454b8ccf442868).(cuXcxx . . $ Konsole/Screen#cuX.,n); |
| 214 | } |
| 215 | |
| 216 | void Screencxx . . $ Konsole/Screen#::insertCharscxx . . $ Konsole/Screen#insertChars(d4f767463ce0a6b3).(int n) |
| 217 | { |
| 218 | if (n == 0) n = 1; // Default |
| 219 | |
| 220 | if ( screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].sizecxx . . $ QVector#size(455f465bc33b4cdf).() < cuXcxx . . $ Konsole/Screen#cuX. ) |
| 221 | screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].resizecxx . . $ QVector#resize(d4f767463ce0a6b3).(cuXcxx . . $ Konsole/Screen#cuX.); |
| 222 | |
| 223 | screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].insertcxx . . $ QVector#insert(27ccd024c49f7d7f).(cuXcxx . . $ Konsole/Screen#cuX.,n,' 'cxx . . $ Konsole/Character#Character(775c6e5ba34caf00).); |
| 224 | |
| 225 | if ( screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].countcxx . . $ QVector#count(455f465bc33b4cdf).() > columnscxx . . $ Konsole/Screen#columns. ) |
| 226 | screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].resizecxx . . $ QVector#resize(d4f767463ce0a6b3).(columnscxx . . $ Konsole/Screen#columns.); |
| 227 | } |
| 228 | |
| 229 | void Screencxx . . $ Konsole/Screen#::repeatCharscxx . . $ Konsole/Screen#repeatChars(d4f767463ce0a6b3).(int count) |
| 230 | //=REP |
| 231 | { |
| 232 | if (count == 0) |
| 233 | { |
| 234 | count = 1; |
| 235 | } |
| 236 | /** |
| 237 | * From ECMA-48 version 5, section 8.3.103 |
| 238 | * If the character preceding REP is a control function or part of a |
| 239 | * control function, the effect of REP is not defined by this Standard. |
| 240 | * |
| 241 | * So, a "normal" program should always use REP immediately after a visible |
| 242 | * character (those other than escape sequences). So, lastDrawnChar can be |
| 243 | * safely used. |
| 244 | */ |
| 245 | for (int i = 0; i < count; i++) |
| 246 | { |
| 247 | displayCharactercxx . . $ Konsole/Screen#displayCharacter(d461ae26ddb24b42).(lastDrawnCharcxx . . $ Konsole/Screen#lastDrawnChar.); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | void Screencxx . . $ Konsole/Screen#::deleteLinescxx . . $ Konsole/Screen#deleteLines(d4f767463ce0a6b3).(int n) |
| 252 | { |
| 253 | if (n == 0) n = 1; // Default |
| 254 | scrollUpcxx . . $ Konsole/Screen#scrollUp(3e454b8ccf442868).(cuYcxx . . $ Konsole/Screen#cuY.,n); |
| 255 | } |
| 256 | |
| 257 | void Screencxx . . $ Konsole/Screen#::insertLinescxx . . $ Konsole/Screen#insertLines(d4f767463ce0a6b3).(int n) |
| 258 | { |
| 259 | if (n == 0) n = 1; // Default |
| 260 | scrollDowncxx . . $ Konsole/Screen#scrollDown(3e454b8ccf442868).(cuYcxx . . $ Konsole/Screen#cuY.,n); |
| 261 | } |
| 262 | |
| 263 | void Screencxx . . $ Konsole/Screen#::setModecxx . . $ Konsole/Screen#setMode(d4f767463ce0a6b3).(int m) |
| 264 | { |
| 265 | currentModescxx . . $ Konsole/Screen#currentModes.[m] = true; |
| 266 | switch(m) |
| 267 | { |
| 268 | case MODE_Origincxx . . $ `lib/Screen.h:35:9`! : cuXcxx . . $ Konsole/Screen#cuX. = 0; cuYcxx . . $ Konsole/Screen#cuY. = _topMargincxx . . $ Konsole/Screen#_topMargin.; break; //FIXME: home |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | void Screencxx . . $ Konsole/Screen#::resetModecxx . . $ Konsole/Screen#resetMode(d4f767463ce0a6b3).(int m) |
| 273 | { |
| 274 | currentModescxx . . $ Konsole/Screen#currentModes.[m] = false; |
| 275 | switch(m) |
| 276 | { |
| 277 | case MODE_Origincxx . . $ `lib/Screen.h:35:9`! : cuXcxx . . $ Konsole/Screen#cuX. = 0; cuYcxx . . $ Konsole/Screen#cuY. = 0; break; //FIXME: home |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | void Screencxx . . $ Konsole/Screen#::saveModecxx . . $ Konsole/Screen#saveMode(d4f767463ce0a6b3).(int m) |
| 282 | { |
| 283 | savedModescxx . . $ Konsole/Screen#savedModes.[m] = currentModescxx . . $ Konsole/Screen#currentModes.[m]; |
| 284 | } |
| 285 | |
| 286 | void Screencxx . . $ Konsole/Screen#::restoreModecxx . . $ Konsole/Screen#restoreMode(d4f767463ce0a6b3).(int m) |
| 287 | { |
| 288 | currentModescxx . . $ Konsole/Screen#currentModes.[m] = savedModescxx . . $ Konsole/Screen#savedModes.[m]; |
| 289 | } |
| 290 | |
| 291 | bool Screencxx . . $ Konsole/Screen#::getModecxx . . $ Konsole/Screen#getMode(4a668f6de69bf818).(int m) const |
| 292 | { |
| 293 | return currentModescxx . . $ Konsole/Screen#currentModes.[m]; |
| 294 | } |
| 295 | |
| 296 | void Screencxx . . $ Konsole/Screen#::saveCursorcxx . . $ Konsole/Screen#saveCursor(49f6e7a06ebc5aa8).() |
| 297 | { |
| 298 | savedStatecxx . . $ Konsole/Screen#savedState..cursorColumncxx . . $ Konsole/Screen#SavedState#cursorColumn. = cuXcxx . . $ Konsole/Screen#cuX.; |
| 299 | savedStatecxx . . $ Konsole/Screen#savedState..cursorLinecxx . . $ Konsole/Screen#SavedState#cursorLine. = cuYcxx . . $ Konsole/Screen#cuY.; |
| 300 | savedStatecxx . . $ Konsole/Screen#savedState..renditioncxx . . $ Konsole/Screen#SavedState#rendition. = currentRenditioncxx . . $ Konsole/Screen#currentRendition.; |
| 301 | savedStatecxx . . $ Konsole/Screen#savedState..foregroundcxx . . $ Konsole/Screen#SavedState#foreground. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). currentForegroundcxx . . $ Konsole/Screen#currentForeground.; |
| 302 | savedStatecxx . . $ Konsole/Screen#savedState..backgroundcxx . . $ Konsole/Screen#SavedState#background. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). currentBackgroundcxx . . $ Konsole/Screen#currentBackground.; |
| 303 | } |
| 304 | |
| 305 | void Screencxx . . $ Konsole/Screen#::restoreCursorcxx . . $ Konsole/Screen#restoreCursor(49f6e7a06ebc5aa8).() |
| 306 | { |
| 307 | cuXcxx . . $ Konsole/Screen#cuX. = qMincxx . . $ qMin(2a338fce5842aa6a).(savedStatecxx . . $ Konsole/Screen#savedState..cursorColumncxx . . $ Konsole/Screen#SavedState#cursorColumn.,columnscxx . . $ Konsole/Screen#columns.-1); |
| 308 | cuYcxx . . $ Konsole/Screen#cuY. = qMincxx . . $ qMin(2a338fce5842aa6a).(savedStatecxx . . $ Konsole/Screen#savedState..cursorLinecxx . . $ Konsole/Screen#SavedState#cursorLine.,linescxx . . $ Konsole/Screen#lines.-1); |
| 309 | currentRenditioncxx . . $ Konsole/Screen#currentRendition. = savedStatecxx . . $ Konsole/Screen#savedState..renditioncxx . . $ Konsole/Screen#SavedState#rendition.; |
| 310 | currentForegroundcxx . . $ Konsole/Screen#currentForeground. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). savedStatecxx . . $ Konsole/Screen#savedState..foregroundcxx . . $ Konsole/Screen#SavedState#foreground.; |
| 311 | currentBackgroundcxx . . $ Konsole/Screen#currentBackground. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). savedStatecxx . . $ Konsole/Screen#savedState..backgroundcxx . . $ Konsole/Screen#SavedState#background.; |
| 312 | updateEffectiveRenditioncxx . . $ Konsole/Screen#updateEffectiveRendition(49f6e7a06ebc5aa8).(); |
| 313 | } |
| 314 | |
| 315 | void Screencxx . . $ Konsole/Screen#::resizeImagecxx . . $ Konsole/Screen#resizeImage(3e454b8ccf442868).(int new_lines, int new_columns) |
| 316 | { |
| 317 | if ((new_lines==linescxx . . $ Konsole/Screen#lines.) && (new_columns==columnscxx . . $ Konsole/Screen#columns.)) return; |
| 318 | |
| 319 | if (cuYcxx . . $ Konsole/Screen#cuY. > new_lines-1) |
| 320 | { // attempt to preserve focus and lines |
| 321 | _bottomMargincxx . . $ Konsole/Screen#_bottomMargin. = linescxx . . $ Konsole/Screen#lines.-1; //FIXME: margin lost |
| 322 | for (int i = 0; i < cuYcxx . . $ Konsole/Screen#cuY.-(new_lines-1); i++) |
| 323 | { |
| 324 | addHistLinecxx . . $ Konsole/Screen#addHistLine(49f6e7a06ebc5aa8).(); scrollUpcxx . . $ Konsole/Screen#scrollUp(3e454b8ccf442868).(0,1); |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | // create new screen lines and copy from old to new |
| 329 | |
| 330 | ImageLinecxx . . $ Konsole/Screen#ImageLine#* newScreenLines = new ImageLinecxx . . $ Konsole/Screen#ImageLine#[new_lines+1]; |
| 331 | for (int i=0; i < qMincxx . . $ qMin(2a338fce5842aa6a).(linescxx . . $ Konsole/Screen#lines.,new_lines+1) ;i++) |
| 332 | newScreenLines[i]=cxx . . $ QVector#`operator=`(c90ab23731af0b5e).screenLinescxx . . $ Konsole/Screen#screenLines.[i]; |
| 333 | for (int i=linescxx . . $ Konsole/Screen#lines.;(i > 0) && (i<new_lines+1);i++) |
| 334 | newScreenLines[i].resizecxx . . $ QVector#resize(d4f767463ce0a6b3).( new_columns ); |
| 335 | |
| 336 | linePropertiescxx . . $ Konsole/Screen#lineProperties..resizecxx . . $ QVarLengthArray#resize(d4f767463ce0a6b3).(new_lines+1); |
| 337 | for (int i=linescxx . . $ Konsole/Screen#lines.;(i > 0) && (i<new_lines+1);i++) |
| 338 | linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).i] = LINE_DEFAULTcxx . . $ Konsole/LINE_DEFAULT.; |
| 339 | |
| 340 | clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).(); |
| 341 | |
| 342 | delete[] screenLinescxx . . $ Konsole/Screen#screenLines.; |
| 343 | screenLinescxx . . $ Konsole/Screen#screenLines. = newScreenLines; |
| 344 | |
| 345 | linescxx . . $ Konsole/Screen#lines. = new_lines; |
| 346 | columnscxx . . $ Konsole/Screen#columns. = new_columns; |
| 347 | cuXcxx . . $ Konsole/Screen#cuX. = qMincxx . . $ qMin(2a338fce5842aa6a).(cuXcxx . . $ Konsole/Screen#cuX.,columnscxx . . $ Konsole/Screen#columns.-1); |
| 348 | cuYcxx . . $ Konsole/Screen#cuY. = qMincxx . . $ qMin(2a338fce5842aa6a).(cuYcxx . . $ Konsole/Screen#cuY.,linescxx . . $ Konsole/Screen#lines.-1); |
| 349 | |
| 350 | // FIXME: try to keep values, evtl. |
| 351 | _topMargincxx . . $ Konsole/Screen#_topMargin.=0; |
| 352 | _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.=linescxx . . $ Konsole/Screen#lines.-1; |
| 353 | initTabStopscxx . . $ Konsole/Screen#initTabStops(49f6e7a06ebc5aa8).(); |
| 354 | clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).(); |
| 355 | } |
| 356 | |
| 357 | void Screencxx . . $ Konsole/Screen#::setDefaultMarginscxx . . $ Konsole/Screen#setDefaultMargins(49f6e7a06ebc5aa8).() |
| 358 | { |
| 359 | _topMargincxx . . $ Konsole/Screen#_topMargin. = 0; |
| 360 | _bottomMargincxx . . $ Konsole/Screen#_bottomMargin. = linescxx . . $ Konsole/Screen#lines.-1; |
| 361 | } |
| 362 | |
| 363 | |
| 364 | /* |
| 365 | Clarifying rendition here and in the display. |
| 366 | |
| 367 | currently, the display's color table is |
| 368 | 0 1 2 .. 9 10 .. 17 |
| 369 | dft_fg, dft_bg, dim 0..7, intensive 0..7 |
| 370 | |
| 371 | currentForeground, currentBackground contain values 0..8; |
| 372 | - 0 = default color |
| 373 | - 1..8 = ansi specified color |
| 374 | |
| 375 | re_fg, re_bg contain values 0..17 |
| 376 | due to the TerminalDisplay's color table |
| 377 | |
| 378 | rendition attributes are |
| 379 | |
| 380 | attr widget screen |
| 381 | -------------- ------ ------ |
| 382 | RE_UNDERLINE XX XX affects foreground only |
| 383 | RE_BLINK XX XX affects foreground only |
| 384 | RE_BOLD XX XX affects foreground only |
| 385 | RE_REVERSE -- XX |
| 386 | RE_TRANSPARENT XX -- affects background only |
| 387 | RE_INTENSIVE XX -- affects foreground only |
| 388 | |
| 389 | Note that RE_BOLD is used in both widget |
| 390 | and screen rendition. Since xterm/vt102 |
| 391 | is to poor to distinguish between bold |
| 392 | (which is a font attribute) and intensive |
| 393 | (which is a color attribute), we translate |
| 394 | this and RE_BOLD in falls eventually appart |
| 395 | into RE_BOLD and RE_INTENSIVE. |
| 396 | */ |
| 397 | |
| 398 | void Screencxx . . $ Konsole/Screen#::reverseRenditioncxx . . $ Konsole/Screen#reverseRendition(31b3f8629508dc53).(Charactercxx . . $ Konsole/Character#& p) const |
| 399 | { |
| 400 | CharacterColorcxx . . $ Konsole/CharacterColor# f = p.foregroundColorcxx . . $ Konsole/Character#foregroundColor.; |
| 401 | CharacterColorcxx . . $ Konsole/CharacterColor# b = p.backgroundColorcxx . . $ Konsole/Character#backgroundColor.; |
| 402 | |
| 403 | p.foregroundColorcxx . . $ Konsole/Character#foregroundColor. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). b; |
| 404 | p.backgroundColorcxx . . $ Konsole/Character#backgroundColor. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). f; //p->r &= ~RE_TRANSPARENT; |
| 405 | } |
| 406 | |
| 407 | void Screencxx . . $ Konsole/Screen#::updateEffectiveRenditioncxx . . $ Konsole/Screen#updateEffectiveRendition(49f6e7a06ebc5aa8).() |
| 408 | { |
| 409 | effectiveRenditioncxx . . $ Konsole/Screen#effectiveRendition. = currentRenditioncxx . . $ Konsole/Screen#currentRendition.; |
| 410 | if (currentRenditioncxx . . $ Konsole/Screen#currentRendition. & RE_REVERSEcxx . . $ `lib/Character.h:46:9`!) |
| 411 | { |
| 412 | effectiveForegroundcxx . . $ Konsole/Screen#effectiveForeground. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). currentBackgroundcxx . . $ Konsole/Screen#currentBackground.; |
| 413 | effectiveBackgroundcxx . . $ Konsole/Screen#effectiveBackground. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). currentForegroundcxx . . $ Konsole/Screen#currentForeground.; |
| 414 | } |
| 415 | else |
| 416 | { |
| 417 | effectiveForegroundcxx . . $ Konsole/Screen#effectiveForeground. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). currentForegroundcxx . . $ Konsole/Screen#currentForeground.; |
| 418 | effectiveBackgroundcxx . . $ Konsole/Screen#effectiveBackground. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). currentBackgroundcxx . . $ Konsole/Screen#currentBackground.; |
| 419 | } |
| 420 | |
| 421 | if (currentRenditioncxx . . $ Konsole/Screen#currentRendition. & RE_BOLDcxx . . $ `lib/Character.h:43:9`!) |
| 422 | effectiveForegroundcxx . . $ Konsole/Screen#effectiveForeground..setIntensivecxx . . $ Konsole/CharacterColor#setIntensive(49f6e7a06ebc5aa8).(); |
| 423 | } |
| 424 | |
| 425 | void Screencxx . . $ Konsole/Screen#::copyFromHistorycxx . . $ Konsole/Screen#copyFromHistory(9c69629908ec0d62).(Charactercxx . . $ Konsole/Character#* dest, int startLine, int count) const |
| 426 | { |
| 427 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( startLine >= 0 && count > 0 && startLine + count <= history->getLines() ); |
| 428 | |
| 429 | for (int line = startLine; line < startLine + count; line++) |
| 430 | { |
| 431 | const int length = qMincxx . . $ qMin(2a338fce5842aa6a).(columnscxx . . $ Konsole/Screen#columns.,historycxx . . $ Konsole/Screen#history.->getLineLencxx . . $ Konsole/HistoryScroll#getLineLen(7864480464b09eea).(line)); |
| 432 | const int destLineOffset = (line-startLine)*columnscxx . . $ Konsole/Screen#columns.; |
| 433 | |
| 434 | historycxx . . $ Konsole/Screen#history.->getCellscxx . . $ Konsole/HistoryScroll#getCells(ecb57fcf9e39244).(line,0,length,dest + destLineOffset); |
| 435 | |
| 436 | for (int column = length; column < columnscxx . . $ Konsole/Screen#columns.; column++) |
| 437 | dest[destLineOffset+column] =cxx . . $ Konsole/Character#`operator=`(2e86fbf6b92c0a89). defaultCharcxx . . $ Konsole/Screen#defaultChar.; |
| 438 | |
| 439 | // invert selected text |
| 440 | if (selBegincxx . . $ Konsole/Screen#selBegin. !=-1) |
| 441 | { |
| 442 | for (int column = 0; column < columnscxx . . $ Konsole/Screen#columns.; column++) |
| 443 | { |
| 444 | if (isSelectedcxx . . $ Konsole/Screen#isSelected(88e30549ca55c866).(column,line)) |
| 445 | { |
| 446 | reverseRenditioncxx . . $ Konsole/Screen#reverseRendition(31b3f8629508dc53).(dest[destLineOffset + column]); |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | void Screencxx . . $ Konsole/Screen#::copyFromScreencxx . . $ Konsole/Screen#copyFromScreen(9c69629908ec0d62).(Charactercxx . . $ Konsole/Character#* dest , int startLine , int count) const |
| 454 | { |
| 455 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( startLine >= 0 && count > 0 && startLine + count <= lines ); |
| 456 | |
| 457 | for (int line = startLine; line < (startLine+count) ; line++) |
| 458 | { |
| 459 | int srcLineStartIndex = line*columnscxx . . $ Konsole/Screen#columns.; |
| 460 | int destLineStartIndex = (line-startLine)*columnscxx . . $ Konsole/Screen#columns.; |
| 461 | |
| 462 | for (int column = 0; column < columnscxx . . $ Konsole/Screen#columns.; column++) |
| 463 | { |
| 464 | int srcIndex = srcLineStartIndex + column; |
| 465 | int destIndex = destLineStartIndex + column; |
| 466 | |
| 467 | dest[destIndex] =cxx . . $ Konsole/Character#`operator=`(69e2e31a5a0e5901). screenLinescxx . . $ Konsole/Screen#screenLines.[srcIndex/columnscxx . . $ Konsole/Screen#columns.].valuecxx . . $ QVector#value(1262e1a11a34054e).(srcIndex%columnscxx . . $ Konsole/Screen#columns.,defaultCharcxx . . $ Konsole/Screen#defaultChar.); |
| 468 | |
| 469 | // invert selected text |
| 470 | if (selBegincxx . . $ Konsole/Screen#selBegin. != -1 && isSelectedcxx . . $ Konsole/Screen#isSelected(88e30549ca55c866).(column,line + historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).())) |
| 471 | reverseRenditioncxx . . $ Konsole/Screen#reverseRendition(31b3f8629508dc53).(dest[destIndex]); |
| 472 | } |
| 473 | |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | void Screencxx . . $ Konsole/Screen#::getImagecxx . . $ Konsole/Screen#getImage(887f9a4805617ad1).( Charactercxx . . $ Konsole/Character#* dest, int size, int startLine, int endLine ) const |
| 478 | { |
| 479 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( startLine >= 0 ); |
| 480 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( endLine >= startLine && endLine < history->getLines() + lines ); |
| 481 | |
| 482 | const int mergedLines = endLine - startLine + 1; |
| 483 | |
| 484 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( size >= mergedLines * columns ); |
| 485 | Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!( size ); |
| 486 | |
| 487 | const int linesInHistoryBuffer = qBoundcxx . . $ qBound(3dbe0c69cb86ae06).(0,historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).()-startLine,mergedLines); |
| 488 | const int linesInScreenBuffer = mergedLines - linesInHistoryBuffer; |
| 489 | |
| 490 | // copy lines from history buffer |
| 491 | if (linesInHistoryBuffer > 0) |
| 492 | copyFromHistorycxx . . $ Konsole/Screen#copyFromHistory(9c69629908ec0d62).(dest,startLine,linesInHistoryBuffer); |
| 493 | |
| 494 | // copy lines from screen buffer |
| 495 | if (linesInScreenBuffer > 0) |
| 496 | copyFromScreencxx . . $ Konsole/Screen#copyFromScreen(9c69629908ec0d62).(dest + linesInHistoryBuffer*columnscxx . . $ Konsole/Screen#columns., |
| 497 | startLine + linesInHistoryBuffer - historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).(), |
| 498 | linesInScreenBuffer); |
| 499 | |
| 500 | // invert display when in screen mode |
| 501 | if (getModecxx . . $ Konsole/Screen#getMode(4a668f6de69bf818).(MODE_Screencxx . . $ `lib/Screen.h:38:9`!)) |
| 502 | { |
| 503 | for (int i = 0; i < mergedLines*columnscxx . . $ Konsole/Screen#columns.; i++) |
| 504 | reverseRenditioncxx . . $ Konsole/Screen#reverseRendition(31b3f8629508dc53).(dest[i]); // for reverse display |
| 505 | } |
| 506 | |
| 507 | // mark the character at the current cursor position |
| 508 | int cursorIndex = loccxx . . $ `lib/Screen.cpp:60:9`!(cuX, cuY + linesInHistoryBuffer); |
| 509 | if(getModecxx . . $ Konsole/Screen#getMode(4a668f6de69bf818).(MODE_Cursorcxx . . $ `lib/Screen.h:39:9`!) && cursorIndex < columnscxx . . $ Konsole/Screen#columns.*mergedLines) |
| 510 | dest[cursorIndex].renditioncxx . . $ Konsole/Character#rendition. |= RE_CURSORcxx . . $ `lib/Character.h:49:9`!; |
| 511 | } |
| 512 | |
| 513 | QVectorcxx . . $ QVector#<LinePropertycxx . . $ Konsole/LineProperty#> Screencxx . . $ Konsole/Screen#::getLinePropertiescxx . . $ Konsole/Screen#getLineProperties(903c14ab5055fa47).( int startLine , int endLine ) const |
| 514 | { |
| 515 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( startLine >= 0 ); |
| 516 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( endLine >= startLine && endLine < history->getLines() + lines ); |
| 517 | |
| 518 | const int mergedLines = endLine-startLine+1; |
| 519 | const int linesInHistory = qBoundcxx . . $ qBound(3dbe0c69cb86ae06).(0,historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).()-startLine,mergedLines); |
| 520 | const int linesInScreen = mergedLines - linesInHistory; |
| 521 | |
| 522 | QVectorcxx . . $ QVector#<LinePropertycxx . . $ Konsole/LineProperty#> resultcxx . . $ QVector#QVector(d4f767463ce0a6b3).(mergedLines); |
| 523 | int index = 0; |
| 524 | |
| 525 | // copy properties for lines in history |
| 526 | for (int line = startLine; line < startLine + linesInHistory; line++) |
| 527 | { |
| 528 | //TODO Support for line properties other than wrapped lines |
| 529 | if (historycxx . . $ Konsole/Screen#history.->isWrappedLinecxx . . $ Konsole/HistoryScroll#isWrappedLine(83c267b20bac841a).(line)) |
| 530 | { |
| 531 | result[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).index] = (LinePropertycxx . . $ Konsole/LineProperty#)(result[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).index] | LINE_WRAPPEDcxx . . $ Konsole/LINE_WRAPPED.); |
| 532 | } |
| 533 | index++; |
| 534 | } |
| 535 | |
| 536 | // copy properties for lines in screen buffer |
| 537 | const int firstScreenLine = startLine + linesInHistory - historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).(); |
| 538 | for (int line = firstScreenLine; line < firstScreenLine+linesInScreen; line++) |
| 539 | { |
| 540 | result[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).index]=linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(e2681f9bb6b2f357).line]; |
| 541 | index++; |
| 542 | } |
| 543 | |
| 544 | return resultcxx . . $ QVector#QVector(a0d8f1cfe28f0150).; |
| 545 | } |
| 546 | |
| 547 | void Screencxx . . $ Konsole/Screen#::resetcxx . . $ Konsole/Screen#reset(b45ddcbc8423892c).(bool clearScreen) |
| 548 | { |
| 549 | setModecxx . . $ Konsole/Screen#setMode(d4f767463ce0a6b3).(MODE_Wrapcxx . . $ `lib/Screen.h:36:9`! ); saveModecxx . . $ Konsole/Screen#saveMode(d4f767463ce0a6b3).(MODE_Wrapcxx . . $ `lib/Screen.h:36:9`! ); // wrap at end of margin |
| 550 | resetModecxx . . $ Konsole/Screen#resetMode(d4f767463ce0a6b3).(MODE_Origincxx . . $ `lib/Screen.h:35:9`!); saveModecxx . . $ Konsole/Screen#saveMode(d4f767463ce0a6b3).(MODE_Origincxx . . $ `lib/Screen.h:35:9`!); // position refere to [1,1] |
| 551 | resetModecxx . . $ Konsole/Screen#resetMode(d4f767463ce0a6b3).(MODE_Insertcxx . . $ `lib/Screen.h:37:9`!); saveModecxx . . $ Konsole/Screen#saveMode(d4f767463ce0a6b3).(MODE_Insertcxx . . $ `lib/Screen.h:37:9`!); // overstroke |
| 552 | setModecxx . . $ Konsole/Screen#setMode(d4f767463ce0a6b3).(MODE_Cursorcxx . . $ `lib/Screen.h:39:9`!); // cursor visible |
| 553 | resetModecxx . . $ Konsole/Screen#resetMode(d4f767463ce0a6b3).(MODE_Screencxx . . $ `lib/Screen.h:38:9`!); // screen not inverse |
| 554 | resetModecxx . . $ Konsole/Screen#resetMode(d4f767463ce0a6b3).(MODE_NewLinecxx . . $ `lib/Screen.h:40:9`!); |
| 555 | |
| 556 | _topMargincxx . . $ Konsole/Screen#_topMargin.=0; |
| 557 | _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.=linescxx . . $ Konsole/Screen#lines.-1; |
| 558 | |
| 559 | setDefaultRenditioncxx . . $ Konsole/Screen#setDefaultRendition(49f6e7a06ebc5aa8).(); |
| 560 | saveCursorcxx . . $ Konsole/Screen#saveCursor(49f6e7a06ebc5aa8).(); |
| 561 | |
| 562 | if ( clearScreen ) |
| 563 | clearcxx . . $ Konsole/Screen#clear(49f6e7a06ebc5aa8).(); |
| 564 | } |
| 565 | |
| 566 | void Screencxx . . $ Konsole/Screen#::clearcxx . . $ Konsole/Screen#clear(49f6e7a06ebc5aa8).() |
| 567 | { |
| 568 | clearEntireScreencxx . . $ Konsole/Screen#clearEntireScreen(49f6e7a06ebc5aa8).(); |
| 569 | homecxx . . $ Konsole/Screen#home(49f6e7a06ebc5aa8).(); |
| 570 | } |
| 571 | |
| 572 | void Screencxx . . $ Konsole/Screen#::backspacecxx . . $ Konsole/Screen#backspace(49f6e7a06ebc5aa8).() |
| 573 | { |
| 574 | cuXcxx . . $ Konsole/Screen#cuX. = qMincxx . . $ qMin(2a338fce5842aa6a).(columnscxx . . $ Konsole/Screen#columns.-1,cuXcxx . . $ Konsole/Screen#cuX.); // nowrap! |
| 575 | cuXcxx . . $ Konsole/Screen#cuX. = qMaxcxx . . $ qMax(2a338fce5842aa6a).(0,cuXcxx . . $ Konsole/Screen#cuX.-1); |
| 576 | |
| 577 | if (screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].sizecxx . . $ QVector#size(455f465bc33b4cdf).() < cuXcxx . . $ Konsole/Screen#cuX.+1) |
| 578 | screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].resizecxx . . $ QVector#resize(d4f767463ce0a6b3).(cuXcxx . . $ Konsole/Screen#cuX.+1); |
| 579 | |
| 580 | if (BS_CLEARScxx . . $ `lib/Screen.cpp:48:9`!) |
| 581 | screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.][cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).cuXcxx . . $ Konsole/Screen#cuX.].charactercxx . . $ Konsole/Character#$anonymous_type_0#character. = ' '; |
| 582 | } |
| 583 | |
| 584 | void Screencxx . . $ Konsole/Screen#::tabcxx . . $ Konsole/Screen#tab(d4f767463ce0a6b3).(int n) |
| 585 | { |
| 586 | // note that TAB is a format effector (does not write ' '); |
| 587 | if (n == 0) n = 1; |
| 588 | while((n > 0) && (cuXcxx . . $ Konsole/Screen#cuX. < columnscxx . . $ Konsole/Screen#columns.-1)) |
| 589 | { |
| 590 | cursorRightcxx . . $ Konsole/Screen#cursorRight(d4f767463ce0a6b3).(1); |
| 591 | while((cuXcxx . . $ Konsole/Screen#cuX. < columnscxx . . $ Konsole/Screen#columns.-1) && !cxx . . $ QBitRef#`operator!`(50ce9a9e25b4a850).tabStopscxx . . $ Konsole/Screen#tabStops.[cxx . . $ QBitArray#`operator[]`(5295c06b79a1e62b).cuXcxx . . $ Konsole/Screen#cuX.]) |
| 592 | cursorRightcxx . . $ Konsole/Screen#cursorRight(d4f767463ce0a6b3).(1); |
| 593 | n--; |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | void Screencxx . . $ Konsole/Screen#::backtabcxx . . $ Konsole/Screen#backtab(d4f767463ce0a6b3).(int n) |
| 598 | { |
| 599 | // note that TAB is a format effector (does not write ' '); |
| 600 | if (n == 0) n = 1; |
| 601 | while((n > 0) && (cuXcxx . . $ Konsole/Screen#cuX. > 0)) |
| 602 | { |
| 603 | cursorLeftcxx . . $ Konsole/Screen#cursorLeft(d4f767463ce0a6b3).(1); while((cuXcxx . . $ Konsole/Screen#cuX. > 0) && !cxx . . $ QBitRef#`operator!`(50ce9a9e25b4a850).tabStopscxx . . $ Konsole/Screen#tabStops.[cxx . . $ QBitArray#`operator[]`(5295c06b79a1e62b).cuXcxx . . $ Konsole/Screen#cuX.]) cursorLeftcxx . . $ Konsole/Screen#cursorLeft(d4f767463ce0a6b3).(1); |
| 604 | n--; |
| 605 | } |
| 606 | } |
| 607 | |
| 608 | void Screencxx . . $ Konsole/Screen#::clearTabStopscxx . . $ Konsole/Screen#clearTabStops(49f6e7a06ebc5aa8).() |
| 609 | { |
| 610 | for (int i = 0; i < columnscxx . . $ Konsole/Screen#columns.; i++) tabStopscxx . . $ Konsole/Screen#tabStops.[cxx . . $ QBitArray#`operator[]`(5295c06b79a1e62b).i] =cxx . . $ QBitRef#`operator=`(5d585d0e9ef73bdb). false; |
| 611 | } |
| 612 | |
| 613 | void Screencxx . . $ Konsole/Screen#::changeTabStopcxx . . $ Konsole/Screen#changeTabStop(b45ddcbc8423892c).(bool set) |
| 614 | { |
| 615 | if (cuXcxx . . $ Konsole/Screen#cuX. >= columnscxx . . $ Konsole/Screen#columns.) return; |
| 616 | tabStopscxx . . $ Konsole/Screen#tabStops.[cxx . . $ QBitArray#`operator[]`(5295c06b79a1e62b).cuXcxx . . $ Konsole/Screen#cuX.] =cxx . . $ QBitRef#`operator=`(5d585d0e9ef73bdb). set; |
| 617 | } |
| 618 | |
| 619 | void Screencxx . . $ Konsole/Screen#::initTabStopscxx . . $ Konsole/Screen#initTabStops(49f6e7a06ebc5aa8).() |
| 620 | { |
| 621 | tabStopscxx . . $ Konsole/Screen#tabStops..resizecxx . . $ QBitArray#resize(d4f767463ce0a6b3).(columnscxx . . $ Konsole/Screen#columns.); |
| 622 | |
| 623 | // Arrg! The 1st tabstop has to be one longer than the other. |
| 624 | // i.e. the kids start counting from 0 instead of 1. |
| 625 | // Other programs might behave correctly. Be aware. |
| 626 | for (int i = 0; i < columnscxx . . $ Konsole/Screen#columns.; i++) |
| 627 | tabStopscxx . . $ Konsole/Screen#tabStops.[cxx . . $ QBitArray#`operator[]`(5295c06b79a1e62b).i] =cxx . . $ QBitRef#`operator=`(5d585d0e9ef73bdb). (i%8 == 0 && i != 0); |
| 628 | } |
| 629 | |
| 630 | void Screencxx . . $ Konsole/Screen#::newLinecxx . . $ Konsole/Screen#newLine(49f6e7a06ebc5aa8).() |
| 631 | { |
| 632 | if (getModecxx . . $ Konsole/Screen#getMode(4a668f6de69bf818).(MODE_NewLinecxx . . $ `lib/Screen.h:40:9`!)) |
| 633 | toStartOfLinecxx . . $ Konsole/Screen#toStartOfLine(49f6e7a06ebc5aa8).(); |
| 634 | indexcxx . . $ Konsole/Screen#index(49f6e7a06ebc5aa8).(); |
| 635 | } |
| 636 | |
| 637 | void Screencxx . . $ Konsole/Screen#::checkSelectioncxx . . $ Konsole/Screen#checkSelection(3e454b8ccf442868).(int from, int to) |
| 638 | { |
| 639 | if (selBegincxx . . $ Konsole/Screen#selBegin. == -1) |
| 640 | return; |
| 641 | int scr_TL = loccxx . . $ `lib/Screen.cpp:60:9`!(0, history->getLines()); |
| 642 | //Clear entire selection if it overlaps region [from, to] |
| 643 | if ( (selBottomRightcxx . . $ Konsole/Screen#selBottomRight. >= (from+scr_TL)) && (selTopLeftcxx . . $ Konsole/Screen#selTopLeft. <= (to+scr_TL)) ) |
| 644 | clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).(); |
| 645 | } |
| 646 | |
| 647 | void Screencxx . . $ Konsole/Screen#::displayCharactercxx . . $ Konsole/Screen#displayCharacter(d461ae26ddb24b42).(wchar_t c) |
| 648 | { |
| 649 | // Note that VT100 does wrapping BEFORE putting the character. |
| 650 | // This has impact on the assumption of valid cursor positions. |
| 651 | // We indicate the fact that a newline has to be triggered by |
| 652 | // putting the cursor one right to the last column of the screen. |
| 653 | |
| 654 | int w = konsole_wcwidthcxx . . $ konsole_wcwidth(9ddfcb434f4b4cce).(c); |
| 655 | if (w <= 0) |
| 656 | return; |
| 657 | |
| 658 | if (cuXcxx . . $ Konsole/Screen#cuX.+w > columnscxx . . $ Konsole/Screen#columns.) { |
| 659 | if (getModecxx . . $ Konsole/Screen#getMode(4a668f6de69bf818).(MODE_Wrapcxx . . $ `lib/Screen.h:36:9`!)) { |
| 660 | linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).cuYcxx . . $ Konsole/Screen#cuY.] = (LinePropertycxx . . $ Konsole/LineProperty#)(linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).cuYcxx . . $ Konsole/Screen#cuY.] | LINE_WRAPPEDcxx . . $ Konsole/LINE_WRAPPED.); |
| 661 | nextLinecxx . . $ Konsole/Screen#nextLine(49f6e7a06ebc5aa8).(); |
| 662 | } |
| 663 | else |
| 664 | cuXcxx . . $ Konsole/Screen#cuX. = columnscxx . . $ Konsole/Screen#columns.-w; |
| 665 | } |
| 666 | |
| 667 | // ensure current line vector has enough elements |
| 668 | int size = screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].sizecxx . . $ QVector#size(455f465bc33b4cdf).(); |
| 669 | if (size < cuXcxx . . $ Konsole/Screen#cuX.+w) |
| 670 | { |
| 671 | screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].resizecxx . . $ QVector#resize(d4f767463ce0a6b3).(cuXcxx . . $ Konsole/Screen#cuX.+w); |
| 672 | } |
| 673 | |
| 674 | if (getModecxx . . $ Konsole/Screen#getMode(4a668f6de69bf818).(MODE_Insertcxx . . $ `lib/Screen.h:37:9`!)) insertCharscxx . . $ Konsole/Screen#insertChars(d4f767463ce0a6b3).(w); |
| 675 | |
| 676 | lastPoscxx . . $ Konsole/Screen#lastPos. = loccxx . . $ `lib/Screen.cpp:60:9`!(cuX,cuY); |
| 677 | |
| 678 | // check if selection is still valid. |
| 679 | checkSelectioncxx . . $ Konsole/Screen#checkSelection(3e454b8ccf442868).(lastPoscxx . . $ Konsole/Screen#lastPos., lastPoscxx . . $ Konsole/Screen#lastPos.); |
| 680 | |
| 681 | Charactercxx . . $ Konsole/Character#& currentChar = screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.][cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).cuXcxx . . $ Konsole/Screen#cuX.]; |
| 682 | |
| 683 | currentChar.charactercxx . . $ Konsole/Character#$anonymous_type_0#character. = c; |
| 684 | currentChar.foregroundColorcxx . . $ Konsole/Character#foregroundColor. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). effectiveForegroundcxx . . $ Konsole/Screen#effectiveForeground.; |
| 685 | currentChar.backgroundColorcxx . . $ Konsole/Character#backgroundColor. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). effectiveBackgroundcxx . . $ Konsole/Screen#effectiveBackground.; |
| 686 | currentChar.renditioncxx . . $ Konsole/Character#rendition. = effectiveRenditioncxx . . $ Konsole/Screen#effectiveRendition.; |
| 687 | |
| 688 | lastDrawnCharcxx . . $ Konsole/Screen#lastDrawnChar. = c; |
| 689 | |
| 690 | int i = 0; |
| 691 | int newCursorX = cuXcxx . . $ Konsole/Screen#cuX. + w--; |
| 692 | while(w) |
| 693 | { |
| 694 | i++; |
| 695 | |
| 696 | if ( screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].sizecxx . . $ QVector#size(455f465bc33b4cdf).() < cuXcxx . . $ Konsole/Screen#cuX. + i + 1 ) |
| 697 | screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.].resizecxx . . $ QVector#resize(d4f767463ce0a6b3).(cuXcxx . . $ Konsole/Screen#cuX.+i+1); |
| 698 | |
| 699 | Charactercxx . . $ Konsole/Character#& ch = screenLinescxx . . $ Konsole/Screen#screenLines.[cuYcxx . . $ Konsole/Screen#cuY.][cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).cuXcxx . . $ Konsole/Screen#cuX. + i]; |
| 700 | ch.charactercxx . . $ Konsole/Character#$anonymous_type_0#character. = 0; |
| 701 | ch.foregroundColorcxx . . $ Konsole/Character#foregroundColor. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). effectiveForegroundcxx . . $ Konsole/Screen#effectiveForeground.; |
| 702 | ch.backgroundColorcxx . . $ Konsole/Character#backgroundColor. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). effectiveBackgroundcxx . . $ Konsole/Screen#effectiveBackground.; |
| 703 | ch.renditioncxx . . $ Konsole/Character#rendition. = effectiveRenditioncxx . . $ Konsole/Screen#effectiveRendition.; |
| 704 | |
| 705 | w--; |
| 706 | } |
| 707 | cuXcxx . . $ Konsole/Screen#cuX. = newCursorX; |
| 708 | } |
| 709 | |
| 710 | void Screencxx . . $ Konsole/Screen#::composecxx . . $ Konsole/Screen#compose(3520e46b33348bf6).(const QStringcxx . . $ QString#& /*compose*/) |
| 711 | { |
| 712 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( 0 /*Not implemented yet*/ ); |
| 713 | |
| 714 | /* if (lastPos == -1) |
| 715 | return; |
| 716 | |
| 717 | QChar c(image[lastPos].character); |
| 718 | compose.prepend(c); |
| 719 | //compose.compose(); ### FIXME! |
| 720 | image[lastPos].character = compose[0].unicode();*/ |
| 721 | } |
| 722 | |
| 723 | int Screencxx . . $ Konsole/Screen#::scrolledLinescxx . . $ Konsole/Screen#scrolledLines(455f465bc33b4cdf).() const |
| 724 | { |
| 725 | return _scrolledLinescxx . . $ Konsole/Screen#_scrolledLines.; |
| 726 | } |
| 727 | int Screencxx . . $ Konsole/Screen#::droppedLinescxx . . $ Konsole/Screen#droppedLines(455f465bc33b4cdf).() const |
| 728 | { |
| 729 | return _droppedLinescxx . . $ Konsole/Screen#_droppedLines.; |
| 730 | } |
| 731 | void Screencxx . . $ Konsole/Screen#::resetDroppedLinescxx . . $ Konsole/Screen#resetDroppedLines(49f6e7a06ebc5aa8).() |
| 732 | { |
| 733 | _droppedLinescxx . . $ Konsole/Screen#_droppedLines. = 0; |
| 734 | } |
| 735 | void Screencxx . . $ Konsole/Screen#::resetScrolledLinescxx . . $ Konsole/Screen#resetScrolledLines(49f6e7a06ebc5aa8).() |
| 736 | { |
| 737 | _scrolledLinescxx . . $ Konsole/Screen#_scrolledLines. = 0; |
| 738 | } |
| 739 | |
| 740 | void Screencxx . . $ Konsole/Screen#::scrollUpcxx . . $ Konsole/Screen#scrollUp(d4f767463ce0a6b3).(int n) |
| 741 | { |
| 742 | if (n == 0) n = 1; // Default |
| 743 | if (_topMargincxx . . $ Konsole/Screen#_topMargin. == 0) addHistLinecxx . . $ Konsole/Screen#addHistLine(49f6e7a06ebc5aa8).(); // history.history |
| 744 | scrollUpcxx . . $ Konsole/Screen#scrollUp(3e454b8ccf442868).(_topMargincxx . . $ Konsole/Screen#_topMargin., n); |
| 745 | } |
| 746 | |
| 747 | QRectcxx . . $ QRect# Screencxx . . $ Konsole/Screen#::lastScrolledRegioncxx . . $ Konsole/Screen#lastScrolledRegion(d857385bac04cbf7).() const |
| 748 | { |
| 749 | return _lastScrolledRegioncxx . . $ Konsole/Screen#_lastScrolledRegion.; |
| 750 | } |
| 751 | |
| 752 | void Screencxx . . $ Konsole/Screen#::scrollUpcxx . . $ Konsole/Screen#scrollUp(3e454b8ccf442868).(int from, int n) |
| 753 | { |
| 754 | if (n <= 0) |
| 755 | return; |
| 756 | if (from > _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.) |
| 757 | return; |
| 758 | if (from + n > _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.) |
| 759 | n = _bottomMargincxx . . $ Konsole/Screen#_bottomMargin. + 1 - from; |
| 760 | |
| 761 | _scrolledLinescxx . . $ Konsole/Screen#_scrolledLines. -= n; |
| 762 | _lastScrolledRegioncxx . . $ Konsole/Screen#_lastScrolledRegion. =cxx . . $ QRect#`operator=`(2f0950bc81ec7a1b). QRectcxx . . $ QRect#QRect(2261ffe5112eab06).(0,_topMargincxx . . $ Konsole/Screen#_topMargin.,columnscxx . . $ Konsole/Screen#columns.-1,(_bottomMargincxx . . $ Konsole/Screen#_bottomMargin.-_topMargincxx . . $ Konsole/Screen#_topMargin.)); |
| 763 | |
| 764 | //FIXME: make sure `topMargin', `bottomMargin', `from', `n' is in bounds. |
| 765 | moveImagecxx . . $ Konsole/Screen#moveImage(b1146eedae1e1d0b).(loccxx . . $ `lib/Screen.cpp:60:9`!(0,from),loccxx . . $ `lib/Screen.cpp:60:9`!(0,from+n),loccxx . . $ `lib/Screen.cpp:60:9`!(columns,_bottomMargin)); |
| 766 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(0,_bottomMargin-n+1),loccxx . . $ `lib/Screen.cpp:60:9`!(columns-1,_bottomMargin),' '); |
| 767 | } |
| 768 | |
| 769 | void Screencxx . . $ Konsole/Screen#::scrollDowncxx . . $ Konsole/Screen#scrollDown(d4f767463ce0a6b3).(int n) |
| 770 | { |
| 771 | if (n == 0) n = 1; // Default |
| 772 | scrollDowncxx . . $ Konsole/Screen#scrollDown(3e454b8ccf442868).(_topMargincxx . . $ Konsole/Screen#_topMargin., n); |
| 773 | } |
| 774 | |
| 775 | void Screencxx . . $ Konsole/Screen#::scrollDowncxx . . $ Konsole/Screen#scrollDown(3e454b8ccf442868).(int from, int n) |
| 776 | { |
| 777 | _scrolledLinescxx . . $ Konsole/Screen#_scrolledLines. += n; |
| 778 | |
| 779 | //FIXME: make sure `topMargin', `bottomMargin', `from', `n' is in bounds. |
| 780 | if (n <= 0) |
| 781 | return; |
| 782 | if (from > _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.) |
| 783 | return; |
| 784 | if (from + n > _bottomMargincxx . . $ Konsole/Screen#_bottomMargin.) |
| 785 | n = _bottomMargincxx . . $ Konsole/Screen#_bottomMargin. - from; |
| 786 | moveImagecxx . . $ Konsole/Screen#moveImage(b1146eedae1e1d0b).(loccxx . . $ `lib/Screen.cpp:60:9`!(0,from+n),loccxx . . $ `lib/Screen.cpp:60:9`!(0,from),loccxx . . $ `lib/Screen.cpp:60:9`!(columns-1,_bottomMargin-n)); |
| 787 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(0,from),loccxx . . $ `lib/Screen.cpp:60:9`!(columns-1,from+n-1),' '); |
| 788 | } |
| 789 | |
| 790 | void Screencxx . . $ Konsole/Screen#::setCursorYXcxx . . $ Konsole/Screen#setCursorYX(3e454b8ccf442868).(int y, int x) |
| 791 | { |
| 792 | setCursorYcxx . . $ Konsole/Screen#setCursorY(d4f767463ce0a6b3).(y); setCursorXcxx . . $ Konsole/Screen#setCursorX(d4f767463ce0a6b3).(x); |
| 793 | } |
| 794 | |
| 795 | void Screencxx . . $ Konsole/Screen#::setCursorXcxx . . $ Konsole/Screen#setCursorX(d4f767463ce0a6b3).(int x) |
| 796 | { |
| 797 | if (x == 0) x = 1; // Default |
| 798 | x -= 1; // Adjust |
| 799 | cuXcxx . . $ Konsole/Screen#cuX. = qMaxcxx . . $ qMax(2a338fce5842aa6a).(0,qMincxx . . $ qMin(2a338fce5842aa6a).(columnscxx . . $ Konsole/Screen#columns.-1, x)); |
| 800 | } |
| 801 | |
| 802 | void Screencxx . . $ Konsole/Screen#::setCursorYcxx . . $ Konsole/Screen#setCursorY(d4f767463ce0a6b3).(int y) |
| 803 | { |
| 804 | if (y == 0) y = 1; // Default |
| 805 | y -= 1; // Adjust |
| 806 | cuYcxx . . $ Konsole/Screen#cuY. = qMaxcxx . . $ qMax(2a338fce5842aa6a).(0,qMincxx . . $ qMin(2a338fce5842aa6a).(linescxx . . $ Konsole/Screen#lines. -1, y + (getModecxx . . $ Konsole/Screen#getMode(4a668f6de69bf818).(MODE_Origincxx . . $ `lib/Screen.h:35:9`!) ? _topMargincxx . . $ Konsole/Screen#_topMargin. : 0) )); |
| 807 | } |
| 808 | |
| 809 | void Screencxx . . $ Konsole/Screen#::homecxx . . $ Konsole/Screen#home(49f6e7a06ebc5aa8).() |
| 810 | { |
| 811 | cuXcxx . . $ Konsole/Screen#cuX. = 0; |
| 812 | cuYcxx . . $ Konsole/Screen#cuY. = 0; |
| 813 | } |
| 814 | |
| 815 | void Screencxx . . $ Konsole/Screen#::toStartOfLinecxx . . $ Konsole/Screen#toStartOfLine(49f6e7a06ebc5aa8).() |
| 816 | { |
| 817 | cuXcxx . . $ Konsole/Screen#cuX. = 0; |
| 818 | } |
| 819 | |
| 820 | int Screencxx . . $ Konsole/Screen#::getCursorXcxx . . $ Konsole/Screen#getCursorX(455f465bc33b4cdf).() const |
| 821 | { |
| 822 | return cuXcxx . . $ Konsole/Screen#cuX.; |
| 823 | } |
| 824 | |
| 825 | int Screencxx . . $ Konsole/Screen#::getCursorYcxx . . $ Konsole/Screen#getCursorY(455f465bc33b4cdf).() const |
| 826 | { |
| 827 | return cuYcxx . . $ Konsole/Screen#cuY.; |
| 828 | } |
| 829 | |
| 830 | void Screencxx . . $ Konsole/Screen#::clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(int loca, int loce, char c) |
| 831 | { |
| 832 | int scr_TL=loccxx . . $ `lib/Screen.cpp:60:9`!(0,history->getLines()); |
| 833 | //FIXME: check positions |
| 834 | |
| 835 | //Clear entire selection if it overlaps region to be moved... |
| 836 | if ( (selBottomRightcxx . . $ Konsole/Screen#selBottomRight. > (loca+scr_TL) )&&(selTopLeftcxx . . $ Konsole/Screen#selTopLeft. < (loce+scr_TL)) ) |
| 837 | { |
| 838 | clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).(); |
| 839 | } |
| 840 | |
| 841 | int topLine = loca/columnscxx . . $ Konsole/Screen#columns.; |
| 842 | int bottomLine = loce/columnscxx . . $ Konsole/Screen#columns.; |
| 843 | |
| 844 | Charactercxx . . $ Konsole/Character# clearChcxx . . $ Konsole/Character#Character(775c6e5ba34caf00).(c,currentForegroundcxx . . $ Konsole/Screen#currentForeground.,currentBackgroundcxx . . $ Konsole/Screen#currentBackground.,DEFAULT_RENDITIONcxx . . $ `lib/Character.h:42:9`!); |
| 845 | |
| 846 | //if the character being used to clear the area is the same as the |
| 847 | //default character, the affected lines can simply be shrunk. |
| 848 | bool isDefaultCh = (clearCh ==cxx . . $ Konsole/`operator==`(2e6b4567d0fd245f). Charactercxx . . $ Konsole/Character#Character(775c6e5ba34caf00).()); |
| 849 | |
| 850 | for (int y=topLine;y<=bottomLine;y++) |
| 851 | { |
| 852 | linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).y] = 0; |
| 853 | |
| 854 | int endCol = ( y == bottomLine) ? loce%columnscxx . . $ Konsole/Screen#columns. : columnscxx . . $ Konsole/Screen#columns.-1; |
| 855 | int startCol = ( y == topLine ) ? loca%columnscxx . . $ Konsole/Screen#columns. : 0; |
| 856 | |
| 857 | QVectorcxx . . $ QVector#<Charactercxx . . $ Konsole/Character#>& line = screenLinescxx . . $ Konsole/Screen#screenLines.[y]; |
| 858 | |
| 859 | if ( isDefaultCh && endCol == columnscxx . . $ Konsole/Screen#columns.-1 ) |
| 860 | { |
| 861 | line.resizecxx . . $ QVector#resize(d4f767463ce0a6b3).(startCol); |
| 862 | } |
| 863 | else |
| 864 | { |
| 865 | if (line.sizecxx . . $ QVector#size(455f465bc33b4cdf).() < endCol + 1) |
| 866 | line.resizecxx . . $ QVector#resize(d4f767463ce0a6b3).(endCol+1); |
| 867 | |
| 868 | Charactercxx . . $ Konsole/Character#* data = line.datacxx . . $ QVector#data(155dc7f103cdb9db).(); |
| 869 | for (int i=startCol;i<=endCol;i++) |
| 870 | data[i]=cxx . . $ Konsole/Character#`operator=`(2e86fbf6b92c0a89).clearCh; |
| 871 | } |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | void Screencxx . . $ Konsole/Screen#::moveImagecxx . . $ Konsole/Screen#moveImage(b1146eedae1e1d0b).(int dest, int sourceBegin, int sourceEnd) |
| 876 | { |
| 877 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( sourceBegin <= sourceEnd ); |
| 878 | |
| 879 | int lines=(sourceEnd-sourceBegin)/columnscxx . . $ Konsole/Screen#columns.; |
| 880 | |
| 881 | //move screen image and line properties: |
| 882 | //the source and destination areas of the image may overlap, |
| 883 | //so it matters that we do the copy in the right order - |
| 884 | //forwards if dest < sourceBegin or backwards otherwise. |
| 885 | //(search the web for 'memmove implementation' for details) |
| 886 | if (dest < sourceBegin) |
| 887 | { |
| 888 | for (int i=0;i<=lines;i++) |
| 889 | { |
| 890 | screenLinescxx . . $ Konsole/Screen#screenLines.[ (dest/columnscxx . . $ Konsole/Screen#columns.)+i ] =cxx . . $ QVector#`operator=`(c90ab23731af0b5e). screenLinescxx . . $ Konsole/Screen#screenLines.[ (sourceBegin/columnscxx . . $ Konsole/Screen#columns.)+i ]; |
| 891 | linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).(dest/columnscxx . . $ Konsole/Screen#columns.)+i]=linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).(sourceBegin/columnscxx . . $ Konsole/Screen#columns.)+i]; |
| 892 | } |
| 893 | } |
| 894 | else |
| 895 | { |
| 896 | for (int i=lines;i>=0;i--) |
| 897 | { |
| 898 | screenLinescxx . . $ Konsole/Screen#screenLines.[ (dest/columnscxx . . $ Konsole/Screen#columns.)+i ] =cxx . . $ QVector#`operator=`(c90ab23731af0b5e). screenLinescxx . . $ Konsole/Screen#screenLines.[ (sourceBegin/columnscxx . . $ Konsole/Screen#columns.)+i ]; |
| 899 | linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).(dest/columnscxx . . $ Konsole/Screen#columns.)+i]=linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).(sourceBegin/columnscxx . . $ Konsole/Screen#columns.)+i]; |
| 900 | } |
| 901 | } |
| 902 | |
| 903 | if (lastPoscxx . . $ Konsole/Screen#lastPos. != -1) |
| 904 | { |
| 905 | int diff = dest - sourceBegin; // Scroll by this amount |
| 906 | lastPoscxx . . $ Konsole/Screen#lastPos. += diff; |
| 907 | if ((lastPoscxx . . $ Konsole/Screen#lastPos. < 0) || (lastPoscxx . . $ Konsole/Screen#lastPos. >= (lines*columnscxx . . $ Konsole/Screen#columns.))) |
| 908 | lastPoscxx . . $ Konsole/Screen#lastPos. = -1; |
| 909 | } |
| 910 | |
| 911 | // Adjust selection to follow scroll. |
| 912 | if (selBegincxx . . $ Konsole/Screen#selBegin. != -1) |
| 913 | { |
| 914 | bool beginIsTL = (selBegincxx . . $ Konsole/Screen#selBegin. == selTopLeftcxx . . $ Konsole/Screen#selTopLeft.); |
| 915 | int diff = dest - sourceBegin; // Scroll by this amount |
| 916 | int scr_TL=loccxx . . $ `lib/Screen.cpp:60:9`!(0,history->getLines()); |
| 917 | int srca = sourceBegin+scr_TL; // Translate index from screen to global |
| 918 | int srce = sourceEnd+scr_TL; // Translate index from screen to global |
| 919 | int desta = srca+diff; |
| 920 | int deste = srce+diff; |
| 921 | |
| 922 | if ((selTopLeftcxx . . $ Konsole/Screen#selTopLeft. >= srca) && (selTopLeftcxx . . $ Konsole/Screen#selTopLeft. <= srce)) |
| 923 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. += diff; |
| 924 | else if ((selTopLeftcxx . . $ Konsole/Screen#selTopLeft. >= desta) && (selTopLeftcxx . . $ Konsole/Screen#selTopLeft. <= deste)) |
| 925 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. = -1; // Clear selection (see below) |
| 926 | |
| 927 | if ((selBottomRightcxx . . $ Konsole/Screen#selBottomRight. >= srca) && (selBottomRightcxx . . $ Konsole/Screen#selBottomRight. <= srce)) |
| 928 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. += diff; |
| 929 | else if ((selBottomRightcxx . . $ Konsole/Screen#selBottomRight. >= desta) && (selBottomRightcxx . . $ Konsole/Screen#selBottomRight. <= deste)) |
| 930 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. = -1; // Clear selection (see below) |
| 931 | |
| 932 | if (selBottomRightcxx . . $ Konsole/Screen#selBottomRight. < 0) |
| 933 | { |
| 934 | clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).(); |
| 935 | } |
| 936 | else |
| 937 | { |
| 938 | if (selTopLeftcxx . . $ Konsole/Screen#selTopLeft. < 0) |
| 939 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. = 0; |
| 940 | } |
| 941 | |
| 942 | if (beginIsTL) |
| 943 | selBegincxx . . $ Konsole/Screen#selBegin. = selTopLeftcxx . . $ Konsole/Screen#selTopLeft.; |
| 944 | else |
| 945 | selBegincxx . . $ Konsole/Screen#selBegin. = selBottomRightcxx . . $ Konsole/Screen#selBottomRight.; |
| 946 | } |
| 947 | } |
| 948 | |
| 949 | void Screencxx . . $ Konsole/Screen#::clearToEndOfScreencxx . . $ Konsole/Screen#clearToEndOfScreen(49f6e7a06ebc5aa8).() |
| 950 | { |
| 951 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(cuX,cuY),loccxx . . $ `lib/Screen.cpp:60:9`!(columns-1,lines-1),' '); |
| 952 | } |
| 953 | |
| 954 | void Screencxx . . $ Konsole/Screen#::clearToBeginOfScreencxx . . $ Konsole/Screen#clearToBeginOfScreen(49f6e7a06ebc5aa8).() |
| 955 | { |
| 956 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(0,0),loccxx . . $ `lib/Screen.cpp:60:9`!(cuX,cuY),' '); |
| 957 | } |
| 958 | |
| 959 | void Screencxx . . $ Konsole/Screen#::clearEntireScreencxx . . $ Konsole/Screen#clearEntireScreen(49f6e7a06ebc5aa8).() |
| 960 | { |
| 961 | // Add entire screen to history |
| 962 | for (int i = 0; i < (linescxx . . $ Konsole/Screen#lines.-1); i++) |
| 963 | { |
| 964 | addHistLinecxx . . $ Konsole/Screen#addHistLine(49f6e7a06ebc5aa8).(); scrollUpcxx . . $ Konsole/Screen#scrollUp(3e454b8ccf442868).(0,1); |
| 965 | } |
| 966 | |
| 967 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(0,0),loccxx . . $ `lib/Screen.cpp:60:9`!(columns-1,lines-1),' '); |
| 968 | } |
| 969 | |
| 970 | /*! fill screen with 'E' |
| 971 | This is to aid screen alignment |
| 972 | */ |
| 973 | |
| 974 | void Screencxx . . $ Konsole/Screen#::helpAligncxx . . $ Konsole/Screen#helpAlign(49f6e7a06ebc5aa8).() |
| 975 | { |
| 976 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(0,0),loccxx . . $ `lib/Screen.cpp:60:9`!(columns-1,lines-1),'E'); |
| 977 | } |
| 978 | |
| 979 | void Screencxx . . $ Konsole/Screen#::clearToEndOfLinecxx . . $ Konsole/Screen#clearToEndOfLine(49f6e7a06ebc5aa8).() |
| 980 | { |
| 981 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(cuX,cuY),loccxx . . $ `lib/Screen.cpp:60:9`!(columns-1,cuY),' '); |
| 982 | } |
| 983 | |
| 984 | void Screencxx . . $ Konsole/Screen#::clearToBeginOfLinecxx . . $ Konsole/Screen#clearToBeginOfLine(49f6e7a06ebc5aa8).() |
| 985 | { |
| 986 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(0,cuY),loccxx . . $ `lib/Screen.cpp:60:9`!(cuX,cuY),' '); |
| 987 | } |
| 988 | |
| 989 | void Screencxx . . $ Konsole/Screen#::clearEntireLinecxx . . $ Konsole/Screen#clearEntireLine(49f6e7a06ebc5aa8).() |
| 990 | { |
| 991 | clearImagecxx . . $ Konsole/Screen#clearImage(561d5502fd84fb3).(loccxx . . $ `lib/Screen.cpp:60:9`!(0,cuY),loccxx . . $ `lib/Screen.cpp:60:9`!(columns-1,cuY),' '); |
| 992 | } |
| 993 | |
| 994 | void Screencxx . . $ Konsole/Screen#::setRenditioncxx . . $ Konsole/Screen#setRendition(d4f767463ce0a6b3).(int re) |
| 995 | { |
| 996 | currentRenditioncxx . . $ Konsole/Screen#currentRendition. |= re; |
| 997 | updateEffectiveRenditioncxx . . $ Konsole/Screen#updateEffectiveRendition(49f6e7a06ebc5aa8).(); |
| 998 | } |
| 999 | |
| 1000 | void Screencxx . . $ Konsole/Screen#::resetRenditioncxx . . $ Konsole/Screen#resetRendition(d4f767463ce0a6b3).(int re) |
| 1001 | { |
| 1002 | currentRenditioncxx . . $ Konsole/Screen#currentRendition. &= ~re; |
| 1003 | updateEffectiveRenditioncxx . . $ Konsole/Screen#updateEffectiveRendition(49f6e7a06ebc5aa8).(); |
| 1004 | } |
| 1005 | |
| 1006 | void Screencxx . . $ Konsole/Screen#::setDefaultRenditioncxx . . $ Konsole/Screen#setDefaultRendition(49f6e7a06ebc5aa8).() |
| 1007 | { |
| 1008 | setForeColorcxx . . $ Konsole/Screen#setForeColor(3e454b8ccf442868).(COLOR_SPACE_DEFAULTcxx . . $ `lib/CharacterColor.h:130:9`!,DEFAULT_FORE_COLORcxx . . $ `lib/CharacterColor.h:105:9`!); |
| 1009 | setBackColorcxx . . $ Konsole/Screen#setBackColor(3e454b8ccf442868).(COLOR_SPACE_DEFAULTcxx . . $ `lib/CharacterColor.h:130:9`!,DEFAULT_BACK_COLORcxx . . $ `lib/CharacterColor.h:106:9`!); |
| 1010 | currentRenditioncxx . . $ Konsole/Screen#currentRendition. = DEFAULT_RENDITIONcxx . . $ `lib/Character.h:42:9`!; |
| 1011 | updateEffectiveRenditioncxx . . $ Konsole/Screen#updateEffectiveRendition(49f6e7a06ebc5aa8).(); |
| 1012 | } |
| 1013 | |
| 1014 | void Screencxx . . $ Konsole/Screen#::setForeColorcxx . . $ Konsole/Screen#setForeColor(3e454b8ccf442868).(int space, int color) |
| 1015 | { |
| 1016 | currentForegroundcxx . . $ Konsole/Screen#currentForeground. =cxx . . $ Konsole/CharacterColor#`operator=`(c6f5dc6c5b403458). CharacterColorcxx . . $ Konsole/CharacterColor#CharacterColor(d5cb1b1d97598ec6).(space, color); |
| 1017 | |
| 1018 | if ( currentForegroundcxx . . $ Konsole/Screen#currentForeground..isValidcxx . . $ Konsole/CharacterColor#isValid(50ce9a9e25b4a850).() ) |
| 1019 | updateEffectiveRenditioncxx . . $ Konsole/Screen#updateEffectiveRendition(49f6e7a06ebc5aa8).(); |
| 1020 | else |
| 1021 | setForeColorcxx . . $ Konsole/Screen#setForeColor(3e454b8ccf442868).(COLOR_SPACE_DEFAULTcxx . . $ `lib/CharacterColor.h:130:9`!,DEFAULT_FORE_COLORcxx . . $ `lib/CharacterColor.h:105:9`!); |
| 1022 | } |
| 1023 | |
| 1024 | void Screencxx . . $ Konsole/Screen#::setBackColorcxx . . $ Konsole/Screen#setBackColor(3e454b8ccf442868).(int space, int color) |
| 1025 | { |
| 1026 | currentBackgroundcxx . . $ Konsole/Screen#currentBackground. =cxx . . $ Konsole/CharacterColor#`operator=`(c6f5dc6c5b403458). CharacterColorcxx . . $ Konsole/CharacterColor#CharacterColor(d5cb1b1d97598ec6).(space, color); |
| 1027 | |
| 1028 | if ( currentBackgroundcxx . . $ Konsole/Screen#currentBackground..isValidcxx . . $ Konsole/CharacterColor#isValid(50ce9a9e25b4a850).() ) |
| 1029 | updateEffectiveRenditioncxx . . $ Konsole/Screen#updateEffectiveRendition(49f6e7a06ebc5aa8).(); |
| 1030 | else |
| 1031 | setBackColorcxx . . $ Konsole/Screen#setBackColor(3e454b8ccf442868).(COLOR_SPACE_DEFAULTcxx . . $ `lib/CharacterColor.h:130:9`!,DEFAULT_BACK_COLORcxx . . $ `lib/CharacterColor.h:106:9`!); |
| 1032 | } |
| 1033 | |
| 1034 | void Screencxx . . $ Konsole/Screen#::clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).() |
| 1035 | { |
| 1036 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. = -1; |
| 1037 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. = -1; |
| 1038 | selBegincxx . . $ Konsole/Screen#selBegin. = -1; |
| 1039 | } |
| 1040 | |
| 1041 | void Screencxx . . $ Konsole/Screen#::getSelectionStartcxx . . $ Konsole/Screen#getSelectionStart(4bd75fe21bbdda99).(int& column , int& line) const |
| 1042 | { |
| 1043 | if ( selTopLeftcxx . . $ Konsole/Screen#selTopLeft. != -1 ) |
| 1044 | { |
| 1045 | column = selTopLeftcxx . . $ Konsole/Screen#selTopLeft. % columnscxx . . $ Konsole/Screen#columns.; |
| 1046 | line = selTopLeftcxx . . $ Konsole/Screen#selTopLeft. / columnscxx . . $ Konsole/Screen#columns.; |
| 1047 | } |
| 1048 | else |
| 1049 | { |
| 1050 | column = cuXcxx . . $ Konsole/Screen#cuX. + getHistLinescxx . . $ Konsole/Screen#getHistLines(455f465bc33b4cdf).(); |
| 1051 | line = cuYcxx . . $ Konsole/Screen#cuY. + getHistLinescxx . . $ Konsole/Screen#getHistLines(455f465bc33b4cdf).(); |
| 1052 | } |
| 1053 | } |
| 1054 | void Screencxx . . $ Konsole/Screen#::getSelectionEndcxx . . $ Konsole/Screen#getSelectionEnd(4bd75fe21bbdda99).(int& column , int& line) const |
| 1055 | { |
| 1056 | if ( selBottomRightcxx . . $ Konsole/Screen#selBottomRight. != -1 ) |
| 1057 | { |
| 1058 | column = selBottomRightcxx . . $ Konsole/Screen#selBottomRight. % columnscxx . . $ Konsole/Screen#columns.; |
| 1059 | line = selBottomRightcxx . . $ Konsole/Screen#selBottomRight. / columnscxx . . $ Konsole/Screen#columns.; |
| 1060 | } |
| 1061 | else |
| 1062 | { |
| 1063 | column = cuXcxx . . $ Konsole/Screen#cuX. + getHistLinescxx . . $ Konsole/Screen#getHistLines(455f465bc33b4cdf).(); |
| 1064 | line = cuYcxx . . $ Konsole/Screen#cuY. + getHistLinescxx . . $ Konsole/Screen#getHistLines(455f465bc33b4cdf).(); |
| 1065 | } |
| 1066 | } |
| 1067 | void Screencxx . . $ Konsole/Screen#::setSelectionStartcxx . . $ Konsole/Screen#setSelectionStart(6908015b96d379c0).(const int x, const int y, const bool mode) |
| 1068 | { |
| 1069 | selBegincxx . . $ Konsole/Screen#selBegin. = loccxx . . $ `lib/Screen.cpp:60:9`!(x,y); |
| 1070 | /* FIXME, HACK to correct for x too far to the right... */ |
| 1071 | if (x == columnscxx . . $ Konsole/Screen#columns.) selBegincxx . . $ Konsole/Screen#selBegin.--; |
| 1072 | |
| 1073 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. = selBegincxx . . $ Konsole/Screen#selBegin.; |
| 1074 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. = selBegincxx . . $ Konsole/Screen#selBegin.; |
| 1075 | blockSelectionModecxx . . $ Konsole/Screen#blockSelectionMode. = mode; |
| 1076 | } |
| 1077 | |
| 1078 | void Screencxx . . $ Konsole/Screen#::setSelectionEndcxx . . $ Konsole/Screen#setSelectionEnd(3e454b8ccf442868).( const int x, const int y) |
| 1079 | { |
| 1080 | if (selBegincxx . . $ Konsole/Screen#selBegin. == -1) |
| 1081 | return; |
| 1082 | |
| 1083 | int endPos = loccxx . . $ `lib/Screen.cpp:60:9`!(x,y); |
| 1084 | |
| 1085 | if (endPos < selBegincxx . . $ Konsole/Screen#selBegin.) |
| 1086 | { |
| 1087 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. = endPos; |
| 1088 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. = selBegincxx . . $ Konsole/Screen#selBegin.; |
| 1089 | } |
| 1090 | else |
| 1091 | { |
| 1092 | /* FIXME, HACK to correct for x too far to the right... */ |
| 1093 | if (x == columnscxx . . $ Konsole/Screen#columns.) |
| 1094 | endPos--; |
| 1095 | |
| 1096 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. = selBegincxx . . $ Konsole/Screen#selBegin.; |
| 1097 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. = endPos; |
| 1098 | } |
| 1099 | |
| 1100 | // Normalize the selection in column mode |
| 1101 | if (blockSelectionModecxx . . $ Konsole/Screen#blockSelectionMode.) |
| 1102 | { |
| 1103 | int topRow = selTopLeftcxx . . $ Konsole/Screen#selTopLeft. / columnscxx . . $ Konsole/Screen#columns.; |
| 1104 | int topColumn = selTopLeftcxx . . $ Konsole/Screen#selTopLeft. % columnscxx . . $ Konsole/Screen#columns.; |
| 1105 | int bottomRow = selBottomRightcxx . . $ Konsole/Screen#selBottomRight. / columnscxx . . $ Konsole/Screen#columns.; |
| 1106 | int bottomColumn = selBottomRightcxx . . $ Konsole/Screen#selBottomRight. % columnscxx . . $ Konsole/Screen#columns.; |
| 1107 | |
| 1108 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. = loccxx . . $ `lib/Screen.cpp:60:9`!(qMin(topColumn,bottomColumn),topRow); |
| 1109 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. = loccxx . . $ `lib/Screen.cpp:60:9`!(qMax(topColumn,bottomColumn),bottomRow); |
| 1110 | } |
| 1111 | } |
| 1112 | |
| 1113 | bool Screencxx . . $ Konsole/Screen#::isSelectedcxx . . $ Konsole/Screen#isSelected(88e30549ca55c866).( const int x,const int y) const |
| 1114 | { |
| 1115 | bool columnInSelection = true; |
| 1116 | if (blockSelectionModecxx . . $ Konsole/Screen#blockSelectionMode.) |
| 1117 | { |
| 1118 | columnInSelection = x >= (selTopLeftcxx . . $ Konsole/Screen#selTopLeft. % columnscxx . . $ Konsole/Screen#columns.) && |
| 1119 | x <= (selBottomRightcxx . . $ Konsole/Screen#selBottomRight. % columnscxx . . $ Konsole/Screen#columns.); |
| 1120 | } |
| 1121 | |
| 1122 | int pos = loccxx . . $ `lib/Screen.cpp:60:9`!(x,y); |
| 1123 | return pos >= selTopLeftcxx . . $ Konsole/Screen#selTopLeft. && pos <= selBottomRightcxx . . $ Konsole/Screen#selBottomRight. && columnInSelection; |
| 1124 | } |
| 1125 | |
| 1126 | QStringcxx . . $ QString# Screencxx . . $ Konsole/Screen#::selectedTextcxx . . $ Konsole/Screen#selectedText(11ecdffe9192d1a2).(bool preserveLineBreaks) const |
| 1127 | { |
| 1128 | QStringcxx . . $ QString# resultcxx . . $ QString#QString(ced63f7c635d850d).; |
| 1129 | QTextStreamcxx . . $ QTextStream# streamcxx . . $ QTextStream#QTextStream(16e3d097052a73db).(&result, QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::ReadWritecxx . . $ QIODevice#ReadWrite.); |
| 1130 | |
| 1131 | PlainTextDecodercxx . . $ Konsole/PlainTextDecoder# decodercxx . . $ Konsole/PlainTextDecoder#PlainTextDecoder(49f6e7a06ebc5aa8).; |
| 1132 | decoder.begincxx . . $ Konsole/PlainTextDecoder#begin(aca783e314870a73).(&stream); |
| 1133 | writeSelectionToStreamcxx . . $ Konsole/Screen#writeSelectionToStream(1f9e2192689dee57).(&decoder , preserveLineBreaks); |
| 1134 | decoder.endcxx . . $ Konsole/PlainTextDecoder#end(49f6e7a06ebc5aa8).(); |
| 1135 | |
| 1136 | return resultcxx . . $ QString#QString(28715ad661ad3cec).; |
| 1137 | } |
| 1138 | |
| 1139 | bool Screencxx . . $ Konsole/Screen#::isSelectionValidcxx . . $ Konsole/Screen#isSelectionValid(50ce9a9e25b4a850).() const |
| 1140 | { |
| 1141 | return selTopLeftcxx . . $ Konsole/Screen#selTopLeft. >= 0 && selBottomRightcxx . . $ Konsole/Screen#selBottomRight. >= 0; |
| 1142 | } |
| 1143 | |
| 1144 | void Screencxx . . $ Konsole/Screen#::writeSelectionToStreamcxx . . $ Konsole/Screen#writeSelectionToStream(1f9e2192689dee57).(TerminalCharacterDecodercxx . . $ Konsole/TerminalCharacterDecoder#* decoder , |
| 1145 | bool preserveLineBreaks) const |
| 1146 | { |
| 1147 | if (!isSelectionValidcxx . . $ Konsole/Screen#isSelectionValid(50ce9a9e25b4a850).()) |
| 1148 | return; |
| 1149 | writeToStreamcxx . . $ Konsole/Screen#writeToStream(4c48626fa5392824).(decoder,selTopLeftcxx . . $ Konsole/Screen#selTopLeft.,selBottomRightcxx . . $ Konsole/Screen#selBottomRight.,preserveLineBreaks); |
| 1150 | } |
| 1151 | |
| 1152 | void Screencxx . . $ Konsole/Screen#::writeToStreamcxx . . $ Konsole/Screen#writeToStream(4c48626fa5392824).(TerminalCharacterDecodercxx . . $ Konsole/TerminalCharacterDecoder#* decoder, |
| 1153 | int startIndex, int endIndex, |
| 1154 | bool preserveLineBreaks) const |
| 1155 | { |
| 1156 | int top = startIndex / columnscxx . . $ Konsole/Screen#columns.; |
| 1157 | int left = startIndex % columnscxx . . $ Konsole/Screen#columns.; |
| 1158 | |
| 1159 | int bottom = endIndex / columnscxx . . $ Konsole/Screen#columns.; |
| 1160 | int right = endIndex % columnscxx . . $ Konsole/Screen#columns.; |
| 1161 | |
| 1162 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( top >= 0 && left >= 0 && bottom >= 0 && right >= 0 ); |
| 1163 | |
| 1164 | for (int y=top;y<=bottom;y++) |
| 1165 | { |
| 1166 | int start = 0; |
| 1167 | if ( y == top || blockSelectionModecxx . . $ Konsole/Screen#blockSelectionMode. ) start = left; |
| 1168 | |
| 1169 | int count = -1; |
| 1170 | if ( y == bottom || blockSelectionModecxx . . $ Konsole/Screen#blockSelectionMode. ) count = right - start + 1; |
| 1171 | |
| 1172 | const bool appendNewLine = ( y != bottom ); |
| 1173 | int copied = copyLineToStreamcxx . . $ Konsole/Screen#copyLineToStream(caeddad2d44997bc).( y, |
| 1174 | start, |
| 1175 | count, |
| 1176 | decoder, |
| 1177 | appendNewLine, |
| 1178 | preserveLineBreaks ); |
| 1179 | |
| 1180 | // if the selection goes beyond the end of the last line then |
| 1181 | // append a new line character. |
| 1182 | // |
| 1183 | // this makes it possible to 'select' a trailing new line character after |
| 1184 | // the text on a line. |
| 1185 | if ( y == bottom && |
| 1186 | copied < count ) |
| 1187 | { |
| 1188 | Charactercxx . . $ Konsole/Character# newLineCharcxx . . $ Konsole/Character#Character(775c6e5ba34caf00).('\n'); |
| 1189 | decoder->decodeLinecxx . . $ Konsole/TerminalCharacterDecoder#decodeLine(aa119f8849ce0e23).(&newLineChar,1,0); |
| 1190 | } |
| 1191 | } |
| 1192 | } |
| 1193 | |
| 1194 | int Screencxx . . $ Konsole/Screen#::copyLineToStreamcxx . . $ Konsole/Screen#copyLineToStream(caeddad2d44997bc).(int line , |
| 1195 | int start, |
| 1196 | int count, |
| 1197 | TerminalCharacterDecodercxx . . $ Konsole/TerminalCharacterDecoder#* decoder, |
| 1198 | bool appendNewLine, |
| 1199 | bool preserveLineBreaks) const |
| 1200 | { |
| 1201 | //buffer to hold characters for decoding |
| 1202 | //the buffer is static to avoid initialising every |
| 1203 | //element on each call to copyLineToStream |
| 1204 | //(which is unnecessary since all elements will be overwritten anyway) |
| 1205 | static const int MAX_CHARS = 1024; |
| 1206 | static Charactercxx . . $ Konsole/Character# characterBuffercxx . . $ Konsole/Character#Character(775c6e5ba34caf00).[MAX_CHARS]; |
| 1207 | |
| 1208 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( count < MAX_CHARS ); |
| 1209 | |
| 1210 | LinePropertycxx . . $ Konsole/LineProperty# currentLineProperties = 0; |
| 1211 | |
| 1212 | //determine if the line is in the history buffer or the screen image |
| 1213 | if (line < historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).()) |
| 1214 | { |
| 1215 | const int lineLength = historycxx . . $ Konsole/Screen#history.->getLineLencxx . . $ Konsole/HistoryScroll#getLineLen(7864480464b09eea).(line); |
| 1216 | |
| 1217 | // ensure that start position is before end of line |
| 1218 | start = qMincxx . . $ qMin(2a338fce5842aa6a).(start,qMaxcxx . . $ qMax(2a338fce5842aa6a).(0,lineLength-1)); |
| 1219 | |
| 1220 | // retrieve line from history buffer. It is assumed |
| 1221 | // that the history buffer does not store trailing white space |
| 1222 | // at the end of the line, so it does not need to be trimmed here |
| 1223 | if (count == -1) |
| 1224 | { |
| 1225 | count = lineLength-start; |
| 1226 | } |
| 1227 | else |
| 1228 | { |
| 1229 | count = qMincxx . . $ qMin(2a338fce5842aa6a).(start+count,lineLength)-start; |
| 1230 | } |
| 1231 | |
| 1232 | // safety checks |
| 1233 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( start >= 0 ); |
| 1234 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( count >= 0 ); |
| 1235 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( (start+count) <= history->getLineLen(line) ); |
| 1236 | |
| 1237 | historycxx . . $ Konsole/Screen#history.->getCellscxx . . $ Konsole/HistoryScroll#getCells(ecb57fcf9e39244).(line,start,count,characterBuffer); |
| 1238 | |
| 1239 | if ( historycxx . . $ Konsole/Screen#history.->isWrappedLinecxx . . $ Konsole/HistoryScroll#isWrappedLine(83c267b20bac841a).(line) ) |
| 1240 | currentLineProperties |= LINE_WRAPPEDcxx . . $ Konsole/LINE_WRAPPED.; |
| 1241 | } |
| 1242 | else |
| 1243 | { |
| 1244 | if ( count == -1 ) |
| 1245 | count = columnscxx . . $ Konsole/Screen#columns. - start; |
| 1246 | |
| 1247 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( count >= 0 ); |
| 1248 | |
| 1249 | const int screenLine = line-historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).(); |
| 1250 | |
| 1251 | Charactercxx . . $ Konsole/Character#* data = screenLinescxx . . $ Konsole/Screen#screenLines.[screenLine].datacxx . . $ QVector#data(155dc7f103cdb9db).(); |
| 1252 | int length = screenLinescxx . . $ Konsole/Screen#screenLines.[screenLine].countcxx . . $ QVector#count(455f465bc33b4cdf).(); |
| 1253 | |
| 1254 | //retrieve line from screen image |
| 1255 | for (int i=start;i < qMincxx . . $ qMin(2a338fce5842aa6a).(start+count,length);i++) |
| 1256 | { |
| 1257 | characterBuffer[i-start] =cxx . . $ Konsole/Character#`operator=`(2e86fbf6b92c0a89). data[i]; |
| 1258 | } |
| 1259 | |
| 1260 | // count cannot be any greater than length |
| 1261 | count = qBoundcxx . . $ qBound(3dbe0c69cb86ae06).(0,count,length-start); |
| 1262 | |
| 1263 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( screenLine < lineProperties.count() ); |
| 1264 | currentLineProperties |= linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(e2681f9bb6b2f357).screenLine]; |
| 1265 | } |
| 1266 | |
| 1267 | // add new line character at end |
| 1268 | const bool omitLineBreak = (currentLineProperties & LINE_WRAPPEDcxx . . $ Konsole/LINE_WRAPPED.) || |
| 1269 | !preserveLineBreaks; |
| 1270 | |
| 1271 | if ( !omitLineBreak && appendNewLine && (count+1 < MAX_CHARS) ) |
| 1272 | { |
| 1273 | characterBuffer[count] =cxx . . $ Konsole/Character#`operator=`(69e2e31a5a0e5901). '\n'cxx . . $ Konsole/Character#Character(775c6e5ba34caf00).; |
| 1274 | count++; |
| 1275 | } |
| 1276 | |
| 1277 | //decode line and write to text stream |
| 1278 | decoder->decodeLinecxx . . $ Konsole/TerminalCharacterDecoder#decodeLine(aa119f8849ce0e23).( (Charactercxx . . $ Konsole/Character#*) characterBuffer , |
| 1279 | count, currentLineProperties ); |
| 1280 | |
| 1281 | return count; |
| 1282 | } |
| 1283 | |
| 1284 | void Screencxx . . $ Konsole/Screen#::writeLinesToStreamcxx . . $ Konsole/Screen#writeLinesToStream(7780994359c8fe18).(TerminalCharacterDecodercxx . . $ Konsole/TerminalCharacterDecoder#* decoder, int fromLine, int toLine) const |
| 1285 | { |
| 1286 | writeToStreamcxx . . $ Konsole/Screen#writeToStream(4c48626fa5392824).(decoder,loccxx . . $ `lib/Screen.cpp:60:9`!(0,fromLine),loccxx . . $ `lib/Screen.cpp:60:9`!(columns-1,toLine)); |
| 1287 | } |
| 1288 | |
| 1289 | void Screencxx . . $ Konsole/Screen#::addHistLinecxx . . $ Konsole/Screen#addHistLine(49f6e7a06ebc5aa8).() |
| 1290 | { |
| 1291 | // add line to history buffer |
| 1292 | // we have to take care about scrolling, too... |
| 1293 | |
| 1294 | if (hasScrollcxx . . $ Konsole/Screen#hasScroll(50ce9a9e25b4a850).()) |
| 1295 | { |
| 1296 | int oldHistLines = historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).(); |
| 1297 | |
| 1298 | historycxx . . $ Konsole/Screen#history.->addCellsVectorcxx . . $ Konsole/HistoryScroll#addCellsVector(76a1241cccfbfdbf).(screenLinescxx . . $ Konsole/Screen#screenLines.[0]); |
| 1299 | historycxx . . $ Konsole/Screen#history.->addLinecxx . . $ Konsole/HistoryScroll#addLine(b45ddcbc8423892c).( linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).0] & LINE_WRAPPEDcxx . . $ Konsole/LINE_WRAPPED. ); |
| 1300 | |
| 1301 | int newHistLines = historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).(); |
| 1302 | |
| 1303 | bool beginIsTL = (selBegincxx . . $ Konsole/Screen#selBegin. == selTopLeftcxx . . $ Konsole/Screen#selTopLeft.); |
| 1304 | |
| 1305 | // If the history is full, increment the count |
| 1306 | // of dropped lines |
| 1307 | if ( newHistLines == oldHistLines ) |
| 1308 | _droppedLinescxx . . $ Konsole/Screen#_droppedLines.++; |
| 1309 | |
| 1310 | // Adjust selection for the new point of reference |
| 1311 | if (newHistLines > oldHistLines) |
| 1312 | { |
| 1313 | if (selBegincxx . . $ Konsole/Screen#selBegin. != -1) |
| 1314 | { |
| 1315 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. += columnscxx . . $ Konsole/Screen#columns.; |
| 1316 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. += columnscxx . . $ Konsole/Screen#columns.; |
| 1317 | } |
| 1318 | } |
| 1319 | |
| 1320 | if (selBegincxx . . $ Konsole/Screen#selBegin. != -1) |
| 1321 | { |
| 1322 | // Scroll selection in history up |
| 1323 | int top_BR = loccxx . . $ `lib/Screen.cpp:60:9`!(0, 1+newHistLines); |
| 1324 | |
| 1325 | if (selTopLeftcxx . . $ Konsole/Screen#selTopLeft. < top_BR) |
| 1326 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. -= columnscxx . . $ Konsole/Screen#columns.; |
| 1327 | |
| 1328 | if (selBottomRightcxx . . $ Konsole/Screen#selBottomRight. < top_BR) |
| 1329 | selBottomRightcxx . . $ Konsole/Screen#selBottomRight. -= columnscxx . . $ Konsole/Screen#columns.; |
| 1330 | |
| 1331 | if (selBottomRightcxx . . $ Konsole/Screen#selBottomRight. < 0) |
| 1332 | clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).(); |
| 1333 | else |
| 1334 | { |
| 1335 | if (selTopLeftcxx . . $ Konsole/Screen#selTopLeft. < 0) |
| 1336 | selTopLeftcxx . . $ Konsole/Screen#selTopLeft. = 0; |
| 1337 | } |
| 1338 | |
| 1339 | if (beginIsTL) |
| 1340 | selBegincxx . . $ Konsole/Screen#selBegin. = selTopLeftcxx . . $ Konsole/Screen#selTopLeft.; |
| 1341 | else |
| 1342 | selBegincxx . . $ Konsole/Screen#selBegin. = selBottomRightcxx . . $ Konsole/Screen#selBottomRight.; |
| 1343 | } |
| 1344 | } |
| 1345 | |
| 1346 | } |
| 1347 | |
| 1348 | int Screencxx . . $ Konsole/Screen#::getHistLinescxx . . $ Konsole/Screen#getHistLines(455f465bc33b4cdf).() const |
| 1349 | { |
| 1350 | return historycxx . . $ Konsole/Screen#history.->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).(); |
| 1351 | } |
| 1352 | |
| 1353 | void Screencxx . . $ Konsole/Screen#::setScrollcxx . . $ Konsole/Screen#setScroll(629d541fe2e7ef47).(const HistoryTypecxx . . $ Konsole/HistoryType#& t , bool copyPreviousScroll) |
| 1354 | { |
| 1355 | clearSelectioncxx . . $ Konsole/Screen#clearSelection(49f6e7a06ebc5aa8).(); |
| 1356 | |
| 1357 | if ( copyPreviousScroll ) |
| 1358 | historycxx . . $ Konsole/Screen#history. = t.scrollcxx . . $ Konsole/HistoryType#scroll(a5ef36c6e2fab2f9).(historycxx . . $ Konsole/Screen#history.); |
| 1359 | else |
| 1360 | { |
| 1361 | HistoryScrollcxx . . $ Konsole/HistoryScroll#* oldScroll = historycxx . . $ Konsole/Screen#history.; |
| 1362 | historycxx . . $ Konsole/Screen#history. = t.scrollcxx . . $ Konsole/HistoryType#scroll(a5ef36c6e2fab2f9).(nullptr); |
| 1363 | delete oldScroll; |
| 1364 | } |
| 1365 | } |
| 1366 | |
| 1367 | bool Screencxx . . $ Konsole/Screen#::hasScrollcxx . . $ Konsole/Screen#hasScroll(50ce9a9e25b4a850).() const |
| 1368 | { |
| 1369 | return historycxx . . $ Konsole/Screen#history.->hasScrollcxx . . $ Konsole/HistoryScroll#hasScroll(c9857a73d68e59ba).(); |
| 1370 | } |
| 1371 | |
| 1372 | const HistoryTypecxx . . $ Konsole/HistoryType#& Screencxx . . $ Konsole/Screen#::getScrollcxx . . $ Konsole/Screen#getScroll(4823a4bab87d8bdc).() const |
| 1373 | { |
| 1374 | return historycxx . . $ Konsole/Screen#history.->getTypecxx . . $ Konsole/HistoryScroll#getType(15b6dc00bdc9f90b).(); |
| 1375 | } |
| 1376 | |
| 1377 | void Screencxx . . $ Konsole/Screen#::setLinePropertycxx . . $ Konsole/Screen#setLineProperty(f2ac3508b56cd10).(LinePropertycxx . . $ Konsole/LineProperty# property , bool enable) |
| 1378 | { |
| 1379 | if ( enable ) |
| 1380 | linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).cuYcxx . . $ Konsole/Screen#cuY.] = (LinePropertycxx . . $ Konsole/LineProperty#)(linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).cuYcxx . . $ Konsole/Screen#cuY.] | property); |
| 1381 | else |
| 1382 | linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).cuYcxx . . $ Konsole/Screen#cuY.] = (LinePropertycxx . . $ Konsole/LineProperty#)(linePropertiescxx . . $ Konsole/Screen#lineProperties.[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).cuYcxx . . $ Konsole/Screen#cuY.] & ~property); |
| 1383 | } |
| 1384 | void Screencxx . . $ Konsole/Screen#::fillWithDefaultCharcxx . . $ Konsole/Screen#fillWithDefaultChar(1675d5b840a4fbe2).(Charactercxx . . $ Konsole/Character#* dest, int count) |
| 1385 | { |
| 1386 | for (int i=0;i<count;i++) |
| 1387 | dest[i] =cxx . . $ Konsole/Character#`operator=`(2e86fbf6b92c0a89). defaultCharcxx . . $ Konsole/Screen#defaultChar.; |
| 1388 | } |