File indexing completed on 2018-01-16 12:10:20

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      * Removes @p n lines beginning from the current cursor position.
0225      * The position of the cursor is not altered.
0226      * If @p n is 0 then one line is removed.
0227      */
0228     void deleteLines(int n);
0229     /**
0230      * Inserts @p lines beginning from the current cursor position.
0231      * The position of the cursor is not altered.
0232      * If @p n is 0 then one line is inserted.
0233      */
0234     void insertLines(int n);
0235     /** Clears all the tab stops. */
0236     void clearTabStops();
0237     /**  Sets or removes a tab stop at the cursor's current column. */
0238     void changeTabStop(bool set);
0239 
0240     /** Resets (clears) the specified screen @p m. */
0241     void resetMode(int m);
0242     /** Sets (enables) the specified screen @p m. */
0243     void setMode(int m);
0244     /**
0245      * Saves the state of the specified screen @p m.  It can be restored
0246      * using restoreMode()
0247      */
0248     void saveMode(int m);
0249     /** Restores the state of a screen @p m saved by calling saveMode() */
0250     void restoreMode(int m);
0251     /** Returns whether the specified screen @p me is enabled or not .*/
0252     bool getMode(int m) const;
0253 
0254     /**
0255      * Saves the current position and appearance (text color and style) of the cursor.
0256      * It can be restored by calling restoreCursor()
0257      */
0258     void saveCursor();
0259     /** Restores the position and appearance of the cursor.  See saveCursor() */
0260     void restoreCursor();
0261 
0262     /** Clear the whole screen, moving the current screen contents into the history first. */
0263     void clearEntireScreen();
0264     /**
0265      * Clear the area of the screen from the current cursor position to the end of
0266      * the screen.
0267      */
0268     void clearToEndOfScreen();
0269     /**
0270      * Clear the area of the screen from the current cursor position to the start
0271      * of the screen.
0272      */
0273     void clearToBeginOfScreen();
0274     /** Clears the whole of the line on which the cursor is currently positioned. */
0275     void clearEntireLine();
0276     /** Clears from the current cursor position to the end of the line. */
0277     void clearToEndOfLine();
0278     /** Clears from the current cursor position to the beginning of the line. */
0279     void clearToBeginOfLine();
0280 
0281     /** Fills the entire screen with the letter 'E' */
0282     void helpAlign();
0283 
0284     /**
0285      * Enables the given @p rendition flag.  Rendition flags control the appearance
0286      * of characters on the screen.
0287      *
0288      * @see Character::rendition
0289      */
0290     void setRendition(RenditionFlags rendition);
0291     /**
0292      * Disables the given @p rendition flag.  Rendition flags control the appearance
0293      * of characters on the screen.
0294      *
0295      * @see Character::rendition
0296      */
0297     void resetRendition(RenditionFlags rendition);
0298 
0299     /**
0300      * Sets the cursor's foreground color.
0301      * @param space The color space used by the @p color argument
0302      * @param color The new foreground color.  The meaning of this depends on
0303      * the color @p space used.
0304      *
0305      * @see CharacterColor
0306      */
0307     void setForeColor(int space, int color);
0308     /**
0309      * Sets the cursor's background color.
0310      * @param space The color space used by the @p color argument.
0311      * @param color The new background color.  The meaning of this depends on
0312      * the color @p space used.
0313      *
0314      * @see CharacterColor
0315      */
0316     void setBackColor(int space, int color);
0317     /**
0318      * Resets the cursor's color back to the default and sets the
0319      * character's rendition flags back to the default settings.
0320      */
0321     void setDefaultRendition();
0322 
0323     /** Returns the column which the cursor is positioned at. */
0324     int  getCursorX() const;
0325     /** Returns the line which the cursor is positioned on. */
0326     int  getCursorY() const;
0327 
0328     /**
0329      * Resets the state of the screen.  This resets the various screen modes
0330      * back to their default states.  The cursor style and colors are reset
0331      * (as if setDefaultRendition() had been called)
0332      *
0333      * <ul>
0334      * <li>Line wrapping is enabled.</li>
0335      * <li>Origin mode is disabled.</li>
0336      * <li>Insert mode is disabled.</li>
0337      * <li>Cursor mode is enabled.  TODO Document me</li>
0338      * <li>Screen mode is disabled. TODO Document me</li>
0339      * <li>New line mode is disabled.  TODO Document me</li>
0340      * </ul>
0341      *
0342      * If @p clearScreen is true then the screen contents are erased entirely,
0343      * otherwise they are unaltered.
0344      */
0345     void reset();
0346 
0347     /**
0348      * Displays a new character at the current cursor position.
0349      *
0350      * If the cursor is currently positioned at the right-edge of the screen and
0351      * line wrapping is enabled then the character is added at the start of a new
0352      * line below the current one.
0353      *
0354      * If the MODE_Insert screen mode is currently enabled then the character
0355      * is inserted at the current cursor position, otherwise it will replace the
0356      * character already at the current cursor position.
0357      */
0358     void displayCharacter(unsigned short c);
0359 
0360     /**
0361      * Resizes the image to a new fixed size of @p new_lines by @p new_columns.
0362      * In the case that @p new_columns is smaller than the current number of columns,
0363      * existing lines are not truncated.  This prevents characters from being lost
0364      * if the terminal display is resized smaller and then larger again.
0365      *
0366      * The top and bottom margins are reset to the top and bottom of the new
0367      * screen size.  Tab stops are also reset and the current selection is
0368      * cleared.
0369      */
0370     void resizeImage(int new_lines, int new_columns);
0371 
0372     /**
0373      * Returns the current screen image.
0374      * The result is an array of Characters of size [getLines()][getColumns()] which
0375      * must be freed by the caller after use.
0376      *
0377      * @param dest Buffer to copy the characters into
0378      * @param size Size of @p dest in Characters
0379      * @param startLine Index of first line to copy
0380      * @param endLine Index of last line to copy
0381      */
0382     void getImage(Character *dest, int size, int startLine, int endLine) const;
0383 
0384     /**
0385      * Returns the additional attributes associated with lines in the image.
0386      * The most important attribute is LINE_WRAPPED which specifies that the
0387      * line is wrapped,
0388      * other attributes control the size of characters in the line.
0389      */
0390     QVector<LineProperty> getLineProperties(int startLine, int endLine) const;
0391 
0392     /** Return the number of lines. */
0393     int getLines() const
0394     {
0395         return _lines;
0396     }
0397 
0398     /** Return the number of columns. */
0399     int getColumns() const
0400     {
0401         return _columns;
0402     }
0403 
0404     /** Return the number of lines in the history buffer. */
0405     int getHistLines() const;
0406     /**
0407      * Sets the type of storage used to keep lines in the history.
0408      * If @p copyPreviousScroll is true then the contents of the previous
0409      * history buffer are copied into the new scroll.
0410      */
0411     void setScroll(const HistoryType &, bool copyPreviousScroll = true);
0412     /** Returns the type of storage used to keep lines in the history. */
0413     const HistoryType &getScroll() const;
0414     /**
0415      * Returns true if this screen keeps lines that are scrolled off the screen
0416      * in a history buffer.
0417      */
0418     bool hasScroll() const;
0419 
0420     /**
0421      * Sets the start of the selection.
0422      *
0423      * @param x The column index of the first character in the selection.
0424      * @param y The line index of the first character in the selection.
0425      * @param blockSelectionMode True if the selection is in column mode.
0426      */
0427     void setSelectionStart(const int x, const int y, const bool blockSelectionMode);
0428 
0429     /**
0430      * Sets the end of the current selection.
0431      *
0432      * @param x The column index of the last character in the selection.
0433      * @param y The line index of the last character in the selection.
0434      */
0435     void setSelectionEnd(const int x, const int y);
0436 
0437     /**
0438      * Retrieves the start of the selection or the cursor position if there
0439      * is no selection.
0440      */
0441     void getSelectionStart(int &column, int &line) const;
0442 
0443     /**
0444      * Retrieves the end of the selection or the cursor position if there
0445      * is no selection.
0446      */
0447     void getSelectionEnd(int &column, int &line) const;
0448 
0449     /** Clears the current selection */
0450     void clearSelection();
0451 
0452     /**
0453       *  Returns true if the character at (@p x, @p y) is part of the
0454       *  current selection.
0455       */
0456     bool isSelected(const int x, const int y) const;
0457 
0458     /**
0459      * Convenience method.  Returns the currently selected text.
0460      * @param options See Screen::DecodingOptions
0461      */
0462     QString selectedText(const DecodingOptions options) const;
0463 
0464     /**
0465      * Convenience method.  Returns the text between two indices.
0466      * @param startIndex Specifies the starting text index
0467      * @param endIndex Specifies the ending text index
0468      * @param options See Screen::DecodingOptions
0469      */
0470     QString text(int startIndex, int endIndex, const DecodingOptions options) const;
0471 
0472     /**
0473      * Copies part of the output to a stream.
0474      *
0475      * @param decoder A decoder which converts terminal characters into text
0476      * @param fromLine The first line in the history to retrieve
0477      * @param toLine The last line in the history to retrieve
0478      */
0479     void writeLinesToStream(TerminalCharacterDecoder *decoder, int fromLine, int toLine) const;
0480 
0481     /**
0482      * Copies the selected characters, set using @see setSelBeginXY and @see setSelExtentXY
0483      * into a stream.
0484      *
0485      * @param decoder A decoder which converts terminal characters into text.
0486      * PlainTextDecoder is the most commonly used decoder which converts characters
0487      * into plain text with no formatting.
0488      * @param options See Screen::DecodingOptions
0489      */
0490     void writeSelectionToStream(TerminalCharacterDecoder *decoder, const Konsole::Screen::DecodingOptions options) const;
0491 
0492     /**
0493      * Checks if the text between from and to is inside the current
0494      * selection. If this is the case, the selection is cleared. The
0495      * from and to are coordinates in the current viewable window.
0496      * The loc(x,y) macro can be used to generate these values from a
0497      * column,line pair.
0498      *
0499      * @param from The start of the area to check.
0500      * @param to The end of the area to check
0501      */
0502     void checkSelection(int from, int to);
0503 
0504     /**
0505      * Sets or clears an attribute of the current line.
0506      *
0507      * @param property The attribute to set or clear
0508      * Possible properties are:
0509      * LINE_WRAPPED:     Specifies that the line is wrapped.
0510      * LINE_DOUBLEWIDTH: Specifies that the characters in the current line
0511      *                   should be double the normal width.
0512      * LINE_DOUBLEHEIGHT:Specifies that the characters in the current line
0513      *                   should be double the normal height.
0514      *                   Double-height lines are formed of two lines containing the same characters,
0515      *                   with both having the LINE_DOUBLEHEIGHT attribute.
0516      *                   This allows other parts of the code to work on the
0517      *                   assumption that all lines are the same height.
0518      *
0519      * @param enable true to apply the attribute to the current line or false to remove it
0520      */
0521     void setLineProperty(LineProperty property, bool enable);
0522 
0523     /**
0524      * Returns the number of lines that the image has been scrolled up or down by,
0525      * since the last call to resetScrolledLines().
0526      *
0527      * a positive return value indicates that the image has been scrolled up,
0528      * a negative return value indicates that the image has been scrolled down.
0529      */
0530     int scrolledLines() const;
0531 
0532     /**
0533      * Returns the region of the image which was last scrolled.
0534      *
0535      * This is the area of the image from the top margin to the
0536      * bottom margin when the last scroll occurred.
0537      */
0538     QRect lastScrolledRegion() const;
0539 
0540     /**
0541      * Resets the count of the number of lines that the image has been scrolled up or down by,
0542      * see scrolledLines()
0543      */
0544     void resetScrolledLines();
0545 
0546     /**
0547      * Returns the number of lines of output which have been
0548      * dropped from the history since the last call
0549      * to resetDroppedLines()
0550      *
0551      * If the history is not unlimited then it will drop
0552      * the oldest lines of output if new lines are added when
0553      * it is full.
0554      */
0555     int droppedLines() const;
0556 
0557     /**
0558      * Resets the count of the number of lines dropped from
0559      * the history.
0560      */
0561     void resetDroppedLines();
0562 
0563     /**
0564       * Fills the buffer @p dest with @p count instances of the default (ie. blank)
0565       * Character style.
0566       */
0567     static void fillWithDefaultChar(Character *dest, int count);
0568 
0569     void setCurrentTerminalDisplay(TerminalDisplay *display)
0570     {
0571         _currentTerminalDisplay = display;
0572     }
0573 
0574     TerminalDisplay *currentTerminalDisplay()
0575     {
0576         return _currentTerminalDisplay;
0577     }
0578 
0579     QSet<ushort> usedExtendedChars() const
0580     {
0581         QSet<ushort> result;
0582         for (int i = 0; i < _lines; ++i) {
0583             const ImageLine &il = _screenLines[i];
0584             for (int j = 0; j < il.length(); ++j) {
0585                 if (il[j].rendition & RE_EXTENDED_CHAR) {
0586                     result << il[j].character;
0587                 }
0588             }
0589         }
0590         return result;
0591     }
0592 
0593     static const Character DefaultChar;
0594 
0595 private:
0596     //copies a line of text from the screen or history into a stream using a
0597     //specified character decoder.  Returns the number of lines actually copied,
0598     //which may be less than 'count' if (start+count) is more than the number of characters on
0599     //the line
0600     //
0601     //line - the line number to copy, from 0 (the earliest line in the history) up to
0602     //         history->getLines() + lines - 1
0603     //start - the first column on the line to copy
0604     //count - the number of characters on the line to copy
0605     //decoder - a decoder which converts terminal characters (an Character array) into text
0606     //appendNewLine - if true a new line character (\n) is appended to the end of the line
0607     int  copyLineToStream(int line, int start, int count, TerminalCharacterDecoder *decoder,
0608                           bool appendNewLine, const Konsole::Screen::DecodingOptions options) const;
0609 
0610     //fills a section of the screen image with the character 'c'
0611     //the parameters are specified as offsets from the start of the screen image.
0612     //the loc(x,y) macro can be used to generate these values from a column,line pair.
0613     void clearImage(int loca, int loce, char c);
0614 
0615     //move screen image between 'sourceBegin' and 'sourceEnd' to 'dest'.
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     //
0619     //NOTE: moveImage() can only move whole lines
0620     void moveImage(int dest, int sourceBegin, int sourceEnd);
0621     // scroll up 'n' lines in current region, clearing the bottom 'n' lines
0622     void scrollUp(int from, int n);
0623     // scroll down 'n' lines in current region, clearing the top 'n' lines
0624     void scrollDown(int from, int n);
0625 
0626     //when we handle scroll commands, we need to know which screenwindow will scroll
0627     TerminalDisplay *_currentTerminalDisplay;
0628 
0629     void addHistLine();
0630 
0631     void initTabStops();
0632 
0633     void updateEffectiveRendition();
0634     void reverseRendition(Character &p) const;
0635 
0636     bool isSelectionValid() const;
0637     // copies text from 'startIndex' to 'endIndex' to a stream
0638     // startIndex and endIndex are positions generated using the loc(x,y) macro
0639     void writeToStream(TerminalCharacterDecoder *decoder, int startIndex, int endIndex,
0640                        const Konsole::Screen::DecodingOptions options) const;
0641     // copies 'count' lines from the screen buffer into 'dest',
0642     // starting from 'startLine', where 0 is the first line in the screen buffer
0643     void copyFromScreen(Character *dest, int startLine, int count) const;
0644     // copies 'count' lines from the history buffer into 'dest',
0645     // starting from 'startLine', where 0 is the first line in the history
0646     void copyFromHistory(Character *dest, int startLine, int count) const;
0647 
0648     // screen image ----------------
0649     int _lines;
0650     int _columns;
0651 
0652     typedef QVector<Character> ImageLine;      // [0..columns]
0653     ImageLine *_screenLines;             // [lines]
0654     int _screenLinesSize;                // _screenLines.size()
0655 
0656     int _scrolledLines;
0657     QRect _lastScrolledRegion;
0658 
0659     int _droppedLines;
0660 
0661     QVarLengthArray<LineProperty, 64> _lineProperties;
0662 
0663     // history buffer ---------------
0664     HistoryScroll *_history;
0665 
0666     // cursor location
0667     int _cuX;
0668     int _cuY;
0669 
0670     // cursor color and rendition info
0671     CharacterColor _currentForeground;
0672     CharacterColor _currentBackground;
0673     RenditionFlags _currentRendition;
0674 
0675     // margins ----------------
0676     int _topMargin;
0677     int _bottomMargin;
0678 
0679     // states ----------------
0680     int _currentModes[MODES_SCREEN];
0681     int _savedModes[MODES_SCREEN];
0682 
0683     // ----------------------------
0684 
0685     QBitArray _tabStops;
0686 
0687     // selection -------------------
0688     int _selBegin; // The first location selected.
0689     int _selTopLeft;    // TopLeft Location.
0690     int _selBottomRight;    // Bottom Right Location.
0691     bool _blockSelectionMode;  // Column selection mode
0692 
0693     // effective colors and rendition ------------
0694     CharacterColor _effectiveForeground; // These are derived from
0695     CharacterColor _effectiveBackground; // the cu_* variables above
0696     RenditionFlags _effectiveRendition;  // to speed up operation
0697 
0698     class SavedState
0699     {
0700     public:
0701         SavedState() :
0702             cursorColumn(0),
0703             cursorLine(0),
0704             rendition(0),
0705             foreground(CharacterColor()),
0706             background(CharacterColor())
0707         {
0708         }
0709 
0710         int cursorColumn;
0711         int cursorLine;
0712         RenditionFlags rendition;
0713         CharacterColor foreground;
0714         CharacterColor background;
0715     };
0716     SavedState _savedState;
0717 
0718     // last position where we added a character
0719     int _lastPos;
0720 };
0721 
0722 }
0723 
0724 Q_DECLARE_OPERATORS_FOR_FLAGS(Konsole::Screen::DecodingOptions)
0725 
0726 
0727 #endif // SCREEN_H