MauiKit Terminal

Screen.h
1/*
2 This file is part of Konsole, KDE's terminal.
3
4 SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com>
5 SPDX-FileCopyrightText: 1997, 1998 Lars Doelle <lars.doelle@on-line.de>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301 USA.
18*/
19
20#ifndef SCREEN_H
21#define SCREEN_H
22
23// Qt
24#include <QRect>
25#include <QTextStream>
26#include <QVarLengthArray>
27#include <memory>
28
29// Konsole
30#include "Character.h"
31#include "History.h"
32
33#define MODE_Origin 0
34#define MODE_Wrap 1
35#define MODE_Insert 2
36#define MODE_Screen 3
37#define MODE_Cursor 4
38#define MODE_NewLine 5
39#define MODES_SCREEN 6
40
41namespace Konsole
42{
43
44class TerminalCharacterDecoder;
45
46/**
47 \brief An image of characters with associated attributes.
48
49 The terminal emulation ( Emulation ) receives a serial stream of
50 characters from the program currently running in the terminal.
51 From this stream it creates an image of characters which is ultimately
52 rendered by the display widget ( TerminalDisplay ). Some types of emulation
53 may have more than one screen image.
54
55 getImage() is used to retrieve the currently visible image
56 which is then used by the display widget to draw the output from the
57 terminal.
58
59 The number of lines of output history which are kept in addition to the current
60 screen image depends on the history scroll being used to store the output.
61 The scroll is specified using setScroll()
62 The output history can be retrieved using writeToStream()
63
64 The screen image has a selection associated with it, specified using
65 setSelectionStart() and setSelectionEnd(). The selected text can be retrieved
66 using selectedText(). When getImage() is used to retrieve the visible image,
67 characters which are part of the selection have their colours inverted.
68*/
69class Screen
70{
71public:
72 /** Construct a new screen image of size @p lines by @p columns. */
73 Screen(int lines, int columns);
74 ~Screen();
75
76 // VT100/2 Operations
77 // Cursor Movement
78
79 /**
80 * Move the cursor up by @p n lines. The cursor will stop at the
81 * top margin.
82 */
83 void cursorUp(int n);
84 /**
85 * Move the cursor down by @p n lines. The cursor will stop at the
86 * bottom margin.
87 */
88 void cursorDown(int n);
89 /**
90 * Move the cursor to the left by @p n columns.
91 * The cursor will stop at the first column.
92 */
93 void cursorLeft(int n);
94 /**
95 * Move the cursor to the right by @p n columns.
96 * The cursor will stop at the right-most column.
97 */
98 void cursorRight(int n);
99 /** Position the cursor on line @p y. */
100 void setCursorY(int y);
101 /** Position the cursor at column @p x. */
102 void setCursorX(int x);
103 /** Position the cursor at line @p y, column @p x. */
104 void setCursorYX(int y, int x);
105 /**
106 * Sets the margins for scrolling the screen.
107 *
108 * @param topLine The top line of the new scrolling margin.
109 * @param bottomLine The bottom line of the new scrolling margin.
110 */
111 void setMargins(int topLine, int bottomLine);
112 /** Returns the top line of the scrolling region. */
113 int topMargin() const;
114 /** Returns the bottom line of the scrolling region. */
115 int bottomMargin() const;
116
117 /**
118 * Resets the scrolling margins back to the top and bottom lines
119 * of the screen.
120 */
121 void setDefaultMargins();
122
123 /**
124 * Moves the cursor down one line, if the MODE_NewLine mode
125 * flag is enabled then the cursor is returned to the leftmost
126 * column first.
127 *
128 * Equivalent to NextLine() if the MODE_NewLine flag is set
129 * or index() otherwise.
130 */
131 void newLine();
132 /**
133 * Moves the cursor down one line and positions it at the beginning
134 * of the line. Equivalent to calling Return() followed by index()
135 */
136 void nextLine();
137
138 /**
139 * Move the cursor down one line. If the cursor is on the bottom
140 * line of the scrolling region (as returned by bottomMargin()) the
141 * scrolling region is scrolled up by one line instead.
142 */
143 void index();
144 /**
145 * Move the cursor up one line. If the cursor is on the top line
146 * of the scrolling region (as returned by topMargin()) the scrolling
147 * region is scrolled down by one line instead.
148 */
149 void reverseIndex();
150
151 /**
152 * Scroll the scrolling region of the screen up by @p n lines.
153 * The scrolling region is initially the whole screen, but can be changed
154 * using setMargins()
155 */
156 void scrollUp(int n);
157 /**
158 * Scroll the scrolling region of the screen down by @p n lines.
159 * The scrolling region is initially the whole screen, but can be changed
160 * using setMargins()
161 */
162 void scrollDown(int n);
163 /**
164 * Moves the cursor to the beginning of the current line.
165 * Equivalent to setCursorX(0)
166 */
167 void toStartOfLine();
168 /**
169 * Moves the cursor one column to the left and erases the character
170 * at the new cursor position.
171 */
172 void backspace();
173 /** Moves the cursor @p n tab-stops to the right. */
174 void tab(int n = 1);
175 /** Moves the cursor @p n tab-stops to the left. */
176 void backtab(int n);
177
178 // Editing
179
180 /**
181 * Erase @p n characters beginning from the current cursor position.
182 * This is equivalent to over-writing @p n characters starting with the current
183 * cursor position with spaces.
184 * If @p n is 0 then one character is erased.
185 */
186 void eraseChars(int n);
187 /**
188 * Delete @p n characters beginning from the current cursor position.
189 * If @p n is 0 then one character is deleted.
190 */
191 void deleteChars(int n);
192 /**
193 * Insert @p n blank characters beginning from the current cursor position.
194 * The position of the cursor is not altered.
195 * If @p n is 0 then one character is inserted.
196 */
197 void insertChars(int n);
198 /**
199 * Repeat the preceeding graphic character @count times, including SPACE.
200 * If @count is 0 then the character is repeated once.
201 */
202 void repeatChars(int count);
203 /**
204 * Removes @p n lines beginning from the current cursor position.
205 * The position of the cursor is not altered.
206 * If @p n is 0 then one line is removed.
207 */
208 void deleteLines(int n);
209 /**
210 * Inserts @p lines beginning from the current cursor position.
211 * The position of the cursor is not altered.
212 * If @p n is 0 then one line is inserted.
213 */
214 void insertLines(int n);
215 /** Clears all the tab stops. */
216 void clearTabStops();
217 /** Sets or removes a tab stop at the cursor's current column. */
218 void changeTabStop(bool set);
219
220 /** Resets (clears) the specified screen @p mode. */
221 void resetMode(int mode);
222 /** Sets (enables) the specified screen @p mode. */
223 void setMode(int mode);
224 /**
225 * Saves the state of the specified screen @p mode. It can be restored
226 * using restoreMode()
227 */
228 void saveMode(int mode);
229 /** Restores the state of a screen @p mode saved by calling saveMode() */
230 void restoreMode(int mode);
231 /** Returns whether the specified screen @p mode is enabled or not .*/
232 bool getMode(int mode) const;
233
234 /**
235 * Saves the current position and appearance (text color and style) of the cursor.
236 * It can be restored by calling restoreCursor()
237 */
238 void saveCursor();
239 /** Restores the position and appearance of the cursor. See saveCursor() */
240 void restoreCursor();
241
242 /** Clear the whole screen, moving the current screen contents into the history first. */
243 void clearEntireScreen();
244 /**
245 * Clear the area of the screen from the current cursor position to the end of
246 * the screen.
247 */
248 void clearToEndOfScreen();
249 /**
250 * Clear the area of the screen from the current cursor position to the start
251 * of the screen.
252 */
254 /** Clears the whole of the line on which the cursor is currently positioned. */
255 void clearEntireLine();
256 /** Clears from the current cursor position to the end of the line. */
257 void clearToEndOfLine();
258 /** Clears from the current cursor position to the beginning of the line. */
259 void clearToBeginOfLine();
260
261 /** Fills the entire screen with the letter 'E' */
262 void helpAlign();
263
264 /**
265 * Enables the given @p rendition flag. Rendition flags control the appearance
266 * of characters on the screen.
267 *
268 * @see Character::rendition
269 */
270 void setRendition(int rendition);
271 /**
272 * Disables the given @p rendition flag. Rendition flags control the appearance
273 * of characters on the screen.
274 *
275 * @see Character::rendition
276 */
277 void resetRendition(int rendition);
278
279 /**
280 * Sets the cursor's foreground color.
281 * @param space The color space used by the @p color argument
282 * @param color The new foreground color. The meaning of this depends on
283 * the color @p space used.
284 *
285 * @see CharacterColor
286 */
287 void setForeColor(int space, int color);
288 /**
289 * Sets the cursor's background color.
290 * @param space The color space used by the @p color argumnet.
291 * @param color The new background color. The meaning of this depends on
292 * the color @p space used.
293 *
294 * @see CharacterColor
295 */
296 void setBackColor(int space, int color);
297 /**
298 * Resets the cursor's color back to the default and sets the
299 * character's rendition flags back to the default settings.
300 */
301 void setDefaultRendition();
302
303 /** Returns the column which the cursor is positioned at. */
304 int getCursorX() const;
305 /** Returns the line which the cursor is positioned on. */
306 int getCursorY() const;
307
308 /** Clear the entire screen and move the cursor to the home position.
309 * Equivalent to calling clearEntireScreen() followed by home().
310 */
311 void clear();
312 /**
313 * Sets the position of the cursor to the 'home' position at the top-left
314 * corner of the screen (0,0)
315 */
316 void home();
317 /**
318 * Resets the state of the screen. This resets the various screen modes
319 * back to their default states. The cursor style and colors are reset
320 * (as if setDefaultRendition() had been called)
321 *
322 * <ul>
323 * <li>Line wrapping is enabled.</li>
324 * <li>Origin mode is disabled.</li>
325 * <li>Insert mode is disabled.</li>
326 * <li>Cursor mode is enabled. TODO Document me</li>
327 * <li>Screen mode is disabled. TODO Document me</li>
328 * <li>New line mode is disabled. TODO Document me</li>
329 * </ul>
330 *
331 * If @p clearScreen is true then the screen contents are erased entirely,
332 * otherwise they are unaltered.
333 */
334 void reset(bool clearScreen = true);
335
336 /**
337 * Displays a new character at the current cursor position.
338 *
339 * If the cursor is currently positioned at the right-edge of the screen and
340 * line wrapping is enabled then the character is added at the start of a new
341 * line below the current one.
342 *
343 * If the MODE_Insert screen mode is currently enabled then the character
344 * is inserted at the current cursor position, otherwise it will replace the
345 * character already at the current cursor position.
346 */
347 void displayCharacter(QChar c);
348
349 // Do composition with last shown character FIXME: Not implemented yet for KDE 4
350 void compose(const QString &compose);
351
352 /**
353 * Resizes the image to a new fixed size of @p new_lines by @p new_columns.
354 * In the case that @p new_columns is smaller than the current number of columns,
355 * existing lines are not truncated. This prevents characters from being lost
356 * if the terminal display is resized smaller and then larger again.
357 *
358 * The top and bottom margins are reset to the top and bottom of the new
359 * screen size. Tab stops are also reset and the current selection is
360 * cleared.
361 */
362 void resizeImage(int new_lines, int new_columns);
363
364 /**
365 * Returns the current screen image.
366 * The result is an array of Characters of size [getLines()][getColumns()] which
367 * must be freed by the caller after use.
368 *
369 * @param dest Buffer to copy the characters into
370 * @param size Size of @p dest in Characters
371 * @param startLine Index of first line to copy
372 * @param endLine Index of last line to copy
373 */
374 void getImage(std::span<Character> dest, int size, int startLine, int endLine) const;
375
376 /**
377 * Returns the additional attributes associated with lines in the image.
378 * The most important attribute is LINE_WRAPPED which specifies that the
379 * line is wrapped,
380 * other attributes control the size of characters in the line.
381 */
382 QVector<LineProperty> getLineProperties(int startLine, int endLine) const;
383
384 /** Return the number of lines. */
385 int getLines() const
386 {
387 return lines;
388 }
389 /** Return the number of columns. */
390 int getColumns() const
391 {
392 return columns;
393 }
394 /** Return the number of lines in the history buffer. */
395 int getHistLines() const;
396 /**
397 * Sets the type of storage used to keep lines in the history.
398 * If @p copyPreviousScroll is true then the contents of the previous
399 * history buffer are copied into the new scroll.
400 */
401 void setScroll(const HistoryType &, bool copyPreviousScroll = true);
402 /** Returns the type of storage used to keep lines in the history. */
403 const HistoryType &getScroll() const;
404 /**
405 * Returns true if this screen keeps lines that are scrolled off the screen
406 * in a history buffer.
407 */
408 bool hasScroll() const;
409
410 /**
411 * Sets the start of the selection.
412 *
413 * @param column The column index of the first character in the selection.
414 * @param line The line index of the first character in the selection.
415 * @param blockSelectionMode True if the selection is in column mode.
416 */
417 void setSelectionStart(const int column, const int line, const bool blockSelectionMode);
418
419 /**
420 * Sets the end of the current selection.
421 *
422 * @param column The column index of the last character in the selection.
423 * @param line The line index of the last character in the selection.
424 */
425 void setSelectionEnd(const int column, const int line);
426
427 /**
428 * Retrieves the start of the selection or the cursor position if there
429 * is no selection.
430 */
431 void getSelectionStart(int &column, int &line) const;
432
433 /**
434 * Retrieves the end of the selection or the cursor position if there
435 * is no selection.
436 */
437 void getSelectionEnd(int &column, int &line) const;
438
439 /** Clears the current selection */
440 void clearSelection();
441
442 /**
443 * Returns true if the character at (@p column, @p line) is part of the
444 * current selection.
445 */
446 bool isSelected(const int column, const int line) const;
447
448 /**
449 * Convenience method. Returns the currently selected text.
450 * @param preserveLineBreaks Specifies whether new line characters should
451 * be inserted into the returned text at the end of each terminal line.
452 */
453 QString selectedText(bool preserveLineBreaks) const;
454
455 /**
456 * Copies part of the output to a stream.
457 *
458 * @param decoder A decoder which converts terminal characters into text
459 * @param fromLine The first line in the history to retrieve
460 * @param toLine The last line in the history to retrieve
461 */
462 void writeLinesToStream(TerminalCharacterDecoder *decoder, int fromLine, int toLine) const;
463
464 /**
465 * Copies the selected characters, set using @see setSelBeginXY and @see setSelExtentXY
466 * into a stream.
467 *
468 * @param decoder A decoder which converts terminal characters into text.
469 * PlainTextDecoder is the most commonly used decoder which converts characters
470 * into plain text with no formatting.
471 * @param preserveLineBreaks Specifies whether new line characters should
472 * be inserted into the returned text at the end of each terminal line.
473 */
474 void writeSelectionToStream(TerminalCharacterDecoder *decoder, bool preserveLineBreaks = true) const;
475
476 /**
477 * Checks if the text between from and to is inside the current
478 * selection. If this is the case, the selection is cleared. The
479 * from and to are coordinates in the current viewable window.
480 * The loc(x,y) macro can be used to generate these values from a
481 * column,line pair.
482 *
483 * @param from The start of the area to check.
484 * @param to The end of the area to check
485 */
486 void checkSelection(int from, int to);
487
488 /**
489 * Sets or clears an attribute of the current line.
490 *
491 * @param property The attribute to set or clear
492 * Possible properties are:
493 * LINE_WRAPPED: Specifies that the line is wrapped.
494 * LINE_DOUBLEWIDTH: Specifies that the characters in the current line
495 * should be double the normal width.
496 * LINE_DOUBLEHEIGHT:Specifies that the characters in the current line
497 * should be double the normal height.
498 * Double-height lines are formed of two lines containing the same characters,
499 * with both having the LINE_DOUBLEHEIGHT attribute.
500 * This allows other parts of the code to work on the
501 * assumption that all lines are the same height.
502 *
503 * @param enable true to apply the attribute to the current line or false to remove it
504 */
505 void setLineProperty(LineProperty property, bool enable);
506
507 /**
508 * Returns the number of lines that the image has been scrolled up or down by,
509 * since the last call to resetScrolledLines().
510 *
511 * a positive return value indicates that the image has been scrolled up,
512 * a negative return value indicates that the image has been scrolled down.
513 */
514 int scrolledLines() const;
515
516 /**
517 * Returns the region of the image which was last scrolled.
518 *
519 * This is the area of the image from the top margin to the
520 * bottom margin when the last scroll occurred.
521 */
523
524 /**
525 * Resets the count of the number of lines that the image has been scrolled up or down by,
526 * see scrolledLines()
527 */
528 void resetScrolledLines();
529
530 /**
531 * Returns the number of lines of output which have been
532 * dropped from the history since the last call
533 * to resetDroppedLines()
534 *
535 * If the history is not unlimited then it will drop
536 * the oldest lines of output if new lines are added when
537 * it is full.
538 */
539 int droppedLines() const;
540
541 /**
542 * Resets the count of the number of lines dropped from
543 * the history.
544 */
545 void resetDroppedLines();
546
547 /**
548 * Fills the buffer @p dest with @p count instances of the default (ie. blank)
549 * Character style.
550 */
551 static void fillWithDefaultChar(std::span<Character> dest, int count);
552
553private:
554 Screen(const Screen &) = delete;
555 Screen &operator=(const Screen &) = delete;
556
557 // copies a line of text from the screen or history into a stream using a
558 // specified character decoder. Returns the number of lines actually copied,
559 // which may be less than 'count' if (start+count) is more than the number of characters on
560 // the line
561 //
562 // line - the line number to copy, from 0 (the earliest line in the history) up to
563 // history->getLines() + lines - 1
564 // start - the first column on the line to copy
565 // count - the number of characters on the line to copy
566 // decoder - a decoder which converts terminal characters (an Character array) into text
567 // appendNewLine - if true a new line character (\n) is appended to the end of the line
568 int copyLineToStream(int line, int start, int count, TerminalCharacterDecoder *decoder, bool appendNewLine, bool preserveLineBreaks) const;
569
570 // fills a section of the screen image with the character 'c'
571 // the parameters are specified as offsets from the start of the screen image.
572 // the loc(x,y) macro can be used to generate these values from a column,line pair.
573 void clearImage(int loca, int loce, char c);
574
575 // move screen image between 'sourceBegin' and 'sourceEnd' to 'dest'.
576 // the parameters are specified as offsets from the start of the screen image.
577 // the loc(x,y) macro can be used to generate these values from a column,line pair.
578 //
579 // NOTE: moveImage() can only move whole lines
580 void moveImage(int dest, int sourceBegin, int sourceEnd);
581 // scroll up 'i' lines in current region, clearing the bottom 'i' lines
582 void scrollUp(int from, int i);
583 // scroll down 'i' lines in current region, clearing the top 'i' lines
584 void scrollDown(int from, int i);
585
586 void addHistLine();
587
588 void initTabStops();
589
590 void updateEffectiveRendition();
591 void reverseRendition(Character &p) const;
592
593 bool isSelectionValid() const;
594 // copies text from 'startIndex' to 'endIndex' to a stream
595 // startIndex and endIndex are positions generated using the loc(x,y) macro
596 void writeToStream(TerminalCharacterDecoder *decoder, int startIndex, int endIndex, bool preserveLineBreaks = true) const;
597 // copies 'count' lines from the screen buffer into 'dest',
598 // starting from 'startLine', where 0 is the first line in the screen buffer
599 void copyFromScreen(std::span<Character> dest, int startLine, int count) const;
600 // copies 'count' lines from the history buffer into 'dest',
601 // starting from 'startLine', where 0 is the first line in the history
602 void copyFromHistory(std::span<Character> dest, int startLine, int count) const;
603
604 // screen image ----------------
605 int lines;
606 int columns;
607
608 typedef QVector<Character> ImageLine; // [0..columns]
609 QVector<ImageLine> screenLines; // [lines]
610
611 int _scrolledLines;
612 QRect _lastScrolledRegion;
613
614 int _droppedLines;
615
617
618 // history buffer ---------------
619 std::unique_ptr<HistoryScroll> history;
620
621 // cursor location
622 int cuX;
623 int cuY;
624
625 // cursor color and rendition info
626 CharacterColor currentForeground;
627 CharacterColor currentBackground;
628 quint8 currentRendition;
629
630 // margins ----------------
631 int _topMargin;
632 int _bottomMargin;
633
634 // states ----------------
635 bool currentModes[MODES_SCREEN];
636 bool savedModes[MODES_SCREEN];
637
638 // ----------------------------
639
640 QBitArray tabStops;
641
642 // selection -------------------
643 int selBegin; // The first location selected.
644 int selTopLeft; // TopLeft Location.
645 int selBottomRight; // Bottom Right Location.
646 bool blockSelectionMode; // Column selection mode
647
648 // effective colors and rendition ------------
649 CharacterColor effectiveForeground; // These are derived from
650 CharacterColor effectiveBackground; // the cu_* variables above
651 quint8 effectiveRendition; // to speed up operation
652
653 class SavedState
654 {
655 public:
656 constexpr SavedState()
657 : cursorColumn(0)
658 , cursorLine(0)
659 , rendition(0)
660 {
661 }
662
663 int cursorColumn;
664 int cursorLine;
665 quint8 rendition;
666 CharacterColor foreground;
667 CharacterColor background;
668 };
669 SavedState savedState;
670
671 // last position where we added a character
672 int lastPos;
673
674 // used in REP (repeating char)
675 QChar lastDrawnChar;
676
677 static Character defaultChar;
678};
679
680}
681
682#endif // SCREEN_H
Describes the color of a single character in the terminal.
A single character in the terminal which consists of a unicode character value, foreground and backgr...
Definition Character.h:63
An image of characters with associated attributes.
Definition Screen.h:70
void setCursorYX(int y, int x)
Position the cursor at line y, column x.
Definition Screen.cpp:790
void saveMode(int mode)
Saves the state of the specified screen mode.
Definition Screen.cpp:290
int getCursorY() const
Returns the line which the cursor is positioned on.
Definition Screen.cpp:828
void clearToEndOfScreen()
Clear the area of the screen from the current cursor position to the end of the screen.
Definition Screen.cpp:937
void resizeImage(int new_lines, int new_columns)
Resizes the image to a new fixed size of new_lines by new_columns.
Definition Screen.cpp:324
void deleteChars(int n)
Delete n characters beginning from the current cursor position.
Definition Screen.cpp:199
void setMargins(int topLine, int bottomLine)
Sets the margins for scrolling the screen.
Definition Screen.cpp:139
void checkSelection(int from, int to)
Checks if the text between from and to is inside the current selection.
Definition Screen.cpp:636
void setScroll(const HistoryType &, bool copyPreviousScroll=true)
Sets the type of storage used to keep lines in the history.
Definition Screen.cpp:1300
void reset(bool clearScreen=true)
Resets the state of the screen.
Definition Screen.cpp:539
void clearEntireScreen()
Clear the whole screen, moving the current screen contents into the history first.
Definition Screen.cpp:947
void getImage(std::span< Character > dest, int size, int startLine, int endLine) const
Returns the current screen image.
Definition Screen.cpp:475
void saveCursor()
Saves the current position and appearance (text color and style) of the cursor.
Definition Screen.cpp:305
void clearToBeginOfLine()
Clears from the current cursor position to the beginning of the line.
Definition Screen.cpp:972
void clearEntireLine()
Clears the whole of the line on which the cursor is currently positioned.
Definition Screen.cpp:977
void clear()
Clear the entire screen and move the cursor to the home position.
Definition Screen.cpp:561
void setCursorY(int y)
Position the cursor on line y.
Definition Screen.cpp:804
const HistoryType & getScroll() const
Returns the type of storage used to keep lines in the history.
Definition Screen.cpp:1317
void insertChars(int n)
Insert n blank characters beginning from the current cursor position.
Definition Screen.cpp:220
Screen(int lines, int columns)
Construct a new screen image of size lines by columns.
Definition Screen.cpp:65
void writeSelectionToStream(TerminalCharacterDecoder *decoder, bool preserveLineBreaks=true) const
Copies the selected characters, set using.
Definition Screen.cpp:1121
void tab(int n=1)
Moves the cursor n tab-stops to the right.
Definition Screen.cpp:579
void changeTabStop(bool set)
Sets or removes a tab stop at the cursor's current column.
Definition Screen.cpp:611
void cursorDown(int n)
Move the cursor down by n lines.
Definition Screen.cpp:112
void setDefaultMargins()
Resets the scrolling margins back to the top and bottom lines of the screen.
Definition Screen.cpp:366
void home()
Sets the position of the cursor to the 'home' position at the top-left corner of the screen (0,...
Definition Screen.cpp:812
void backtab(int n)
Moves the cursor n tab-stops to the left.
Definition Screen.cpp:592
void setCursorX(int x)
Position the cursor at column x.
Definition Screen.cpp:796
void setSelectionEnd(const int column, const int line)
Sets the end of the current selection.
Definition Screen.cpp:1061
void displayCharacter(QChar c)
Displays a new character at the current cursor position.
Definition Screen.cpp:646
void clearTabStops()
Clears all the tab stops.
Definition Screen.cpp:605
void clearToBeginOfScreen()
Clear the area of the screen from the current cursor position to the start of the screen.
Definition Screen.cpp:942
void eraseChars(int n)
Erase n characters beginning from the current cursor position.
Definition Screen.cpp:191
static void fillWithDefaultChar(std::span< Character > dest, int count)
Fills the buffer dest with count instances of the default (ie.
Definition Screen.cpp:1329
void writeLinesToStream(TerminalCharacterDecoder *decoder, int fromLine, int toLine) const
Copies part of the output to a stream.
Definition Screen.cpp:1237
void repeatChars(int count)
Repeat the preceeding graphic character @count times, including SPACE.
Definition Screen.cpp:234
void getSelectionStart(int &column, int &line) const
Retrieves the start of the selection or the cursor position if there is no selection.
Definition Screen.cpp:1029
int getHistLines() const
Return the number of lines in the history buffer.
Definition Screen.cpp:1295
void helpAlign()
Fills the entire screen with the letter 'E'.
Definition Screen.cpp:962
void getSelectionEnd(int &column, int &line) const
Retrieves the end of the selection or the cursor position if there is no selection.
Definition Screen.cpp:1039
int getCursorX() const
Returns the column which the cursor is positioned at.
Definition Screen.cpp:823
QRect lastScrolledRegion() const
Returns the region of the image which was last scrolled.
Definition Screen.cpp:746
void cursorUp(int n)
Move the cursor up by n lines.
Definition Screen.cpp:102
int topMargin() const
Returns the top line of the scrolling region.
Definition Screen.cpp:157
int getLines() const
Return the number of lines.
Definition Screen.h:385
int scrolledLines() const
Returns the number of lines that the image has been scrolled up or down by, since the last call to re...
Definition Screen.cpp:720
void clearSelection()
Clears the current selection.
Definition Screen.cpp:1022
void setSelectionStart(const int column, const int line, const bool blockSelectionMode)
Sets the start of the selection.
Definition Screen.cpp:1049
bool getMode(int mode) const
Returns whether the specified screen mode is enabled or not .
Definition Screen.cpp:300
void setLineProperty(LineProperty property, bool enable)
Sets or clears an attribute of the current line.
Definition Screen.cpp:1322
void setMode(int mode)
Sets (enables) the specified screen mode.
Definition Screen.cpp:268
bool isSelected(const int column, const int line) const
Returns true if the character at (column, line) is part of the current selection.
Definition Screen.cpp:1092
void setDefaultRendition()
Resets the cursor's color back to the default and sets the character's rendition flags back to the de...
Definition Screen.cpp:994
void resetScrolledLines()
Resets the count of the number of lines that the image has been scrolled up or down by,...
Definition Screen.cpp:732
void backspace()
Moves the cursor one column to the left and erases the character at the new cursor position.
Definition Screen.cpp:567
void scrollDown(int n)
Scroll the scrolling region of the screen down by n lines.
Definition Screen.cpp:768
void scrollUp(int n)
Scroll the scrolling region of the screen up by n lines.
Definition Screen.cpp:737
void cursorRight(int n)
Move the cursor to the right by n columns.
Definition Screen.cpp:131
void restoreMode(int mode)
Restores the state of a screen mode saved by calling saveMode()
Definition Screen.cpp:295
int bottomMargin() const
Returns the bottom line of the scrolling region.
Definition Screen.cpp:161
QVector< LineProperty > getLineProperties(int startLine, int endLine) const
Returns the additional attributes associated with lines in the image.
Definition Screen.cpp:508
void resetRendition(int rendition)
Disables the given rendition flag.
Definition Screen.cpp:988
void toStartOfLine()
Moves the cursor to the beginning of the current line.
Definition Screen.cpp:818
void resetDroppedLines()
Resets the count of the number of lines dropped from the history.
Definition Screen.cpp:728
void newLine()
Moves the cursor down one line, if the MODE_NewLine mode flag is enabled then the cursor is returned ...
Definition Screen.cpp:629
void restoreCursor()
Restores the position and appearance of the cursor.
Definition Screen.cpp:314
int getColumns() const
Return the number of columns.
Definition Screen.h:390
void setRendition(int rendition)
Enables the given rendition flag.
Definition Screen.cpp:982
void setBackColor(int space, int color)
Sets the cursor's background color.
Definition Screen.cpp:1012
int droppedLines() const
Returns the number of lines of output which have been dropped from the history since the last call to...
Definition Screen.cpp:724
void deleteLines(int n)
Removes n lines beginning from the current cursor position.
Definition Screen.cpp:254
void resetMode(int mode)
Resets (clears) the specified screen mode.
Definition Screen.cpp:279
QString selectedText(bool preserveLineBreaks) const
Convenience method.
Definition Screen.cpp:1103
void index()
Move the cursor down one line.
Definition Screen.cpp:166
void nextLine()
Moves the cursor down one line and positions it at the beginning of the line.
Definition Screen.cpp:184
void reverseIndex()
Move the cursor up one line.
Definition Screen.cpp:175
void clearToEndOfLine()
Clears from the current cursor position to the end of the line.
Definition Screen.cpp:967
void cursorLeft(int n)
Move the cursor to the left by n columns.
Definition Screen.cpp:122
bool hasScroll() const
Returns true if this screen keeps lines that are scrolled off the screen in a history buffer.
Definition Screen.cpp:1312
void setForeColor(int space, int color)
Sets the cursor's foreground color.
Definition Screen.cpp:1002
void insertLines(int n)
Inserts lines beginning from the current cursor position.
Definition Screen.cpp:261
Base class for terminal character decoders.
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:55:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.