| 1 | /* |
| 2 | This file is part of Konsole, an X terminal. |
| 3 | Copyright 1997,1998 by Lars Doelle <[email protected]> |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 2 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 18 | 02110-1301 USA. |
| 19 | */ |
| 20 | |
| 21 | // Own |
| 22 | #include "History.h"cxx . . $ `<file>/lib/History.h`/ |
| 23 | |
| 24 | // System |
| 25 | #include <algorithm> |
| 26 | #include <iostream> |
| 27 | #include <cstdlib> |
| 28 | #include <cstdio> |
| 29 | #include <sys/types.h> |
| 30 | #include <sys/mman.h> |
| 31 | #include <unistd.h> |
| 32 | #include <cerrno> |
| 33 | |
| 34 | #include <QtDebug> |
| 35 | |
| 36 | // KDE |
| 37 | //#include <kde_file.h> |
| 38 | //#include <kdebug.h> |
| 39 | |
| 40 | // Reasonable line size |
| 41 | #define LINE_SIZEcxx . . $ `lib/History.cpp:41:9`! 1024 |
| 42 | #define KDE_lseekcxx . . $ `lib/History.cpp:42:9`! lseek |
| 43 | |
| 44 | using namespace Konsole; |
| 45 | |
| 46 | /* |
| 47 | An arbitrary long scroll. |
| 48 | |
| 49 | One can modify the scroll only by adding either cells |
| 50 | or newlines, but access it randomly. |
| 51 | |
| 52 | The model is that of an arbitrary wide typewriter scroll |
| 53 | in that the scroll is a serie of lines and each line is |
| 54 | a serie of cells with no overwriting permitted. |
| 55 | |
| 56 | The implementation provides arbitrary length and numbers |
| 57 | of cells and line/column indexed read access to the scroll |
| 58 | at constant costs. |
| 59 | |
| 60 | KDE4: Can we use QTemporaryFile here, instead of KTempFile? |
| 61 | |
| 62 | FIXME: some complain about the history buffer comsuming the |
| 63 | memory of their machines. This problem is critical |
| 64 | since the history does not behave gracefully in cases |
| 65 | where the memory is used up completely. |
| 66 | |
| 67 | I put in a workaround that should handle it problem |
| 68 | now gracefully. I'm not satisfied with the solution. |
| 69 | |
| 70 | FIXME: Terminating the history is not properly indicated |
| 71 | in the menu. We should throw a signal. |
| 72 | |
| 73 | FIXME: There is noticeable decrease in speed, also. Perhaps, |
| 74 | there whole feature needs to be revisited therefore. |
| 75 | Disadvantage of a more elaborated, say block-oriented |
| 76 | scheme with wrap around would be it's complexity. |
| 77 | */ |
| 78 | |
| 79 | //FIXME: tempory replacement for tmpfile |
| 80 | // this is here one for debugging purpose. |
| 81 | |
| 82 | //#define tmpfile xTmpFile |
| 83 | |
| 84 | // History File /////////////////////////////////////////// |
| 85 | |
| 86 | /* |
| 87 | A Row(X) data type which allows adding elements to the end. |
| 88 | */ |
| 89 | |
| 90 | HistoryFilecxx . . $ Konsole/HistoryFile#::HistoryFilecxx . . $ Konsole/HistoryFile#HistoryFile(49f6e7a06ebc5aa8).() |
| 91 | : ioncxx . . $ Konsole/HistoryFile#ion.(-1), |
| 92 | lengthcxx . . $ Konsole/HistoryFile#length.(0), |
| 93 | fileMapcxx . . $ Konsole/HistoryFile#fileMap.(nullptr), |
| 94 | readWriteBalancecxx . . $ Konsole/HistoryFile#readWriteBalance.(0) |
| 95 | { |
| 96 | if (tmpFilecxx . . $ Konsole/HistoryFile#tmpFile..opencxx . . $ QTemporaryFile#open(c9857a73d68e59ba).()) |
| 97 | { |
| 98 | tmpFilecxx . . $ Konsole/HistoryFile#tmpFile..setAutoRemovecxx . . $ QTemporaryFile#setAutoRemove(b45ddcbc8423892c).(true); |
| 99 | ioncxx . . $ Konsole/HistoryFile#ion. = tmpFilecxx . . $ Konsole/HistoryFile#tmpFile..handlecxx . . $ QFileDevice#handle(455f465bc33b4cdf).(); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | HistoryFilecxx . . $ Konsole/HistoryFile#::~cxx . . $ Konsole/HistoryFile#`~HistoryFile`(ced63f7c635d850d).HistoryFilecxx . . $ Konsole/HistoryFile#() |
| 104 | { |
| 105 | if (fileMapcxx . . $ Konsole/HistoryFile#fileMap.) |
| 106 | unmapcxx . . $ Konsole/HistoryFile#unmap(49f6e7a06ebc5aa8).(); |
| 107 | } |
| 108 | |
| 109 | //TODO: Mapping the entire file in will cause problems if the history file becomes exceedingly large, |
| 110 | //(ie. larger than available memory). HistoryFile::map() should only map in sections of the file at a time, |
| 111 | //to avoid this. |
| 112 | void HistoryFilecxx . . $ Konsole/HistoryFile#::mapcxx . . $ Konsole/HistoryFile#map(49f6e7a06ebc5aa8).() |
| 113 | { |
| 114 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( fileMap == nullptr ); |
| 115 | |
| 116 | fileMapcxx . . $ Konsole/HistoryFile#fileMap. = (char*)mmap( nullptr , lengthcxx . . $ Konsole/HistoryFile#length. , PROT_READcxx . . $ `<external>/17226767460805440860/mman-linux.h:32:9`! , MAP_PRIVATEcxx . . $ `<external>/17226767460805440860/mman-linux.h:43:9`! , ioncxx . . $ Konsole/HistoryFile#ion. , 0 ); |
| 117 | |
| 118 | //if mmap'ing fails, fall back to the read-lseek combination |
| 119 | if ( fileMapcxx . . $ Konsole/HistoryFile#fileMap. == MAP_FAILEDcxx . . $ `<external>/6724834311684550606/mman.h:44:9`! ) |
| 120 | { |
| 121 | readWriteBalancecxx . . $ Konsole/HistoryFile#readWriteBalance. = 0; |
| 122 | fileMapcxx . . $ Konsole/HistoryFile#fileMap. = nullptr; |
| 123 | //qDebug() << __FILE__ << __LINE__ << ": mmap'ing history failed. errno = " << errno; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | void HistoryFilecxx . . $ Konsole/HistoryFile#::unmapcxx . . $ Konsole/HistoryFile#unmap(49f6e7a06ebc5aa8).() |
| 128 | { |
| 129 | int result = munmap( fileMapcxx . . $ Konsole/HistoryFile#fileMap. , lengthcxx . . $ Konsole/HistoryFile#length. ); |
| 130 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( result == 0 ); Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!( result ); |
| 131 | |
| 132 | fileMapcxx . . $ Konsole/HistoryFile#fileMap. = nullptr; |
| 133 | } |
| 134 | |
| 135 | bool HistoryFilecxx . . $ Konsole/HistoryFile#::isMappedcxx . . $ Konsole/HistoryFile#isMapped(50ce9a9e25b4a850).() const |
| 136 | { |
| 137 | return (fileMapcxx . . $ Konsole/HistoryFile#fileMap. != nullptr); |
| 138 | } |
| 139 | |
| 140 | void HistoryFilecxx . . $ Konsole/HistoryFile#::addcxx . . $ Konsole/HistoryFile#add(749a392e780a2e04).(const unsigned char* bytes, int len) |
| 141 | { |
| 142 | if ( fileMapcxx . . $ Konsole/HistoryFile#fileMap. ) |
| 143 | unmapcxx . . $ Konsole/HistoryFile#unmap(49f6e7a06ebc5aa8).(); |
| 144 | |
| 145 | readWriteBalancecxx . . $ Konsole/HistoryFile#readWriteBalance.++; |
| 146 | |
| 147 | int rc = 0; |
| 148 | |
| 149 | rc = KDE_lseekcxx . . $ `lib/History.cpp:42:9`!(ioncxx . . $ Konsole/HistoryFile#ion.,lengthcxx . . $ Konsole/HistoryFile#length.,SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!); if (rc < 0) { perror("HistoryFile::add.seek"); return; } |
| 150 | rc = write(ioncxx . . $ Konsole/HistoryFile#ion.,bytes,len); if (rc < 0) { perror("HistoryFile::add.write"); return; } |
| 151 | lengthcxx . . $ Konsole/HistoryFile#length. += rc; |
| 152 | } |
| 153 | |
| 154 | void HistoryFilecxx . . $ Konsole/HistoryFile#::getcxx . . $ Konsole/HistoryFile#get(49a5bbab55ea8abc).(unsigned char* bytes, int len, int loc) |
| 155 | { |
| 156 | //count number of get() calls vs. number of add() calls. |
| 157 | //If there are many more get() calls compared with add() |
| 158 | //calls (decided by using MAP_THRESHOLD) then mmap the log |
| 159 | //file to improve performance. |
| 160 | readWriteBalancecxx . . $ Konsole/HistoryFile#readWriteBalance.--; |
| 161 | if ( !fileMapcxx . . $ Konsole/HistoryFile#fileMap. && readWriteBalancecxx . . $ Konsole/HistoryFile#readWriteBalance. < MAP_THRESHOLDcxx . . $ Konsole/HistoryFile#MAP_THRESHOLD. ) |
| 162 | mapcxx . . $ Konsole/HistoryFile#map(49f6e7a06ebc5aa8).(); |
| 163 | |
| 164 | if ( fileMapcxx . . $ Konsole/HistoryFile#fileMap. ) |
| 165 | { |
| 166 | for (int i=0;i<len;i++) |
| 167 | bytes[i]=fileMapcxx . . $ Konsole/HistoryFile#fileMap.[loc+i]; |
| 168 | } |
| 169 | else |
| 170 | { |
| 171 | int rc = 0; |
| 172 | |
| 173 | if (loc < 0 || len < 0 || loc + len > lengthcxx . . $ Konsole/HistoryFile#length.) |
| 174 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"getHist(...,%d,%d): invalid args.\n",len,loc); |
| 175 | rc = KDE_lseekcxx . . $ `lib/History.cpp:42:9`!(ioncxx . . $ Konsole/HistoryFile#ion.,loc,SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!); if (rc < 0) { perror("HistoryFile::get.seek"); return; } |
| 176 | rc = read(ioncxx . . $ Konsole/HistoryFile#ion.,bytes,len); if (rc < 0) { perror("HistoryFile::get.read"); return; } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | int HistoryFilecxx . . $ Konsole/HistoryFile#::lencxx . . $ Konsole/HistoryFile#len(b126dc7c1de90089).() |
| 181 | { |
| 182 | return lengthcxx . . $ Konsole/HistoryFile#length.; |
| 183 | } |
| 184 | |
| 185 | |
| 186 | // History Scroll abstract base class ////////////////////////////////////// |
| 187 | |
| 188 | |
| 189 | HistoryScrollcxx . . $ Konsole/HistoryScroll#::HistoryScrollcxx . . $ Konsole/HistoryScroll#HistoryScroll(880ad70f7ea64dbe).(HistoryTypecxx . . $ Konsole/HistoryType#* t) |
| 190 | : m_histTypecxx . . $ Konsole/HistoryScroll#m_histType.(t) |
| 191 | { |
| 192 | } |
| 193 | |
| 194 | HistoryScrollcxx . . $ Konsole/HistoryScroll#::~cxx . . $ Konsole/HistoryScroll#`~HistoryScroll`(ced63f7c635d850d).HistoryScrollcxx . . $ Konsole/HistoryScroll#() |
| 195 | { |
| 196 | delete m_histTypecxx . . $ Konsole/HistoryScroll#m_histType.; |
| 197 | } |
| 198 | |
| 199 | bool HistoryScrollcxx . . $ Konsole/HistoryScroll#::hasScrollcxx . . $ Konsole/HistoryScroll#hasScroll(c9857a73d68e59ba).() |
| 200 | { |
| 201 | return true; |
| 202 | } |
| 203 | |
| 204 | // History Scroll File ////////////////////////////////////// |
| 205 | |
| 206 | /* |
| 207 | The history scroll makes a Row(Row(Cell)) from |
| 208 | two history buffers. The index buffer contains |
| 209 | start of line positions which refere to the cells |
| 210 | buffer. |
| 211 | |
| 212 | Note that index[0] addresses the second line |
| 213 | (line #1), while the first line (line #0) starts |
| 214 | at 0 in cells. |
| 215 | */ |
| 216 | |
| 217 | HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#::HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#HistoryScrollFile(3520e46b33348bf6).(const QStringcxx . . $ QString# &logFileName) |
| 218 | : HistoryScrollcxx . . $ Konsole/HistoryScroll#(new HistoryTypeFilecxx . . $ Konsole/HistoryTypeFile#(logFileName)), |
| 219 | m_logFileNamecxx . . $ Konsole/HistoryScrollFile#m_logFileName.(logFileName) |
| 220 | { |
| 221 | } |
| 222 | |
| 223 | HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#::~cxx . . $ Konsole/HistoryScrollFile#`~HistoryScrollFile`(ced63f7c635d850d).HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#() |
| 224 | { |
| 225 | } |
| 226 | |
| 227 | int HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#::getLinescxx . . $ Konsole/HistoryScrollFile#getLines(b126dc7c1de90089).() |
| 228 | { |
| 229 | return indexcxx . . $ Konsole/HistoryScrollFile#index..lencxx . . $ Konsole/HistoryFile#len(b126dc7c1de90089).() / sizeof(int); |
| 230 | } |
| 231 | |
| 232 | int HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#::getLineLencxx . . $ Konsole/HistoryScrollFile#getLineLen(7864480464b09eea).(int lineno) |
| 233 | { |
| 234 | return (startOfLinecxx . . $ Konsole/HistoryScrollFile#startOfLine(7864480464b09eea).(lineno+1) - startOfLinecxx . . $ Konsole/HistoryScrollFile#startOfLine(7864480464b09eea).(lineno)) / sizeof(Charactercxx . . $ Konsole/Character#); |
| 235 | } |
| 236 | |
| 237 | bool HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#::isWrappedLinecxx . . $ Konsole/HistoryScrollFile#isWrappedLine(83c267b20bac841a).(int lineno) |
| 238 | { |
| 239 | if (lineno>=0 && lineno <= getLinescxx . . $ Konsole/HistoryScrollFile#getLines(b126dc7c1de90089).()) { |
| 240 | unsigned char flag; |
| 241 | lineflagscxx . . $ Konsole/HistoryScrollFile#lineflags..getcxx . . $ Konsole/HistoryFile#get(49a5bbab55ea8abc).((unsigned char*)&flag,sizeof(unsigned char),(lineno)*sizeof(unsigned char)); |
| 242 | return flag; |
| 243 | } |
| 244 | return false; |
| 245 | } |
| 246 | |
| 247 | int HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#::startOfLinecxx . . $ Konsole/HistoryScrollFile#startOfLine(7864480464b09eea).(int lineno) |
| 248 | { |
| 249 | if (lineno <= 0) return 0; |
| 250 | if (lineno <= getLinescxx . . $ Konsole/HistoryScrollFile#getLines(b126dc7c1de90089).()) |
| 251 | { |
| 252 | |
| 253 | if (!indexcxx . . $ Konsole/HistoryScrollFile#index..isMappedcxx . . $ Konsole/HistoryFile#isMapped(50ce9a9e25b4a850).()) |
| 254 | indexcxx . . $ Konsole/HistoryScrollFile#index..mapcxx . . $ Konsole/HistoryFile#map(49f6e7a06ebc5aa8).(); |
| 255 | |
| 256 | int res; |
| 257 | indexcxx . . $ Konsole/HistoryScrollFile#index..getcxx . . $ Konsole/HistoryFile#get(49a5bbab55ea8abc).((unsigned char*)&res,sizeof(int),(lineno-1)*sizeof(int)); |
| 258 | return res; |
| 259 | } |
| 260 | return cellscxx . . $ Konsole/HistoryScrollFile#cells..lencxx . . $ Konsole/HistoryFile#len(b126dc7c1de90089).(); |
| 261 | } |
| 262 | |
| 263 | void HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#::getCellscxx . . $ Konsole/HistoryScrollFile#getCells(ecb57fcf9e39244).(int lineno, int colno, int count, Charactercxx . . $ Konsole/Character# res[]) |
| 264 | { |
| 265 | cellscxx . . $ Konsole/HistoryScrollFile#cells..getcxx . . $ Konsole/HistoryFile#get(49a5bbab55ea8abc).((unsigned char*)res,count*sizeof(Charactercxx . . $ Konsole/Character#),startOfLinecxx . . $ Konsole/HistoryScrollFile#startOfLine(7864480464b09eea).(lineno)+colno*sizeof(Charactercxx . . $ Konsole/Character#)); |
| 266 | } |
| 267 | |
| 268 | void HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#::addCellscxx . . $ Konsole/HistoryScrollFile#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# text[], int count) |
| 269 | { |
| 270 | cellscxx . . $ Konsole/HistoryScrollFile#cells..addcxx . . $ Konsole/HistoryFile#add(749a392e780a2e04).((unsigned char*)text,count*sizeof(Charactercxx . . $ Konsole/Character#)); |
| 271 | } |
| 272 | |
| 273 | void HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#::addLinecxx . . $ Konsole/HistoryScrollFile#addLine(b45ddcbc8423892c).(bool previousWrapped) |
| 274 | { |
| 275 | if (indexcxx . . $ Konsole/HistoryScrollFile#index..isMappedcxx . . $ Konsole/HistoryFile#isMapped(50ce9a9e25b4a850).()) |
| 276 | indexcxx . . $ Konsole/HistoryScrollFile#index..unmapcxx . . $ Konsole/HistoryFile#unmap(49f6e7a06ebc5aa8).(); |
| 277 | |
| 278 | int locn = cellscxx . . $ Konsole/HistoryScrollFile#cells..lencxx . . $ Konsole/HistoryFile#len(b126dc7c1de90089).(); |
| 279 | indexcxx . . $ Konsole/HistoryScrollFile#index..addcxx . . $ Konsole/HistoryFile#add(749a392e780a2e04).((unsigned char*)&locn,sizeof(int)); |
| 280 | unsigned char flags = previousWrapped ? 0x01 : 0x00; |
| 281 | lineflagscxx . . $ Konsole/HistoryScrollFile#lineflags..addcxx . . $ Konsole/HistoryFile#add(749a392e780a2e04).((unsigned char*)&flags,sizeof(unsigned char)); |
| 282 | } |
| 283 | |
| 284 | |
| 285 | // History Scroll Buffer ////////////////////////////////////// |
| 286 | HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#HistoryScrollBuffer(cb2f890c2fdad230).(unsigned int maxLineCount) |
| 287 | : HistoryScrollcxx . . $ Konsole/HistoryScroll#(new HistoryTypeBuffercxx . . $ Konsole/HistoryTypeBuffer#(maxLineCount)) |
| 288 | ,_historyBuffercxx . . $ Konsole/HistoryScrollBuffer#_historyBuffer.() |
| 289 | ,_maxLineCountcxx . . $ Konsole/HistoryScrollBuffer#_maxLineCount.(0) |
| 290 | ,_usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.(0) |
| 291 | ,_headcxx . . $ Konsole/HistoryScrollBuffer#_head.(0) |
| 292 | { |
| 293 | setMaxNbLinescxx . . $ Konsole/HistoryScrollBuffer#setMaxNbLines(cb2f890c2fdad230).(maxLineCount); |
| 294 | } |
| 295 | |
| 296 | HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::~cxx . . $ Konsole/HistoryScrollBuffer#`~HistoryScrollBuffer`(ced63f7c635d850d).HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#() |
| 297 | { |
| 298 | delete[] _historyBuffercxx . . $ Konsole/HistoryScrollBuffer#_historyBuffer.; |
| 299 | } |
| 300 | |
| 301 | void HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::addCellsVectorcxx . . $ Konsole/HistoryScrollBuffer#addCellsVector(76a1241cccfbfdbf).(const QVectorcxx . . $ QVector#<Charactercxx . . $ Konsole/Character#>& cells) |
| 302 | { |
| 303 | _headcxx . . $ Konsole/HistoryScrollBuffer#_head.++; |
| 304 | if ( _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines. < _maxLineCountcxx . . $ Konsole/HistoryScrollBuffer#_maxLineCount. ) |
| 305 | _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.++; |
| 306 | |
| 307 | if ( _headcxx . . $ Konsole/HistoryScrollBuffer#_head. >= _maxLineCountcxx . . $ Konsole/HistoryScrollBuffer#_maxLineCount. ) |
| 308 | { |
| 309 | _headcxx . . $ Konsole/HistoryScrollBuffer#_head. = 0; |
| 310 | } |
| 311 | |
| 312 | _historyBuffercxx . . $ Konsole/HistoryScrollBuffer#_historyBuffer.[bufferIndexcxx . . $ Konsole/HistoryScrollBuffer#bufferIndex(7ccb52b1bfe01045).(_usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.-1)] =cxx . . $ QVector#`operator=`(c90ab23731af0b5e). cells; |
| 313 | _wrappedLinecxx . . $ Konsole/HistoryScrollBuffer#_wrappedLine.[cxx . . $ QBitArray#`operator[]`(5295c06b79a1e62b).bufferIndexcxx . . $ Konsole/HistoryScrollBuffer#bufferIndex(7ccb52b1bfe01045).(_usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.-1)] =cxx . . $ QBitRef#`operator=`(5d585d0e9ef73bdb). false; |
| 314 | } |
| 315 | void HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::addCellscxx . . $ Konsole/HistoryScrollBuffer#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# a[], int count) |
| 316 | { |
| 317 | HistoryLinecxx . . $ Konsole/HistoryScrollBuffer#HistoryLine# newLinecxx . . $ QVector#QVector(d4f767463ce0a6b3).(count); |
| 318 | stdcxx . . $ std/::copycxx . . $ std/copy(88304b602929f6f4).(a,a+count,newLine.begincxx . . $ QVector#begin(a488e68b8120152a).()); |
| 319 | |
| 320 | addCellsVectorcxx . . $ Konsole/HistoryScrollBuffer#addCellsVector(76a1241cccfbfdbf).(newLine); |
| 321 | } |
| 322 | |
| 323 | void HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::addLinecxx . . $ Konsole/HistoryScrollBuffer#addLine(b45ddcbc8423892c).(bool previousWrapped) |
| 324 | { |
| 325 | _wrappedLinecxx . . $ Konsole/HistoryScrollBuffer#_wrappedLine.[cxx . . $ QBitArray#`operator[]`(5295c06b79a1e62b).bufferIndexcxx . . $ Konsole/HistoryScrollBuffer#bufferIndex(7ccb52b1bfe01045).(_usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.-1)] =cxx . . $ QBitRef#`operator=`(5d585d0e9ef73bdb). previousWrapped; |
| 326 | } |
| 327 | |
| 328 | int HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::getLinescxx . . $ Konsole/HistoryScrollBuffer#getLines(b126dc7c1de90089).() |
| 329 | { |
| 330 | return _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.; |
| 331 | } |
| 332 | |
| 333 | int HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::getLineLencxx . . $ Konsole/HistoryScrollBuffer#getLineLen(7864480464b09eea).(int lineNumber) |
| 334 | { |
| 335 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( lineNumber >= 0 && lineNumber < _maxLineCount ); |
| 336 | |
| 337 | if ( lineNumber < _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines. ) |
| 338 | { |
| 339 | return _historyBuffercxx . . $ Konsole/HistoryScrollBuffer#_historyBuffer.[bufferIndexcxx . . $ Konsole/HistoryScrollBuffer#bufferIndex(7ccb52b1bfe01045).(lineNumber)].sizecxx . . $ QVector#size(455f465bc33b4cdf).(); |
| 340 | } |
| 341 | else |
| 342 | { |
| 343 | return 0; |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | bool HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::isWrappedLinecxx . . $ Konsole/HistoryScrollBuffer#isWrappedLine(83c267b20bac841a).(int lineNumber) |
| 348 | { |
| 349 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( lineNumber >= 0 && lineNumber < _maxLineCount ); |
| 350 | |
| 351 | if (lineNumber < _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.) |
| 352 | { |
| 353 | //kDebug() << "Line" << lineNumber << "wrapped is" << _wrappedLine[bufferIndex(lineNumber)]; |
| 354 | return _wrappedLinecxx . . $ Konsole/HistoryScrollBuffer#_wrappedLine.[cxx . . $ QBitArray#`operator[]`(5295c06b79a1e62b).bufferIndexcxx . . $ Konsole/HistoryScrollBuffer#bufferIndex(7ccb52b1bfe01045).(lineNumber)]; |
| 355 | } |
| 356 | else |
| 357 | return false; |
| 358 | } |
| 359 | |
| 360 | void HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::getCellscxx . . $ Konsole/HistoryScrollBuffer#getCells(ecb57fcf9e39244).(int lineNumber, int startColumn, int count, Charactercxx . . $ Konsole/Character# buffer[]) |
| 361 | { |
| 362 | if ( count == 0 ) return; |
| 363 | |
| 364 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( lineNumber < _maxLineCount ); |
| 365 | |
| 366 | if (lineNumber >= _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.) |
| 367 | { |
| 368 | memset(static_cast<void*>(buffer), 0, count * sizeof(Charactercxx . . $ Konsole/Character#)); |
| 369 | return; |
| 370 | } |
| 371 | |
| 372 | const HistoryLinecxx . . $ Konsole/HistoryScrollBuffer#HistoryLine#& line = _historyBuffercxx . . $ Konsole/HistoryScrollBuffer#_historyBuffer.[bufferIndexcxx . . $ Konsole/HistoryScrollBuffer#bufferIndex(7ccb52b1bfe01045).(lineNumber)]; |
| 373 | |
| 374 | //kDebug() << "startCol " << startColumn; |
| 375 | //kDebug() << "line.size() " << line.size(); |
| 376 | //kDebug() << "count " << count; |
| 377 | |
| 378 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( startColumn <= line.size() - count ); |
| 379 | |
| 380 | memcpy(buffer, line.constDatacxx . . $ QVector#constData(1016ee5406d91ab9).() + startColumn , count * sizeof(Charactercxx . . $ Konsole/Character#)); |
| 381 | } |
| 382 | |
| 383 | void HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::setMaxNbLinescxx . . $ Konsole/HistoryScrollBuffer#setMaxNbLines(cb2f890c2fdad230).(unsigned int lineCount) |
| 384 | { |
| 385 | HistoryLinecxx . . $ Konsole/HistoryScrollBuffer#HistoryLine#* oldBuffer = _historyBuffercxx . . $ Konsole/HistoryScrollBuffer#_historyBuffer.; |
| 386 | HistoryLinecxx . . $ Konsole/HistoryScrollBuffer#HistoryLine#* newBuffer = new HistoryLinecxx . . $ Konsole/HistoryScrollBuffer#HistoryLine#[lineCount]; |
| 387 | |
| 388 | for ( int i = 0 ; i < qMincxx . . $ qMin(2a338fce5842aa6a).(_usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.,(int)lineCount) ; i++ ) |
| 389 | { |
| 390 | newBuffer[i] =cxx . . $ QVector#`operator=`(c90ab23731af0b5e). oldBuffer[bufferIndexcxx . . $ Konsole/HistoryScrollBuffer#bufferIndex(7ccb52b1bfe01045).(i)]; |
| 391 | } |
| 392 | |
| 393 | _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines. = qMincxx . . $ qMin(2a338fce5842aa6a).(_usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.,(int)lineCount); |
| 394 | _maxLineCountcxx . . $ Konsole/HistoryScrollBuffer#_maxLineCount. = lineCount; |
| 395 | _headcxx . . $ Konsole/HistoryScrollBuffer#_head. = ( _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines. == _maxLineCountcxx . . $ Konsole/HistoryScrollBuffer#_maxLineCount. ) ? 0 : _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines.-1; |
| 396 | |
| 397 | _historyBuffercxx . . $ Konsole/HistoryScrollBuffer#_historyBuffer. = newBuffer; |
| 398 | delete[] oldBuffer; |
| 399 | |
| 400 | _wrappedLinecxx . . $ Konsole/HistoryScrollBuffer#_wrappedLine..resizecxx . . $ QBitArray#resize(d4f767463ce0a6b3).(lineCount); |
| 401 | dynamic_cast<HistoryTypeBuffercxx . . $ Konsole/HistoryTypeBuffer#*>(m_histTypecxx . . $ Konsole/HistoryScroll#m_histType.)->m_nbLinescxx . . $ Konsole/HistoryTypeBuffer#m_nbLines. = lineCount; |
| 402 | } |
| 403 | |
| 404 | int HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#::bufferIndexcxx . . $ Konsole/HistoryScrollBuffer#bufferIndex(7ccb52b1bfe01045).(int lineNumber) const |
| 405 | { |
| 406 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( lineNumber >= 0 ); |
| 407 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( lineNumber < _maxLineCount ); |
| 408 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( (_usedLines == _maxLineCount) || lineNumber <= _head ); |
| 409 | |
| 410 | if ( _usedLinescxx . . $ Konsole/HistoryScrollBuffer#_usedLines. == _maxLineCountcxx . . $ Konsole/HistoryScrollBuffer#_maxLineCount. ) |
| 411 | { |
| 412 | return (_headcxx . . $ Konsole/HistoryScrollBuffer#_head.+lineNumber+1) % _maxLineCountcxx . . $ Konsole/HistoryScrollBuffer#_maxLineCount.; |
| 413 | } |
| 414 | else |
| 415 | { |
| 416 | return lineNumber; |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | |
| 421 | // History Scroll None ////////////////////////////////////// |
| 422 | |
| 423 | HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#::HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#HistoryScrollNone(49f6e7a06ebc5aa8).() |
| 424 | : HistoryScrollcxx . . $ Konsole/HistoryScroll#(new HistoryTypeNonecxx . . $ Konsole/HistoryTypeNone#()) |
| 425 | { |
| 426 | } |
| 427 | |
| 428 | HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#::~cxx . . $ Konsole/HistoryScrollNone#`~HistoryScrollNone`(ced63f7c635d850d).HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#() |
| 429 | { |
| 430 | } |
| 431 | |
| 432 | bool HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#::hasScrollcxx . . $ Konsole/HistoryScrollNone#hasScroll(c9857a73d68e59ba).() |
| 433 | { |
| 434 | return false; |
| 435 | } |
| 436 | |
| 437 | int HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#::getLinescxx . . $ Konsole/HistoryScrollNone#getLines(b126dc7c1de90089).() |
| 438 | { |
| 439 | return 0; |
| 440 | } |
| 441 | |
| 442 | int HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#::getLineLencxx . . $ Konsole/HistoryScrollNone#getLineLen(7864480464b09eea).(int) |
| 443 | { |
| 444 | return 0; |
| 445 | } |
| 446 | |
| 447 | bool HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#::isWrappedLinecxx . . $ Konsole/HistoryScrollNone#isWrappedLine(83c267b20bac841a).(int /*lineno*/) |
| 448 | { |
| 449 | return false; |
| 450 | } |
| 451 | |
| 452 | void HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#::getCellscxx . . $ Konsole/HistoryScrollNone#getCells(ecb57fcf9e39244).(int, int, int, Charactercxx . . $ Konsole/Character# []) |
| 453 | { |
| 454 | } |
| 455 | |
| 456 | void HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#::addCellscxx . . $ Konsole/HistoryScrollNone#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# [], int) |
| 457 | { |
| 458 | } |
| 459 | |
| 460 | void HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#::addLinecxx . . $ Konsole/HistoryScrollNone#addLine(b45ddcbc8423892c).(bool) |
| 461 | { |
| 462 | } |
| 463 | |
| 464 | // History Scroll BlockArray ////////////////////////////////////// |
| 465 | |
| 466 | HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#::HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#HistoryScrollBlockArray(2c44cd906ae4e829).(size_t size) |
| 467 | : HistoryScrollcxx . . $ Konsole/HistoryScroll#(new HistoryTypeBlockArraycxx . . $ Konsole/HistoryTypeBlockArray#(size)) |
| 468 | { |
| 469 | m_blockArraycxx . . $ Konsole/HistoryScrollBlockArray#m_blockArray..setHistorySizecxx . . $ Konsole/BlockArray#setHistorySize(31596a199e1d8a50).(size); // nb. of lines. |
| 470 | } |
| 471 | |
| 472 | HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#::~cxx . . $ Konsole/HistoryScrollBlockArray#`~HistoryScrollBlockArray`(ced63f7c635d850d).HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#() |
| 473 | { |
| 474 | } |
| 475 | |
| 476 | int HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#::getLinescxx . . $ Konsole/HistoryScrollBlockArray#getLines(b126dc7c1de90089).() |
| 477 | { |
| 478 | return m_lineLengthscxx . . $ Konsole/HistoryScrollBlockArray#m_lineLengths..countcxx . . $ QHash#count(455f465bc33b4cdf).(); |
| 479 | } |
| 480 | |
| 481 | int HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#::getLineLencxx . . $ Konsole/HistoryScrollBlockArray#getLineLen(7864480464b09eea).(int lineno) |
| 482 | { |
| 483 | if ( m_lineLengthscxx . . $ Konsole/HistoryScrollBlockArray#m_lineLengths..containscxx . . $ QHash#contains(8877ebe272b9620d).(lineno) ) |
| 484 | return m_lineLengthscxx . . $ Konsole/HistoryScrollBlockArray#m_lineLengths.[cxx . . $ QHash#`operator[]`(bbd415b616967878).lineno]; |
| 485 | else |
| 486 | return 0; |
| 487 | } |
| 488 | |
| 489 | bool HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#::isWrappedLinecxx . . $ Konsole/HistoryScrollBlockArray#isWrappedLine(83c267b20bac841a).(int /*lineno*/) |
| 490 | { |
| 491 | return false; |
| 492 | } |
| 493 | |
| 494 | void HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#::getCellscxx . . $ Konsole/HistoryScrollBlockArray#getCells(ecb57fcf9e39244).(int lineno, int colno, |
| 495 | int count, Charactercxx . . $ Konsole/Character# res[]) |
| 496 | { |
| 497 | if (!count) return; |
| 498 | |
| 499 | const Blockcxx . . $ Konsole/Block# *b = m_blockArraycxx . . $ Konsole/HistoryScrollBlockArray#m_blockArray..atcxx . . $ Konsole/BlockArray#at(7d5b4b52cd5680c7).(lineno); |
| 500 | |
| 501 | if (!b) { |
| 502 | memset(static_cast<void*>(res), 0, count * sizeof(Charactercxx . . $ Konsole/Character#)); // still better than random data |
| 503 | return; |
| 504 | } |
| 505 | |
| 506 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!(((colno + count) * sizeof(Character)) < ENTRIEScxx . . $ `lib/BlockArray.h:31:9`!); |
| 507 | memcpy(res, b->datacxx . . $ Konsole/Block#data. + (colno * sizeof(Charactercxx . . $ Konsole/Character#)), count * sizeof(Charactercxx . . $ Konsole/Character#)); |
| 508 | } |
| 509 | |
| 510 | void HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#::addCellscxx . . $ Konsole/HistoryScrollBlockArray#addCells(c93a48d9295084cf).(const Charactercxx . . $ Konsole/Character# a[], int count) |
| 511 | { |
| 512 | Blockcxx . . $ Konsole/Block# *b = m_blockArraycxx . . $ Konsole/HistoryScrollBlockArray#m_blockArray..lastBlockcxx . . $ Konsole/BlockArray#lastBlock(ed43a5b5d99d0b0e).(); |
| 513 | |
| 514 | if (!b) return; |
| 515 | |
| 516 | // put cells in block's data |
| 517 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!((count * sizeof(Character)) < ENTRIEScxx . . $ `lib/BlockArray.h:31:9`!); |
| 518 | |
| 519 | memset(b->datacxx . . $ Konsole/Block#data., 0, sizeof(b->datacxx . . $ Konsole/Block#data.)); |
| 520 | |
| 521 | memcpy(b->datacxx . . $ Konsole/Block#data., a, count * sizeof(Charactercxx . . $ Konsole/Character#)); |
| 522 | b->sizecxx . . $ Konsole/Block#size. = count * sizeof(Charactercxx . . $ Konsole/Character#); |
| 523 | |
| 524 | size_t res = m_blockArraycxx . . $ Konsole/HistoryScrollBlockArray#m_blockArray..newBlockcxx . . $ Konsole/BlockArray#newBlock(f708dce9a8856c70).(); |
| 525 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!(res > 0); |
| 526 | Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!( res ); |
| 527 | |
| 528 | m_lineLengthscxx . . $ Konsole/HistoryScrollBlockArray#m_lineLengths..insertcxx . . $ QHash#insert(d77b19c31d2eb147).(m_blockArraycxx . . $ Konsole/HistoryScrollBlockArray#m_blockArray..getCurrentcxx . . $ Konsole/BlockArray#getCurrent(fe4d2d262d4164a8).(), count); |
| 529 | } |
| 530 | |
| 531 | void HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#::addLinecxx . . $ Konsole/HistoryScrollBlockArray#addLine(b45ddcbc8423892c).(bool) |
| 532 | { |
| 533 | } |
| 534 | |
| 535 | //////////////////////////////////////////////////////////////// |
| 536 | // Compact History Scroll ////////////////////////////////////// |
| 537 | //////////////////////////////////////////////////////////////// |
| 538 | void* CompactHistoryBlockcxx . . $ Konsole/CompactHistoryBlock#::allocatecxx . . $ Konsole/CompactHistoryBlock#allocate(bfcfa4d6b7f7ef64). ( size_t length ) |
| 539 | { |
| 540 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( length > 0 ); |
| 541 | if ( tailcxx . . $ Konsole/CompactHistoryBlock#tail.-blockStartcxx . . $ Konsole/CompactHistoryBlock#blockStart.+length > blockLengthcxx . . $ Konsole/CompactHistoryBlock#blockLength. ) |
| 542 | return nullptr; |
| 543 | |
| 544 | void* block = tailcxx . . $ Konsole/CompactHistoryBlock#tail.; |
| 545 | tailcxx . . $ Konsole/CompactHistoryBlock#tail. += length; |
| 546 | //kDebug() << "allocated " << length << " bytes at address " << block; |
| 547 | allocCountcxx . . $ Konsole/CompactHistoryBlock#allocCount.++; |
| 548 | return block; |
| 549 | } |
| 550 | |
| 551 | void CompactHistoryBlockcxx . . $ Konsole/CompactHistoryBlock#::deallocatecxx . . $ Konsole/CompactHistoryBlock#deallocate(49f6e7a06ebc5aa8). ( ) |
| 552 | { |
| 553 | allocCountcxx . . $ Konsole/CompactHistoryBlock#allocCount.--; |
| 554 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( allocCount >= 0 ); |
| 555 | } |
| 556 | |
| 557 | void* CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#::allocatecxx . . $ Konsole/CompactHistoryBlockList#allocate(bfcfa4d6b7f7ef64).(size_t size) |
| 558 | { |
| 559 | CompactHistoryBlockcxx . . $ Konsole/CompactHistoryBlock#* block; |
| 560 | if ( listcxx . . $ Konsole/CompactHistoryBlockList#list..isEmptycxx . . $ QList#isEmpty(3482b152b9333168).() || listcxx . . $ Konsole/CompactHistoryBlockList#list..lastcxx . . $ QList#last(19b2b6f17af048b).()->remainingcxx . . $ Konsole/CompactHistoryBlock#remaining(db52760e79bf9054).() < size) |
| 561 | { |
| 562 | block = new CompactHistoryBlockcxx . . $ Konsole/CompactHistoryBlock#(); |
| 563 | listcxx . . $ Konsole/CompactHistoryBlockList#list..appendcxx . . $ QList#append(77d9f17553126ecb). ( block ); |
| 564 | //kDebug() << "new block created, remaining " << block->remaining() << "number of blocks=" << list.size(); |
| 565 | } |
| 566 | else |
| 567 | { |
| 568 | block = listcxx . . $ Konsole/CompactHistoryBlockList#list..lastcxx . . $ QList#last(19b2b6f17af048b).(); |
| 569 | //kDebug() << "old block used, remaining " << block->remaining(); |
| 570 | } |
| 571 | return block->allocatecxx . . $ Konsole/CompactHistoryBlock#allocate(bfcfa4d6b7f7ef64).(size); |
| 572 | } |
| 573 | |
| 574 | void CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#::deallocatecxx . . $ Konsole/CompactHistoryBlockList#deallocate(5d22bdacc48458e8).(void* ptr) |
| 575 | { |
| 576 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( !list.isEmpty()); |
| 577 | |
| 578 | int i=0; |
| 579 | CompactHistoryBlockcxx . . $ Konsole/CompactHistoryBlock# *block = listcxx . . $ Konsole/CompactHistoryBlockList#list..atcxx . . $ QList#at(e2681f9bb6b2f357).(i); |
| 580 | while ( i<listcxx . . $ Konsole/CompactHistoryBlockList#list..sizecxx . . $ QList#size(ea6fe5115c70a13f).() && !block->containscxx . . $ Konsole/CompactHistoryBlock#contains(db00c6a08f501612).(ptr) ) |
| 581 | { |
| 582 | i++; |
| 583 | block=listcxx . . $ Konsole/CompactHistoryBlockList#list..atcxx . . $ QList#at(e2681f9bb6b2f357).(i); |
| 584 | } |
| 585 | |
| 586 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!( i<list.size() ); |
| 587 | |
| 588 | block->deallocatecxx . . $ Konsole/CompactHistoryBlock#deallocate(49f6e7a06ebc5aa8).(); |
| 589 | |
| 590 | if (!block->isInUsecxx . . $ Konsole/CompactHistoryBlock#isInUse(c9857a73d68e59ba).()) |
| 591 | { |
| 592 | listcxx . . $ Konsole/CompactHistoryBlockList#list..removeAtcxx . . $ QList#removeAt(d4f767463ce0a6b3).(i); |
| 593 | delete block; |
| 594 | //kDebug() << "block deleted, new size = " << list.size(); |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#::~cxx . . $ Konsole/CompactHistoryBlockList#`~CompactHistoryBlockList`(ced63f7c635d850d).CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#() |
| 599 | { |
| 600 | qDeleteAllcxx . . $ qDeleteAll(249673c20e2b8d5). ( listcxx . . $ Konsole/CompactHistoryBlockList#list..begincxx . . $ QList#begin(ca2520f641887418).(), listcxx . . $ Konsole/CompactHistoryBlockList#list..endcxx . . $ QList#end(ca2520f641887418).() ); |
| 601 | listcxx . . $ Konsole/CompactHistoryBlockList#list..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 602 | } |
| 603 | |
| 604 | void* CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#::operatorcxx . . $ Konsole/CompactHistoryLine#`operator new`(c29bf00dce6c1e9e). new (size_t size, CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#& blockList) |
| 605 | { |
| 606 | return blockList.allocatecxx . . $ Konsole/CompactHistoryBlockList#allocate(bfcfa4d6b7f7ef64).(size); |
| 607 | } |
| 608 | |
| 609 | CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#::CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#CompactHistoryLine(3a09ffb36558665). ( const TextLinecxx . . $ Konsole/TextLine#& line, CompactHistoryBlockListcxx . . $ Konsole/CompactHistoryBlockList#& bList ) |
| 610 | : blockListcxx . . $ Konsole/CompactHistoryLine#blockList.(bList), |
| 611 | formatLengthcxx . . $ Konsole/CompactHistoryLine#formatLength.(0) |
| 612 | { |
| 613 | lengthcxx . . $ Konsole/CompactHistoryLine#length.=line.sizecxx . . $ QVector#size(455f465bc33b4cdf).(); |
| 614 | |
| 615 | if (!line.emptycxx . . $ QVector#empty(50ce9a9e25b4a850).()) { |
| 616 | formatLengthcxx . . $ Konsole/CompactHistoryLine#formatLength.=1; |
| 617 | int k=1; |
| 618 | |
| 619 | // count number of different formats in this text line |
| 620 | Charactercxx . . $ Konsole/Character# c = line[cxx . . $ QVector#`operator[]`(e2681f9bb6b2f357).0]; |
| 621 | while ( k<lengthcxx . . $ Konsole/CompactHistoryLine#length. ) |
| 622 | { |
| 623 | if ( !(line[cxx . . $ QVector#`operator[]`(e2681f9bb6b2f357).k].equalsFormatcxx . . $ Konsole/Character#equalsFormat(3a60cc5fc593e4b3).(c))) |
| 624 | { |
| 625 | formatLengthcxx . . $ Konsole/CompactHistoryLine#formatLength.++; // format change detected |
| 626 | c=cxx . . $ Konsole/Character#`operator=`(2e86fbf6b92c0a89).line[cxx . . $ QVector#`operator[]`(e2681f9bb6b2f357).k]; |
| 627 | } |
| 628 | k++; |
| 629 | } |
| 630 | |
| 631 | //kDebug() << "number of different formats in string: " << formatLength; |
| 632 | formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray. = (CharacterFormatcxx . . $ Konsole/CharacterFormat#*) blockListcxx . . $ Konsole/CompactHistoryLine#blockList..allocatecxx . . $ Konsole/CompactHistoryBlockList#allocate(bfcfa4d6b7f7ef64).(sizeof(CharacterFormatcxx . . $ Konsole/CharacterFormat#)*formatLengthcxx . . $ Konsole/CompactHistoryLine#formatLength.); |
| 633 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! (formatArray!=nullptr); |
| 634 | textcxx . . $ Konsole/CompactHistoryLine#text. = (quint16cxx . . $ quint16#*) blockListcxx . . $ Konsole/CompactHistoryLine#blockList..allocatecxx . . $ Konsole/CompactHistoryBlockList#allocate(bfcfa4d6b7f7ef64).(sizeof(quint16cxx . . $ quint16#)*line.sizecxx . . $ QVector#size(455f465bc33b4cdf).()); |
| 635 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! (text!=nullptr); |
| 636 | |
| 637 | lengthcxx . . $ Konsole/CompactHistoryLine#length.=line.sizecxx . . $ QVector#size(455f465bc33b4cdf).(); |
| 638 | wrappedcxx . . $ Konsole/CompactHistoryLine#wrapped.=false; |
| 639 | |
| 640 | // record formats and their positions in the format array |
| 641 | c=cxx . . $ Konsole/Character#`operator=`(2e86fbf6b92c0a89).line[cxx . . $ QVector#`operator[]`(e2681f9bb6b2f357).0]; |
| 642 | formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.[0].setFormatcxx . . $ Konsole/CharacterFormat#setFormat(918d3bd737932f15). ( c ); |
| 643 | formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.[0].startPoscxx . . $ Konsole/CharacterFormat#startPos.=0; // there's always at least 1 format (for the entire line, unless a change happens) |
| 644 | |
| 645 | k=1; // look for possible format changes |
| 646 | int j=1; |
| 647 | while ( k<lengthcxx . . $ Konsole/CompactHistoryLine#length. && j<formatLengthcxx . . $ Konsole/CompactHistoryLine#formatLength. ) |
| 648 | { |
| 649 | if (!(line[cxx . . $ QVector#`operator[]`(e2681f9bb6b2f357).k].equalsFormatcxx . . $ Konsole/Character#equalsFormat(3a60cc5fc593e4b3).(c))) |
| 650 | { |
| 651 | c=cxx . . $ Konsole/Character#`operator=`(2e86fbf6b92c0a89).line[cxx . . $ QVector#`operator[]`(e2681f9bb6b2f357).k]; |
| 652 | formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.[j].setFormatcxx . . $ Konsole/CharacterFormat#setFormat(918d3bd737932f15).(c); |
| 653 | formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.[j].startPoscxx . . $ Konsole/CharacterFormat#startPos.=k; |
| 654 | //kDebug() << "format entry " << j << " at pos " << formatArray[j].startPos << " " << &(formatArray[j].startPos) ; |
| 655 | j++; |
| 656 | } |
| 657 | k++; |
| 658 | } |
| 659 | |
| 660 | // copy character values |
| 661 | for ( int i=0; i<line.sizecxx . . $ QVector#size(455f465bc33b4cdf).(); i++ ) |
| 662 | { |
| 663 | textcxx . . $ Konsole/CompactHistoryLine#text.[i]=line[cxx . . $ QVector#`operator[]`(e2681f9bb6b2f357).i].charactercxx . . $ Konsole/Character#$anonymous_type_0#character.; |
| 664 | //kDebug() << "char " << i << " at mem " << &(text[i]); |
| 665 | } |
| 666 | } |
| 667 | //kDebug() << "line created, length " << length << " at " << &(length); |
| 668 | } |
| 669 | |
| 670 | CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#::~cxx . . $ Konsole/CompactHistoryLine#`~CompactHistoryLine`(ced63f7c635d850d).CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#() |
| 671 | { |
| 672 | //kDebug() << "~CHL"; |
| 673 | if (lengthcxx . . $ Konsole/CompactHistoryLine#length.>0) { |
| 674 | blockListcxx . . $ Konsole/CompactHistoryLine#blockList..deallocatecxx . . $ Konsole/CompactHistoryBlockList#deallocate(5d22bdacc48458e8).(textcxx . . $ Konsole/CompactHistoryLine#text.); |
| 675 | blockListcxx . . $ Konsole/CompactHistoryLine#blockList..deallocatecxx . . $ Konsole/CompactHistoryBlockList#deallocate(5d22bdacc48458e8).(formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.); |
| 676 | } |
| 677 | blockListcxx . . $ Konsole/CompactHistoryLine#blockList..deallocatecxx . . $ Konsole/CompactHistoryBlockList#deallocate(5d22bdacc48458e8).(this); |
| 678 | } |
| 679 | |
| 680 | void CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#::getCharactercxx . . $ Konsole/CompactHistoryLine#getCharacter(d98d5e3bf4790af1). ( int index, Charactercxx . . $ Konsole/Character# &r ) |
| 681 | { |
| 682 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( index < length ); |
| 683 | int formatPos=0; |
| 684 | while ( ( formatPos+1 ) < formatLengthcxx . . $ Konsole/CompactHistoryLine#formatLength. && index >= formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.[formatPos+1].startPoscxx . . $ Konsole/CharacterFormat#startPos. ) |
| 685 | formatPos++; |
| 686 | |
| 687 | r.charactercxx . . $ Konsole/Character#$anonymous_type_0#character.=textcxx . . $ Konsole/CompactHistoryLine#text.[index]; |
| 688 | r.renditioncxx . . $ Konsole/Character#rendition. = formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.[formatPos].renditioncxx . . $ Konsole/CharacterFormat#rendition.; |
| 689 | r.foregroundColorcxx . . $ Konsole/Character#foregroundColor. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.[formatPos].fgColorcxx . . $ Konsole/CharacterFormat#fgColor.; |
| 690 | r.backgroundColorcxx . . $ Konsole/Character#backgroundColor. =cxx . . $ Konsole/CharacterColor#`operator=`(d3b4b4caeab41583). formatArraycxx . . $ Konsole/CompactHistoryLine#formatArray.[formatPos].bgColorcxx . . $ Konsole/CharacterFormat#bgColor.; |
| 691 | } |
| 692 | |
| 693 | void CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#::getCharacterscxx . . $ Konsole/CompactHistoryLine#getCharacters(9044b40aa8f691ab). ( Charactercxx . . $ Konsole/Character#* array, int length, int startColumn ) |
| 694 | { |
| 695 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( startColumn >= 0 && length >= 0 ); |
| 696 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( startColumn+length <= ( int ) getLength() ); |
| 697 | |
| 698 | for ( int i=startColumn; i<length+startColumn; i++ ) |
| 699 | { |
| 700 | getCharactercxx . . $ Konsole/CompactHistoryLine#getCharacter(d98d5e3bf4790af1). ( i, array[i-startColumn] ); |
| 701 | } |
| 702 | } |
| 703 | |
| 704 | CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#CompactHistoryScroll(cb2f890c2fdad230). ( unsigned int maxLineCount ) |
| 705 | : HistoryScrollcxx . . $ Konsole/HistoryScroll# ( new CompactHistoryTypecxx . . $ Konsole/CompactHistoryType# ( maxLineCount ) ) |
| 706 | ,linescxx . . $ Konsole/CompactHistoryScroll#lines.() |
| 707 | ,blockListcxx . . $ Konsole/CompactHistoryScroll#blockList.() |
| 708 | { |
| 709 | //kDebug() << "scroll of length " << maxLineCount << " created"; |
| 710 | setMaxNbLinescxx . . $ Konsole/CompactHistoryScroll#setMaxNbLines(cb2f890c2fdad230). ( maxLineCount ); |
| 711 | } |
| 712 | |
| 713 | CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::~cxx . . $ Konsole/CompactHistoryScroll#`~CompactHistoryScroll`(ced63f7c635d850d).CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#() |
| 714 | { |
| 715 | qDeleteAllcxx . . $ qDeleteAll(249673c20e2b8d5). ( linescxx . . $ Konsole/CompactHistoryScroll#lines..begincxx . . $ QList#begin(ca2520f641887418).(), linescxx . . $ Konsole/CompactHistoryScroll#lines..endcxx . . $ QList#end(ca2520f641887418).() ); |
| 716 | linescxx . . $ Konsole/CompactHistoryScroll#lines..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 717 | } |
| 718 | |
| 719 | void CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::addCellsVectorcxx . . $ Konsole/CompactHistoryScroll#addCellsVector(76a1241cccfbfdbf). ( const TextLinecxx . . $ Konsole/TextLine#& cells ) |
| 720 | { |
| 721 | CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine# *line; |
| 722 | line = new(blockListcxx . . $ Konsole/CompactHistoryScroll#blockList.) CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine# ( cells, blockListcxx . . $ Konsole/CompactHistoryScroll#blockList. ); |
| 723 | |
| 724 | if ( linescxx . . $ Konsole/CompactHistoryScroll#lines..sizecxx . . $ QList#size(ea6fe5115c70a13f).() > ( int ) _maxLineCountcxx . . $ Konsole/CompactHistoryScroll#_maxLineCount. ) |
| 725 | { |
| 726 | delete linescxx . . $ Konsole/CompactHistoryScroll#lines..takeAtcxx . . $ QList#takeAt(767fea59dce4185d). ( 0 ); |
| 727 | } |
| 728 | linescxx . . $ Konsole/CompactHistoryScroll#lines..appendcxx . . $ QList#append(77d9f17553126ecb). ( line ); |
| 729 | } |
| 730 | |
| 731 | void CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::addCellscxx . . $ Konsole/CompactHistoryScroll#addCells(c93a48d9295084cf). ( const Charactercxx . . $ Konsole/Character# a[], int count ) |
| 732 | { |
| 733 | TextLinecxx . . $ Konsole/TextLine# newLinecxx . . $ QVector#QVector(d4f767463ce0a6b3). ( count ); |
| 734 | stdcxx . . $ std/::copycxx . . $ std/copy(88304b602929f6f4). ( a,a+count,newLine.begincxx . . $ QVector#begin(a488e68b8120152a).() ); |
| 735 | addCellsVectorcxx . . $ Konsole/CompactHistoryScroll#addCellsVector(76a1241cccfbfdbf). ( newLine ); |
| 736 | } |
| 737 | |
| 738 | void CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::addLinecxx . . $ Konsole/CompactHistoryScroll#addLine(b45ddcbc8423892c). ( bool previousWrapped ) |
| 739 | { |
| 740 | CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine# *line = linescxx . . $ Konsole/CompactHistoryScroll#lines..lastcxx . . $ QList#last(19b2b6f17af048b).(); |
| 741 | //kDebug() << "last line at address " << line; |
| 742 | line->setWrappedcxx . . $ Konsole/CompactHistoryLine#setWrapped(b45ddcbc8423892c).(previousWrapped); |
| 743 | } |
| 744 | |
| 745 | int CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::getLinescxx . . $ Konsole/CompactHistoryScroll#getLines(b126dc7c1de90089).() |
| 746 | { |
| 747 | return linescxx . . $ Konsole/CompactHistoryScroll#lines..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); |
| 748 | } |
| 749 | |
| 750 | int CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::getLineLencxx . . $ Konsole/CompactHistoryScroll#getLineLen(7864480464b09eea). ( int lineNumber ) |
| 751 | { |
| 752 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( lineNumber >= 0 && lineNumber < lines.size() ); |
| 753 | CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#* line = linescxx . . $ Konsole/CompactHistoryScroll#lines.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).lineNumber]; |
| 754 | //kDebug() << "request for line at address " << line; |
| 755 | return line->getLengthcxx . . $ Konsole/CompactHistoryLine#getLength(ddd8539a2fcdd4ce).(); |
| 756 | } |
| 757 | |
| 758 | |
| 759 | void CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::getCellscxx . . $ Konsole/CompactHistoryScroll#getCells(ecb57fcf9e39244). ( int lineNumber, int startColumn, int count, Charactercxx . . $ Konsole/Character# buffer[] ) |
| 760 | { |
| 761 | if ( count == 0 ) return; |
| 762 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( lineNumber < lines.size() ); |
| 763 | CompactHistoryLinecxx . . $ Konsole/CompactHistoryLine#* line = linescxx . . $ Konsole/CompactHistoryScroll#lines.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).lineNumber]; |
| 764 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( startColumn >= 0 ); |
| 765 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( (unsigned int)startColumn <= line->getLength() - count ); |
| 766 | line->getCharacterscxx . . $ Konsole/CompactHistoryLine#getCharacters(9044b40aa8f691ab). ( buffer, count, startColumn ); |
| 767 | } |
| 768 | |
| 769 | void CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::setMaxNbLinescxx . . $ Konsole/CompactHistoryScroll#setMaxNbLines(cb2f890c2fdad230). ( unsigned int lineCount ) |
| 770 | { |
| 771 | _maxLineCountcxx . . $ Konsole/CompactHistoryScroll#_maxLineCount. = lineCount; |
| 772 | |
| 773 | while (linescxx . . $ Konsole/CompactHistoryScroll#lines..sizecxx . . $ QList#size(ea6fe5115c70a13f).() > (int) lineCount) { |
| 774 | delete linescxx . . $ Konsole/CompactHistoryScroll#lines..takeAtcxx . . $ QList#takeAt(767fea59dce4185d).(0); |
| 775 | } |
| 776 | //kDebug() << "set max lines to: " << _maxLineCount; |
| 777 | } |
| 778 | |
| 779 | bool CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#::isWrappedLinecxx . . $ Konsole/CompactHistoryScroll#isWrappedLine(83c267b20bac841a). ( int lineNumber ) |
| 780 | { |
| 781 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`! ( lineNumber < lines.size() ); |
| 782 | return linescxx . . $ Konsole/CompactHistoryScroll#lines.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).lineNumber]->isWrappedcxx . . $ Konsole/CompactHistoryLine#isWrapped(50ce9a9e25b4a850).(); |
| 783 | } |
| 784 | |
| 785 | |
| 786 | ////////////////////////////////////////////////////////////////////// |
| 787 | // History Types |
| 788 | ////////////////////////////////////////////////////////////////////// |
| 789 | |
| 790 | HistoryTypecxx . . $ Konsole/HistoryType#::HistoryTypecxx . . $ Konsole/HistoryType#HistoryType(49f6e7a06ebc5aa8).() |
| 791 | { |
| 792 | } |
| 793 | |
| 794 | HistoryTypecxx . . $ Konsole/HistoryType#::~cxx . . $ Konsole/HistoryType#`~HistoryType`(ced63f7c635d850d).HistoryTypecxx . . $ Konsole/HistoryType#() |
| 795 | { |
| 796 | } |
| 797 | |
| 798 | ////////////////////////////// |
| 799 | |
| 800 | HistoryTypeNonecxx . . $ Konsole/HistoryTypeNone#::HistoryTypeNonecxx . . $ Konsole/HistoryTypeNone#HistoryTypeNone(49f6e7a06ebc5aa8).() |
| 801 | { |
| 802 | } |
| 803 | |
| 804 | bool HistoryTypeNonecxx . . $ Konsole/HistoryTypeNone#::isEnabledcxx . . $ Konsole/HistoryTypeNone#isEnabled(50ce9a9e25b4a850).() const |
| 805 | { |
| 806 | return false; |
| 807 | } |
| 808 | |
| 809 | HistoryScrollcxx . . $ Konsole/HistoryScroll#* HistoryTypeNonecxx . . $ Konsole/HistoryTypeNone#::scrollcxx . . $ Konsole/HistoryTypeNone#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *old) const |
| 810 | { |
| 811 | delete old; |
| 812 | return new HistoryScrollNonecxx . . $ Konsole/HistoryScrollNone#(); |
| 813 | } |
| 814 | |
| 815 | int HistoryTypeNonecxx . . $ Konsole/HistoryTypeNone#::maximumLineCountcxx . . $ Konsole/HistoryTypeNone#maximumLineCount(455f465bc33b4cdf).() const |
| 816 | { |
| 817 | return 0; |
| 818 | } |
| 819 | |
| 820 | ////////////////////////////// |
| 821 | |
| 822 | HistoryTypeBlockArraycxx . . $ Konsole/HistoryTypeBlockArray#::HistoryTypeBlockArraycxx . . $ Konsole/HistoryTypeBlockArray#HistoryTypeBlockArray(2c44cd906ae4e829).(size_t size) |
| 823 | : m_sizecxx . . $ Konsole/HistoryTypeBlockArray#m_size.(size) |
| 824 | { |
| 825 | } |
| 826 | |
| 827 | bool HistoryTypeBlockArraycxx . . $ Konsole/HistoryTypeBlockArray#::isEnabledcxx . . $ Konsole/HistoryTypeBlockArray#isEnabled(50ce9a9e25b4a850).() const |
| 828 | { |
| 829 | return true; |
| 830 | } |
| 831 | |
| 832 | int HistoryTypeBlockArraycxx . . $ Konsole/HistoryTypeBlockArray#::maximumLineCountcxx . . $ Konsole/HistoryTypeBlockArray#maximumLineCount(455f465bc33b4cdf).() const |
| 833 | { |
| 834 | return m_sizecxx . . $ Konsole/HistoryTypeBlockArray#m_size.; |
| 835 | } |
| 836 | |
| 837 | HistoryScrollcxx . . $ Konsole/HistoryScroll#* HistoryTypeBlockArraycxx . . $ Konsole/HistoryTypeBlockArray#::scrollcxx . . $ Konsole/HistoryTypeBlockArray#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *old) const |
| 838 | { |
| 839 | delete old; |
| 840 | return new HistoryScrollBlockArraycxx . . $ Konsole/HistoryScrollBlockArray#(m_sizecxx . . $ Konsole/HistoryTypeBlockArray#m_size.); |
| 841 | } |
| 842 | |
| 843 | |
| 844 | ////////////////////////////// |
| 845 | |
| 846 | HistoryTypeBuffercxx . . $ Konsole/HistoryTypeBuffer#::HistoryTypeBuffercxx . . $ Konsole/HistoryTypeBuffer#HistoryTypeBuffer(cb2f890c2fdad230).(unsigned int nbLines) |
| 847 | : m_nbLinescxx . . $ Konsole/HistoryTypeBuffer#m_nbLines.(nbLines) |
| 848 | { |
| 849 | } |
| 850 | |
| 851 | bool HistoryTypeBuffercxx . . $ Konsole/HistoryTypeBuffer#::isEnabledcxx . . $ Konsole/HistoryTypeBuffer#isEnabled(50ce9a9e25b4a850).() const |
| 852 | { |
| 853 | return true; |
| 854 | } |
| 855 | |
| 856 | int HistoryTypeBuffercxx . . $ Konsole/HistoryTypeBuffer#::maximumLineCountcxx . . $ Konsole/HistoryTypeBuffer#maximumLineCount(455f465bc33b4cdf).() const |
| 857 | { |
| 858 | return m_nbLinescxx . . $ Konsole/HistoryTypeBuffer#m_nbLines.; |
| 859 | } |
| 860 | |
| 861 | HistoryScrollcxx . . $ Konsole/HistoryScroll#* HistoryTypeBuffercxx . . $ Konsole/HistoryTypeBuffer#::scrollcxx . . $ Konsole/HistoryTypeBuffer#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *old) const |
| 862 | { |
| 863 | if (old) |
| 864 | { |
| 865 | HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer# *oldBuffer = dynamic_cast<HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#*>(old); |
| 866 | if (oldBuffer) |
| 867 | { |
| 868 | oldBuffer->setMaxNbLinescxx . . $ Konsole/HistoryScrollBuffer#setMaxNbLines(cb2f890c2fdad230).(m_nbLinescxx . . $ Konsole/HistoryTypeBuffer#m_nbLines.); |
| 869 | return oldBuffer; |
| 870 | } |
| 871 | |
| 872 | HistoryScrollcxx . . $ Konsole/HistoryScroll# *newScroll = new HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#(m_nbLinescxx . . $ Konsole/HistoryTypeBuffer#m_nbLines.); |
| 873 | int lines = old->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).(); |
| 874 | int startLine = 0; |
| 875 | if (lines > (int) m_nbLinescxx . . $ Konsole/HistoryTypeBuffer#m_nbLines.) |
| 876 | startLine = lines - m_nbLinescxx . . $ Konsole/HistoryTypeBuffer#m_nbLines.; |
| 877 | |
| 878 | Charactercxx . . $ Konsole/Character# linecxx . . $ Konsole/Character#Character(775c6e5ba34caf00).[LINE_SIZEcxx . . $ `lib/History.cpp:41:9`!]; |
| 879 | for(int i = startLine; i < lines; i++) |
| 880 | { |
| 881 | int size = old->getLineLencxx . . $ Konsole/HistoryScroll#getLineLen(7864480464b09eea).(i); |
| 882 | if (size > LINE_SIZEcxx . . $ `lib/History.cpp:41:9`!) |
| 883 | { |
| 884 | Charactercxx . . $ Konsole/Character# *tmp_line = new Charactercxx . . $ Konsole/Character#Character(775c6e5ba34caf00).[size]; |
| 885 | old->getCellscxx . . $ Konsole/HistoryScroll#getCells(ecb57fcf9e39244).(i, 0, size, tmp_line); |
| 886 | newScroll->addCellscxx . . $ Konsole/HistoryScroll#addCells(c93a48d9295084cf).(tmp_line, size); |
| 887 | newScroll->addLinecxx . . $ Konsole/HistoryScroll#addLine(b45ddcbc8423892c).(old->isWrappedLinecxx . . $ Konsole/HistoryScroll#isWrappedLine(83c267b20bac841a).(i)); |
| 888 | delete [] tmp_line; |
| 889 | } |
| 890 | else |
| 891 | { |
| 892 | old->getCellscxx . . $ Konsole/HistoryScroll#getCells(ecb57fcf9e39244).(i, 0, size, line); |
| 893 | newScroll->addCellscxx . . $ Konsole/HistoryScroll#addCells(c93a48d9295084cf).(line, size); |
| 894 | newScroll->addLinecxx . . $ Konsole/HistoryScroll#addLine(b45ddcbc8423892c).(old->isWrappedLinecxx . . $ Konsole/HistoryScroll#isWrappedLine(83c267b20bac841a).(i)); |
| 895 | } |
| 896 | } |
| 897 | delete old; |
| 898 | return newScroll; |
| 899 | } |
| 900 | return new HistoryScrollBuffercxx . . $ Konsole/HistoryScrollBuffer#(m_nbLinescxx . . $ Konsole/HistoryTypeBuffer#m_nbLines.); |
| 901 | } |
| 902 | |
| 903 | ////////////////////////////// |
| 904 | |
| 905 | HistoryTypeFilecxx . . $ Konsole/HistoryTypeFile#::HistoryTypeFilecxx . . $ Konsole/HistoryTypeFile#HistoryTypeFile(3520e46b33348bf6).(const QStringcxx . . $ QString#& fileName) |
| 906 | : m_fileNamecxx . . $ Konsole/HistoryTypeFile#m_fileName.(fileName) |
| 907 | { |
| 908 | } |
| 909 | |
| 910 | bool HistoryTypeFilecxx . . $ Konsole/HistoryTypeFile#::isEnabledcxx . . $ Konsole/HistoryTypeFile#isEnabled(50ce9a9e25b4a850).() const |
| 911 | { |
| 912 | return true; |
| 913 | } |
| 914 | |
| 915 | const QStringcxx . . $ QString#& HistoryTypeFilecxx . . $ Konsole/HistoryTypeFile#::getFileNamecxx . . $ Konsole/HistoryTypeFile#getFileName(a2fb7a6ce195d51).() const |
| 916 | { |
| 917 | return m_fileNamecxx . . $ Konsole/HistoryTypeFile#m_fileName.; |
| 918 | } |
| 919 | |
| 920 | HistoryScrollcxx . . $ Konsole/HistoryScroll#* HistoryTypeFilecxx . . $ Konsole/HistoryTypeFile#::scrollcxx . . $ Konsole/HistoryTypeFile#scroll(a5ef36c6e2fab2f9).(HistoryScrollcxx . . $ Konsole/HistoryScroll# *old) const |
| 921 | { |
| 922 | if (dynamic_cast<HistoryFilecxx . . $ Konsole/HistoryFile# *>(old)) |
| 923 | return old; // Unchanged. |
| 924 | |
| 925 | HistoryScrollcxx . . $ Konsole/HistoryScroll# *newScroll = new HistoryScrollFilecxx . . $ Konsole/HistoryScrollFile#(m_fileNamecxx . . $ Konsole/HistoryTypeFile#m_fileName.); |
| 926 | |
| 927 | Charactercxx . . $ Konsole/Character# linecxx . . $ Konsole/Character#Character(775c6e5ba34caf00).[LINE_SIZEcxx . . $ `lib/History.cpp:41:9`!]; |
| 928 | int lines = (old != nullptr) ? old->getLinescxx . . $ Konsole/HistoryScroll#getLines(b126dc7c1de90089).() : 0; |
| 929 | for(int i = 0; i < lines; i++) |
| 930 | { |
| 931 | int size = old->getLineLencxx . . $ Konsole/HistoryScroll#getLineLen(7864480464b09eea).(i); |
| 932 | if (size > LINE_SIZEcxx . . $ `lib/History.cpp:41:9`!) |
| 933 | { |
| 934 | Charactercxx . . $ Konsole/Character# *tmp_line = new Charactercxx . . $ Konsole/Character#Character(775c6e5ba34caf00).[size]; |
| 935 | old->getCellscxx . . $ Konsole/HistoryScroll#getCells(ecb57fcf9e39244).(i, 0, size, tmp_line); |
| 936 | newScroll->addCellscxx . . $ Konsole/HistoryScroll#addCells(c93a48d9295084cf).(tmp_line, size); |
| 937 | newScroll->addLinecxx . . $ Konsole/HistoryScroll#addLine(b45ddcbc8423892c).(old->isWrappedLinecxx . . $ Konsole/HistoryScroll#isWrappedLine(83c267b20bac841a).(i)); |
| 938 | delete [] tmp_line; |
| 939 | } |
| 940 | else |
| 941 | { |
| 942 | old->getCellscxx . . $ Konsole/HistoryScroll#getCells(ecb57fcf9e39244).(i, 0, size, line); |
| 943 | newScroll->addCellscxx . . $ Konsole/HistoryScroll#addCells(c93a48d9295084cf).(line, size); |
| 944 | newScroll->addLinecxx . . $ Konsole/HistoryScroll#addLine(b45ddcbc8423892c).(old->isWrappedLinecxx . . $ Konsole/HistoryScroll#isWrappedLine(83c267b20bac841a).(i)); |
| 945 | } |
| 946 | } |
| 947 | |
| 948 | delete old; |
| 949 | return newScroll; |
| 950 | } |
| 951 | |
| 952 | int HistoryTypeFilecxx . . $ Konsole/HistoryTypeFile#::maximumLineCountcxx . . $ Konsole/HistoryTypeFile#maximumLineCount(455f465bc33b4cdf).() const |
| 953 | { |
| 954 | return 0; |
| 955 | } |
| 956 | |
| 957 | ////////////////////////////// |
| 958 | |
| 959 | CompactHistoryTypecxx . . $ Konsole/CompactHistoryType#::CompactHistoryTypecxx . . $ Konsole/CompactHistoryType#CompactHistoryType(cb2f890c2fdad230). ( unsigned int nbLines ) |
| 960 | : m_nbLinescxx . . $ Konsole/CompactHistoryType#m_nbLines. ( nbLines ) |
| 961 | { |
| 962 | } |
| 963 | |
| 964 | bool CompactHistoryTypecxx . . $ Konsole/CompactHistoryType#::isEnabledcxx . . $ Konsole/CompactHistoryType#isEnabled(50ce9a9e25b4a850).() const |
| 965 | { |
| 966 | return true; |
| 967 | } |
| 968 | |
| 969 | int CompactHistoryTypecxx . . $ Konsole/CompactHistoryType#::maximumLineCountcxx . . $ Konsole/CompactHistoryType#maximumLineCount(455f465bc33b4cdf).() const |
| 970 | { |
| 971 | return m_nbLinescxx . . $ Konsole/CompactHistoryType#m_nbLines.; |
| 972 | } |
| 973 | |
| 974 | HistoryScrollcxx . . $ Konsole/HistoryScroll#* CompactHistoryTypecxx . . $ Konsole/CompactHistoryType#::scrollcxx . . $ Konsole/CompactHistoryType#scroll(a5ef36c6e2fab2f9). ( HistoryScrollcxx . . $ Konsole/HistoryScroll# *old ) const |
| 975 | { |
| 976 | if ( old ) |
| 977 | { |
| 978 | CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll# *oldBuffer = dynamic_cast<CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll#*> ( old ); |
| 979 | if ( oldBuffer ) |
| 980 | { |
| 981 | oldBuffer->setMaxNbLinescxx . . $ Konsole/CompactHistoryScroll#setMaxNbLines(cb2f890c2fdad230). ( m_nbLinescxx . . $ Konsole/CompactHistoryType#m_nbLines. ); |
| 982 | return oldBuffer; |
| 983 | } |
| 984 | delete old; |
| 985 | } |
| 986 | return new CompactHistoryScrollcxx . . $ Konsole/CompactHistoryScroll# ( m_nbLinescxx . . $ Konsole/CompactHistoryType#m_nbLines. ); |
| 987 | } |