370
368
* @param startLine Index of first line to copy
371
369
* @param endLine Index of last line to copy
373
void getImage( Character* dest , int size , int startLine , int endLine ) const;
371
void getImage(Character* dest , int size , int startLine , int endLine) const;
376
374
* Returns the additional attributes associated with lines in the image.
378
376
* line is wrapped,
379
377
* other attributes control the size of characters in the line.
381
QVector<LineProperty> getLineProperties( int startLine , int endLine ) const;
379
QVector<LineProperty> getLineProperties(int startLine , int endLine) const;
384
381
/** Return the number of lines. */
382
int getLines() const {
387
385
/** Return the number of columns. */
388
int getColumns() const
386
int getColumns() const {
390
389
/** Return the number of lines in the history buffer. */
391
390
int getHistLines() const;
449
448
QString selectedText(bool preserveLineBreaks) const;
451
* Convenience method. Returns the text from @p startIndex to @p endIndex.
452
* @param preserveLineBreaks Specifies whether new line characters should
453
* be inserted into the returned text at the end of each terminal line.
455
QString text(int startIndex, int endIndex, bool preserveLineBreaks) const;
452
458
* Copies part of the output to a stream.
454
460
* @param decoder A decoder which converts terminal characters into text
548
554
static void fillWithDefaultChar(Character* dest, int count);
550
void setCurrentTerminalDisplay(TerminalDisplay* display)
552
_currentTerminalDisplay = display;
556
void setCurrentTerminalDisplay(TerminalDisplay* display) {
557
_currentTerminalDisplay = display;
555
TerminalDisplay* currentTerminalDisplay()
560
TerminalDisplay* currentTerminalDisplay() {
557
561
return _currentTerminalDisplay;
560
QSet<ushort> usedExtendedChars() const
564
QSet<ushort> usedExtendedChars() const {
562
565
QSet<ushort> result;
563
for (int i = 0; i < lines; ++i)
565
const ImageLine& il = screenLines[i];
566
for (int j = 0; j < columns; ++j)
568
if (il[j].rendition & RE_EXTENDED_CHAR)
566
for (int i = 0; i < _lines; ++i) {
567
const ImageLine& il = _screenLines[i];
568
for (int j = 0; j < _columns; ++j) {
569
if (il[j].rendition & RE_EXTENDED_CHAR) {
570
570
result << il[j].character;
577
static const Character defaultChar;
577
static const Character DefaultChar;
581
580
//copies a line of text from the screen or history into a stream using a
582
581
//specified character decoder. Returns the number of lines actually copied,
583
582
//which may be less than 'count' if (start+count) is more than the number of characters on
589
588
//count - the number of characters on the line to copy
590
589
//decoder - a decoder which converts terminal characters (an Character array) into text
591
590
//appendNewLine - if true a new line character (\n) is appended to the end of the line
592
int copyLineToStream(int line,
591
int copyLineToStream(int line,
595
594
TerminalCharacterDecoder* decoder,
596
595
bool appendNewLine,
597
596
bool preserveLineBreaks) const;
625
624
bool isSelectionValid() const;
626
625
// copies text from 'startIndex' to 'endIndex' to a stream
627
626
// startIndex and endIndex are positions generated using the loc(x,y) macro
628
void writeToStream(TerminalCharacterDecoder* decoder, int startIndex,
627
void writeToStream(TerminalCharacterDecoder* decoder, int startIndex,
629
628
int endIndex, bool preserveLineBreaks = true) const;
630
629
// copies 'count' lines from the screen buffer into 'dest',
631
630
// starting from 'startLine', where 0 is the first line in the screen buffer
634
633
// starting from 'startLine', where 0 is the first line in the history
635
634
void copyFromHistory(Character* dest, int startLine, int count) const;
638
636
// screen image ----------------
642
640
typedef QVector<Character> ImageLine; // [0..columns]
643
ImageLine* screenLines; // [lines]
641
ImageLine* _screenLines; // [lines]
645
643
int _scrolledLines;
646
644
QRect _lastScrolledRegion;
648
646
int _droppedLines;
650
QVarLengthArray<LineProperty,64> lineProperties;
648
QVarLengthArray<LineProperty, 64> _lineProperties;
652
650
// history buffer ---------------
653
HistoryScroll* history;
651
HistoryScroll* _history;
655
653
// cursor location
659
657
// cursor color and rendition info
660
CharacterColor currentForeground;
661
CharacterColor currentBackground;
662
quint8 currentRendition;
658
CharacterColor _currentForeground;
659
CharacterColor _currentBackground;
660
quint8 _currentRendition;
664
662
// margins ----------------
666
664
int _bottomMargin;
668
666
// states ----------------
669
int currentModes[MODES_SCREEN];
670
int savedModes[MODES_SCREEN];
667
int _currentModes[MODES_SCREEN];
668
int _savedModes[MODES_SCREEN];
672
670
// ----------------------------
676
674
// selection -------------------
677
int selBegin; // The first location selected.
678
int selTopLeft; // TopLeft Location.
679
int selBottomRight; // Bottom Right Location.
680
bool blockSelectionMode; // Column selection mode
675
int _selBegin; // The first location selected.
676
int _selTopLeft; // TopLeft Location.
677
int _selBottomRight; // Bottom Right Location.
678
bool _blockSelectionMode; // Column selection mode
682
680
// effective colors and rendition ------------
683
CharacterColor effectiveForeground; // These are derived from
684
CharacterColor effectiveBackground; // the cu_* variables above
685
quint8 effectiveRendition; // to speed up operation
681
CharacterColor _effectiveForeground; // These are derived from
682
CharacterColor _effectiveBackground; // the cu_* variables above
683
quint8 _effectiveRendition; // to speed up operation
691
: cursorColumn(0),cursorLine(0),rendition(0) {}
689
: cursorColumn(0), cursorLine(0), rendition(0) {}
693
691
int cursorColumn;