File indexing completed on 2018-09-18 18:15:54

0001 /*
0002     This file is part of Konsole, KDE's terminal.
0003 
0004     Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
0005     Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
0006 
0007     This program is free software; you can redistribute it and/or modify
0008     it under the terms of the GNU General Public License as published by
0009     the Free Software Foundation; either version 2 of the License, or
0010     (at your option) any later version.
0011 
0012     This program is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015     GNU General Public License for more details.
0016 
0017     You should have received a copy of the GNU General Public License
0018     along with this program; if not, write to the Free Software
0019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0020     02110-1301  USA.
0021 */
0022 
0023 #ifndef SCREEN_H
0024 #define SCREEN_H
0025 
0026 // Qt
0027 #include <QRect>
0028 #include <QSet>
0029 #include <QVector>
0030 #include <QBitArray>
0031 #include <QVarLengthArray>
0032 
0033 // Konsole
0034 #include "Character.h"
0035 
0036 #define MODE_Origin    0
0037 #define MODE_Wrap      1
0038 #define MODE_Insert    2
0039 #define MODE_Screen    3
0040 #define MODE_Cursor    4
0041 #define MODE_NewLine   5
0042 #define MODES_SCREEN   6
0043 
0044 namespace Konsole {
0045 class TerminalCharacterDecoder;
0046 class TerminalDisplay;
0047 class HistoryType;
0048 class HistoryScroll;
0049 
0050 /**
0051     \brief An image of characters with associated attributes.
0052 
0053     The terminal emulation ( Emulation ) receives a serial stream of
0054     characters from the program currently running in the terminal.
0055     From this stream it creates an image of characters which is ultimately
0056     rendered by the display widget ( TerminalDisplay ).  Some types of emulation
0057     may have more than one screen image.
0058 
0059     getImage() is used to retrieve the currently visible image
0060     which is then used by the display widget to draw the output from the
0061     terminal.
0062 
0063     The number of lines of output history which are kept in addition to the current
0064     screen image depends on the history scroll being used to store the output.
0065     The scroll is specified using setScroll()
0066     The output history can be retrieved using writeToStream()
0067 
0068     The screen image has a selection associated with it, specified using
0069     setSelectionStart() and setSelectionEnd().  The selected text can be retrieved
0070     using selectedText().  When getImage() is used to retrieve the visible image,
0071     characters which are part of the selection have their colors inverted.
0072 */
0073 class Screen
0074 {
0075 public:
0076     /* PlainText: Return plain text (default)
0077      * ConvertToHtml: Specifies if returned text should have HTML tags.
0078      * PreserveLineBreaks: Specifies whether new line characters should be
0079      *      inserted into the returned text at the end of each terminal line.
0080      * TrimLeadingWhitespace: Specifies whether leading spaces should be
0081      *      trimmed in the returned text.
0082      * TrimTrailingWhitespace: Specifies whether trailing spaces should be
0083      *      trimmed in the returned text.
0084      */
0085     enum DecodingOption {
0086         PlainText = 0x0,
0087         ConvertToHtml = 0x1,
0088         PreserveLineBreaks = 0x2,
0089         TrimLeadingWhitespace = 0x4,
0090         TrimTrailingWhitespace = 0x8
0091     };
0092     Q_DECLARE_FLAGS(DecodingOptions, DecodingOption)
0093 
0094     /** Construct a new screen image of size @p lines by @p columns. */
0095     Screen(int lines, int columns);
0096     ~Screen();
0097 
0098     Screen(const Screen &) = delete;
0099     Screen &operator=(const Screen &) = delete;
0100 
0101     // VT100/2 Operations
0102     // Cursor Movement
0103 
0104     /**
0105      * Move the cursor up by @p n lines.  The cursor will stop at the
0106      * top margin.
0107      */
0108     void cursorUp(int n);
0109     /**
0110      * Move the cursor down by @p n lines.  The cursor will stop at the
0111      * bottom margin.
0112      */
0113     void cursorDown(int n);
0114     /**
0115      * Move the cursor to the left by @p n columns.
0116      * The cursor will stop at the first column.
0117      */
0118     void cursorLeft(int n);
0119     /**
0120      * Move the cursor to the right by @p n columns.
0121      * The cursor will stop at the right-most column.
0122      */
0123     void cursorRight(int n);
0124     /** Position the cursor on line @p y. */
0125     void setCursorY(int y);
0126     /** Position the cursor at column @p x. */
0127     void setCursorX(int x);
0128     /** Position the cursor at line @p y, column @p x. */
0129     void setCursorYX(int y, int x);
0130     /**
0131      * Sets the margins for scrolling the screen.
0132      *
0133      * @param top The top line of the new scrolling margin.
0134      * @param bot The bottom line of the new scrolling margin.
0135      */
0136     void setMargins(int top, int bot);
0137     /** Returns the top line of the scrolling region. */
0138     int topMargin() const;
0139     /** Returns the bottom line of the scrolling region. */
0140     int bottomMargin() const;
0141 
0142     /**
0143      * Resets the scrolling margins back to the top and bottom lines
0144      * of the screen.
0145      */
0146     void setDefaultMargins();
0147 
0148     /**
0149      * Moves the cursor down one line, if the MODE_NewLine mode
0150      * flag is enabled then the cursor is returned to the leftmost
0151      * column first.
0152      *
0153      * Equivalent to NextLine() if the MODE_NewLine flag is set
0154      * or index() otherwise.
0155      */
0156     void newLine();
0157     /**
0158      * Moves the cursor down one line and positions it at the beginning
0159      * of the line.  Equivalent to calling Return() followed by index()
0160      */
0161     void nextLine();
0162 
0163     /**
0164      * Move the cursor down one line.  If the cursor is on the bottom
0165      * line of the scrolling region (as returned by bottomMargin()) the
0166      * scrolling region is scrolled up by one line instead.
0167      */
0168     void index();
0169     /**
0170      * Move the cursor up one line.  If the cursor is on the top line
0171      * of the scrolling region (as returned by topMargin()) the scrolling
0172      * region is scrolled down by one line instead.
0173      */
0174     void reverseIndex();
0175 
0176     /**
0177      * Scroll the scrolling region of the screen up by @p n lines.
0178      * The scrolling region is initially the whole screen, but can be changed
0179      * using setMargins()
0180      */
0181     void scrollUp(int n);
0182     /**
0183      * Scroll the scrolling region of the screen down by @p n lines.
0184      * The scrolling region is initially the whole screen, but can be changed
0185      * using setMargins()
0186      */
0187     void scrollDown(int n);
0188     /**
0189      * Moves the cursor to the beginning of the current line.
0190      * Equivalent to setCursorX(0)
0191      */
0192     void toStartOfLine();
0193     /**
0194      * Moves the cursor one column to the left and erases the character
0195      * at the new cursor position.
0196      */
0197     void backspace();
0198     /** Moves the cursor @p n tab-stops to the right. */
0199     void tab(int n = 1);
0200     /** Moves the cursor @p n tab-stops to the left. */
0201     void backtab(int n);
0202 
0203     // Editing
0204 
0205     /**
0206      * Erase @p n characters beginning from the current cursor position.
0207      * This is equivalent to over-writing @p n characters starting with the current
0208      * cursor position with spaces.
0209      * If @p n is 0 then one character is erased.
0210      */
0211     void eraseChars(int n);
0212     /**
0213      * Delete @p n characters beginning from the current cursor position.
0214      * If @p n is 0 then one character is deleted.
0215      */
0216     void deleteChars(int n);
0217     /**
0218      * Insert @p n blank characters beginning from the current cursor position.
0219      * The position of the cursor is not altered.
0220      * If @p n is 0 then one character is inserted.
0221      */
0222     void insertChars(int n);
0223     /**
0224      * Repeat the preceding graphic character @n times, including SPACE.
0225      * If @n is 0 then the character is repeated once.
0226      */
0227     void repeatChars(int n);
0228     /**
0229      * Removes @p n lines beginning from the current cursor position.
0230      * The position of the cursor is not altered.
0231      * If @p n is 0 then one line is removed.
0232      */
0233     void deleteLines(int n);
0234     /**
0235      * Inserts @p lines beginning from the current cursor position.
0236      * The position of the cursor is not altered.
0237      * If @p n is 0 then one line is inserted.
0238      */
0239     void insertLines(int n);
0240     /** Clears all the tab stops. */
0241     void clearTabStops();
0242     /**  Sets or removes a tab stop at the cursor's current column. */
0243     void changeTabStop(bool set);
0244 
0245     /** Resets (clears) the specified screen @p m. */
0246     void resetMode(int m);
0247     /** Sets (enables) the specified screen @p m. */
0248     void setMode(int m);
0249     /**
0250      * Saves the state of the specified screen @p m.  It can be restored
0251      * using restoreMode()
0252      */
0253     void saveMode(int m);
0254     /** Restores the state of a screen @p m saved by calling saveMode() */
0255     void restoreMode(int m);
0256     /** Returns whether the specified screen @p me is enabled or not .*/
0257     bool getMode(int m) const;
0258 
0259     /**
0260      * Saves the current position and appearance (text color and style) of the cursor.
0261      * It can be restored by calling restoreCursor()
0262      */
0263     void saveCursor();
0264     /** Restores the position and appearance of the cursor.  See saveCursor() */
0265     void restoreCursor();
0266 
0267     /** Clear the whole screen, moving the current screen contents into the history first. */
0268     void clearEntireScreen();
0269     /**
0270      * Clear the area of the screen from the current cursor position to the end of
0271      * the screen.
0272      */
0273     void clearToEndOfScreen();
0274     /**
0275      * Clear the area of the screen from the current cursor position to the start
0276      * of the screen.
0277      */
0278     void clearToBeginOfScreen();
0279     /** Clears the whole of the line on which the cursor is currently positioned. */
0280     void clearEntireLine();
0281     /** Clears from the current cursor position to the end of the line. */
0282     void clearToEndOfLine();
0283     /** Clears from the current cursor position to the beginning of the line. */
0284     void clearToBeginOfLine();
0285 
0286     /** Fills the entire screen with the letter 'E' */
0287     void helpAlign();
0288 
0289     /**
0290      * Enables the given @p rendition flag.  Rendition flags control the appearance
0291      * of characters on the screen.
0292      *
0293      * @see Character::rendition
0294      */
0295     void setRendition(RenditionFlags rendition);
0296     /**
0297      * Disables the given @p rendition flag.  Rendition flags control the appearance
0298      * of characters on the screen.
0299      *
0300      * @see Character::rendition
0301      */
0302     void resetRendition(RenditionFlags rendition);
0303 
0304     /**
0305      * Sets the cursor's foreground color.
0306      * @param space The color space used by the @p color argument
0307      * @param color The new foreground color.  The meaning of this depends on
0308      * the color @p space used.
0309      *
0310      * @see CharacterColor
0311      */
0312     void setForeColor(int space, int color);
0313     /**
0314      * Sets the cursor's background color.
0315      * @param space The color space used by the @p color argument.
0316      * @param color The new background color.  The meaning of this depends on
0317      * the color @p space used.
0318      *
0319      * @see CharacterColor
0320      */
0321     void setBackColor(int space, int color);
0322     /**
0323      * Resets the cursor's color back to the default and sets the
0324      * character's rendition flags back to the default settings.
0325      */
0326     void setDefaultRendition();
0327 
0328     /** Returns the column which the cursor is positioned at. */
0329     int  getCursorX() const;
0330     /** Returns the line which the cursor is positioned on. */
0331     int  getCursorY() const;
0332 
0333     /**
0334      * Resets the state of the screen.  This resets the various screen modes
0335      * back to their default states.  The cursor style and colors are reset
0336      * (as if setDefaultRendition() had been called)
0337      *
0338      * <ul>
0339      * <li>Line wrapping is enabled.</li>
0340      * <li>Origin mode is disabled.</li>
0341      * <li>Insert mode is disabled.</li>
0342      * <li>Cursor mode is enabled.  TODO Document me</li>
0343      * <li>Screen mode is disabled. TODO Document me</li>
0344      * <li>New line mode is disabled.  TODO Document me</li>
0345      * </ul>
0346      *
0347      * If @p clearScreen is true then the screen contents are erased entirely,
0348      * otherwise they are unaltered.
0349      */
0350     void reset();
0351 
0352     /**
0353      * Displays a new character at the current cursor position.
0354      *
0355      * If the cursor is currently positioned at the right-edge of the screen and
0356      * line wrapping is enabled then the character is added at the start of a new
0357      * line below the current one.
0358      *
0359      * If the MODE_Insert screen mode is currently enabled then the character
0360      * is inserted at the current cursor position, otherwise it will replace the
0361      * character already at the current cursor position.
0362      */
0363     void displayCharacter(uint c);
0364 
0365     /**
0366      * Resizes the image to a new fixed size of @p new_lines by @p new_columns.
0367      * In the case that @p new_columns is smaller than the current number of columns,
0368      * existing lines are not truncated.  This prevents characters from being lost
0369      * if the terminal display is resized smaller and then larger again.
0370      *
0371      * The top and bottom margins are reset to the top and bottom of the new
0372      * screen size.  Tab stops are also reset and the current selection is
0373      * cleared.
0374      */
0375     void resizeImage(int new_lines, int new_columns);
0376 
0377     /**
0378      * Returns the current screen image.
0379      * The result is an array of Characters of size [getLines()][getColumns()] which
0380      * must be freed by the caller after use.
0381      *
0382      * @param dest Buffer to copy the characters into
0383      * @param size Size of @p dest in Characters
0384      * @param startLine Index of first line to copy
0385      * @param endLine Index of last line to copy
0386      */
0387     void getImage(Character *dest, int size, int startLine, int endLine) const;
0388 
0389     /**
0390      * Returns the additional attributes associated with lines in the image.
0391      * The most important attribute is LINE_WRAPPED which specifies that the
0392      * line is wrapped,
0393      * other attributes control the size of characters in the line.
0394      */
0395     QVector<LineProperty> getLineProperties(int startLine, int endLine) const;
0396 
0397     /** Return the number of lines. */
0398     int getLines() const
0399     {
0400         return _lines;
0401     }
0402 
0403     /** Return the number of columns. */
0404     int getColumns() const
0405     {
0406         return _columns;
0407     }
0408 
0409     /** Return the number of lines in the history buffer. */
0410     int getHistLines() const;
0411     /**
0412      * Sets the type of storage used to keep lines in the history.
0413      * If @p copyPreviousScroll is true then the contents of the previous
0414      * history buffer are copied into the new scroll.
0415      */
0416     void setScroll(const HistoryType &, bool copyPreviousScroll = true);
0417     /** Returns the type of storage used to keep lines in the history. */
0418     const HistoryType &getScroll() const;
0419     /**
0420      * Returns true if this screen keeps lines that are scrolled off the screen
0421      * in a history buffer.
0422      */
0423     bool hasScroll() const;
0424 
0425     /**
0426      * Sets the start of the selection.
0427      *
0428      * @param x The column index of the first character in the selection.
0429      * @param y The line index of the first character in the selection.
0430      * @param blockSelectionMode True if the selection is in column mode.
0431      */
0432     void setSelectionStart(const int x, const int y, const bool blockSelectionMode);
0433 
0434     /**
0435      * Sets the end of the current selection.
0436      *
0437      * @param x The column index of the last character in the selection.
0438      * @param y The line index of the last character in the selection.
0439      */
0440     void setSelectionEnd(const int x, const int y);
0441 
0442     /**
0443      * Retrieves the start of the selection or the cursor position if there
0444      * is no selection.
0445      */
0446     void getSelectionStart(int &column, int &line) const;
0447 
0448     /**
0449      * Retrieves the end of the selection or the cursor position if there
0450      * is no selection.
0451      */
0452     void getSelectionEnd(int &column, int &line) const;
0453 
0454     /** Clears the current selection */
0455     void clearSelection();
0456 
0457     /**
0458       *  Returns true if the character at (@p x, @p y) is part of the
0459       *  current selection.
0460       */
0461     bool isSelected(const int x, const int y) const;
0462 
0463     /**
0464      * Convenience method.  Returns the currently selected text.
0465      * @param options See Screen::DecodingOptions
0466      */
0467     QString selectedText(const DecodingOptions options) const;
0468 
0469     /**
0470      * Convenience method.  Returns the text between two indices.
0471      * @param startIndex Specifies the starting text index
0472      * @param endIndex Specifies the ending text index
0473      * @param options See Screen::DecodingOptions
0474      */
0475     QString text(int startIndex, int endIndex, const DecodingOptions options) const;
0476 
0477     /**
0478      * Copies part of the output to a stream.
0479      *
0480      * @param decoder A decoder which converts terminal characters into text
0481      * @param fromLine The first line in the history to retrieve
0482      * @param toLine The last line in the history to retrieve
0483      */
0484     void writeLinesToStream(TerminalCharacterDecoder *decoder, int fromLine, int toLine) const;
0485 
0486     /**
0487      * Copies the selected characters, set using @see setSelBeginXY and @see setSelExtentXY
0488      * into a stream.
0489      *
0490      * @param decoder A decoder which converts terminal characters into text.
0491      * PlainTextDecoder is the most commonly used decoder which converts characters
0492      * into plain text with no formatting.
0493      * @param options See Screen::DecodingOptions
0494      */
0495     void writeSelectionToStream(TerminalCharacterDecoder *decoder, const DecodingOptions options) const;
0496 
0497     /**
0498      * Checks if the text between from and to is inside the current
0499      * selection. If this is the case, the selection is cleared. The
0500      * from and to are coordinates in the current viewable window.
0501      * The loc(x,y) macro can be used to generate these values from a
0502      * column,line pair.
0503      *
0504      * @param from The start of the area to check.
0505      * @param to The end of the area to check
0506      */
0507     void checkSelection(int from, int to);
0508 
0509     /**
0510      * Sets or clears an attribute of the current line.
0511      *
0512      * @param property The attribute to set or clear
0513      * Possible properties are:
0514      * LINE_WRAPPED:     Specifies that the line is wrapped.
0515      * LINE_DOUBLEWIDTH: Specifies that the characters in the current line
0516      *                   should be double the normal width.
0517      * LINE_DOUBLEHEIGHT:Specifies that the characters in the current line
0518      *                   should be double the normal height.
0519      *                   Double-height lines are formed of two lines containing the same characters,
0520      *                   with both having the LINE_DOUBLEHEIGHT attribute.
0521      *                   This allows other parts of the code to work on the
0522      *                   assumption that all lines are the same height.
0523      *
0524      * @param enable true to apply the attribute to the current line or false to remove it
0525      */
0526     void setLineProperty(LineProperty property, bool enable);
0527 
0528     /**
0529      * Returns the number of lines that the image has been scrolled up or down by,
0530      * since the last call to resetScrolledLines().
0531      *
0532      * a positive return value indicates that the image has been scrolled up,
0533      * a negative return value indicates that the image has been scrolled down.
0534      */
0535     int scrolledLines() const;
0536 
0537     /**
0538      * Returns the region of the image which was last scrolled.
0539      *
0540      * This is the area of the image from the top margin to the
0541      * bottom margin when the last scroll occurred.
0542      */
0543     QRect lastScrolledRegion() const;
0544 
0545     /**
0546      * Resets the count of the number of lines that the image has been scrolled up or down by,
0547      * see scrolledLines()
0548      */
0549     void resetScrolledLines();
0550 
0551     /**
0552      * Returns the number of lines of output which have been
0553      * dropped from the history since the last call
0554      * to resetDroppedLines()
0555      *
0556      * If the history is not unlimited then it will drop
0557      * the oldest lines of output if new lines are added when
0558      * it is full.
0559      */
0560     int droppedLines() const;
0561 
0562     /**
0563      * Resets the count of the number of lines dropped from
0564      * the history.
0565      */
0566     void resetDroppedLines();
0567 
0568     /**
0569       * Fills the buffer @p dest with @p count instances of the default (ie. blank)
0570       * Character style.
0571       */
0572     static void fillWithDefaultChar(Character *dest, int count);
0573 
0574     void setCurrentTerminalDisplay(TerminalDisplay *display)
0575     {
0576         _currentTerminalDisplay = display;
0577     }
0578 
0579     TerminalDisplay *currentTerminalDisplay()
0580     {
0581         return _currentTerminalDisplay;
0582     }
0583 
0584     QSet<uint> usedExtendedChars() const
0585     {
0586         QSet<uint> result;
0587         for (int i = 0; i < _lines; ++i) {
0588             const ImageLine &il = _screenLines[i];
0589             for (int j = 0; j < il.length(); ++j) {
0590                 if (il[j].rendition & RE_EXTENDED_CHAR) {
0591                     result << il[j].character;
0592                 }
0593             }
0594         }
0595         return result;
0596     }
0597 
0598     static const Character DefaultChar;
0599 
0600 private:
0601     //copies a line of text from the screen or history into a stream using a
0602     //specified character decoder.  Returns the number of lines actually copied,
0603     //which may be less than 'count' if (start+count) is more than the number of characters on
0604     //the line
0605     //
0606     //line - the line number to copy, from 0 (the earliest line in the history) up to
0607     //         history->getLines() + lines - 1
0608     //start - the first column on the line to copy
0609     //count - the number of characters on the line to copy
0610     //decoder - a decoder which converts terminal characters (an Character array) into text
0611     //appendNewLine - if true a new line character (\n) is appended to the end of the line
0612     int  copyLineToStream(int line, int start, int count, TerminalCharacterDecoder *decoder,
0613                           bool appendNewLine, const DecodingOptions options) const;
0614 
0615     //fills a section of the screen image with the character 'c'
0616     //the parameters are specified as offsets from the start of the screen image.
0617     //the loc(x,y) macro can be used to generate these values from a column,line pair.
0618     void clearImage(int loca, int loce, char c);
0619 
0620     //move screen image between 'sourceBegin' and 'sourceEnd' to 'dest'.
0621     //the parameters are specified as offsets from the start of the screen image.
0622     //the loc(x,y) macro can be used to generate these values from a column,line pair.
0623     //
0624     //NOTE: moveImage() can only move whole lines
0625     void moveImage(int dest, int sourceBegin, int sourceEnd);
0626     // scroll up 'n' lines in current region, clearing the bottom 'n' lines
0627     void scrollUp(int from, int n);
0628     // scroll down 'n' lines in current region, clearing the top 'n' lines
0629     void scrollDown(int from, int n);
0630 
0631     //when we handle scroll commands, we need to know which screenwindow will scroll
0632     TerminalDisplay *_currentTerminalDisplay;
0633 
0634     void addHistLine();
0635 
0636     void initTabStops();
0637 
0638     void updateEffectiveRendition();
0639     void reverseRendition(Character &p) const;
0640 
0641     bool isSelectionValid() const;
0642     // copies text from 'startIndex' to 'endIndex' to a stream
0643     // startIndex and endIndex are positions generated using the loc(x,y) macro
0644     void writeToStream(TerminalCharacterDecoder *decoder, int startIndex, int endIndex,
0645                        const DecodingOptions options) const;
0646     // copies 'count' lines from the screen buffer into 'dest',
0647     // starting from 'startLine', where 0 is the first line in the screen buffer
0648     void copyFromScreen(Character *dest, int startLine, int count) const;
0649     // copies 'count' lines from the history buffer into 'dest',
0650     // starting from 'startLine', where 0 is the first line in the history
0651     void copyFromHistory(Character *dest, int startLine, int count) const;
0652 
0653     // screen image ----------------
0654     int _lines;
0655     int _columns;
0656 
0657     typedef QVector<Character> ImageLine;      // [0..columns]
0658     ImageLine *_screenLines;             // [lines]
0659     int _screenLinesSize;                // _screenLines.size()
0660 
0661     int _scrolledLines;
0662     QRect _lastScrolledRegion;
0663 
0664     int _droppedLines;
0665 
0666     QVarLengthArray<LineProperty, 64> _lineProperties;
0667 
0668     // history buffer ---------------
0669     HistoryScroll *_history;
0670 
0671     // cursor location
0672     int _cuX;
0673     int _cuY;
0674 
0675     // cursor color and rendition info
0676     CharacterColor _currentForeground;
0677     CharacterColor _currentBackground;
0678     RenditionFlags _currentRendition;
0679 
0680     // margins ----------------
0681     int _topMargin;
0682     int _bottomMargin;
0683 
0684     // states ----------------
0685     int _currentModes[MODES_SCREEN];
0686     int _savedModes[MODES_SCREEN];
0687 
0688     // ----------------------------
0689 
0690     QBitArray _tabStops;
0691 
0692     // selection -------------------
0693     int _selBegin; // The first location selected.
0694     int _selTopLeft;    // TopLeft Location.
0695     int _selBottomRight;    // Bottom Right Location.
0696     bool _blockSelectionMode;  // Column selection mode
0697 
0698     // effective colors and rendition ------------
0699     CharacterColor _effectiveForeground; // These are derived from
0700     CharacterColor _effectiveBackground; // the cu_* variables above
0701     RenditionFlags _effectiveRendition;  // to speed up operation
0702 
0703     class SavedState
0704     {
0705     public:
0706         SavedState() :
0707             cursorColumn(0),
0708             cursorLine(0),
0709             rendition(0),
0710             foreground(CharacterColor()),
0711             background(CharacterColor())
0712         {
0713         }
0714 
0715         int cursorColumn;
0716         int cursorLine;
0717         RenditionFlags rendition;
0718         CharacterColor foreground;
0719         CharacterColor background;
0720     };
0721     SavedState _savedState;
0722 
0723     // last position where we added a character
0724     int _lastPos;
0725 
0726     // used in REP (repeating char)
0727     quint32 _lastDrawnChar;
0728 };
0729 
0730 Q_DECLARE_OPERATORS_FOR_FLAGS(Screen::DecodingOptions)
0731 
0732 }
0733 
0734 
0735 
0736 #endif // SCREEN_H