NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
TextManager Class Reference

This class manages the actual text by storing it in an internal buffer. During an update the TextManager will render the text in the internal buffer into the text block in screen coordinates. More...

#include <TextManager.h>

Collaboration diagram for TextManager:

Public Member Functions

 TextManager (GenericTerminal *parent=nullptr, int width=80, int height=24, int maxWidth=160, int maxHeight=300)
 
 ~TextManager ()
 Destructor will reset the internal buffer. More...
 
void printOutput (const std::string &sLine)
 This is the read-only print function. More...
 
void insertInput (const std::string &sLine, size_t logicalpos=std::string::npos)
 This is the user input function. More...
 
ViewCursor toViewCursor (const LogicalCursor &logCursor) const
 Convert a logical cursor to a view cursor. More...
 
ViewCursor getCurrentViewPos () const
 Returns the current cursor position as view cursor. More...
 
LogicalCursor toLogicalCursor (const ViewCursor &viewCursor) const
 Convert a view cursor into a logical cursor. More...
 
LogicalCursor getCurrentLogicalPos () const
 Returns the current cursor position as logical cursor. More...
 
std::string getRenderedString (size_t viewLine) const
 Return the rendered line for the current viewport setting. More...
 
std::vector< unsigned short > getRenderedColors (size_t viewLine) const
 Return the rendered colors for the selected viewport line. More...
 
size_t tab ()
 Insert a tab character at the current position. More...
 
void newLine ()
 Adds a new line to the current managed text. More...
 
void backspace (const LogicalCursor &logCursor)
 Performs a backspace operation. More...
 
void eraseLine ()
 Erase the current line. More...
 
bool clearRange (const ViewCursor &cursor1, const ViewCursor &cursor2)
 Clears the range between two view cursors. More...
 
void selectText (const ViewCursor &viewCursor, bool bSelect=true)
 Selects the text at the view cursor position. More...
 
void unselectAll ()
 This member function unselects the whole text at once. More...
 
bool isSelected (const ViewCursor &viewCursor) const
 Determines, whether the pointed character is selected. More...
 
bool isSelectedLogical (const LogicalCursor &cursor) const
 Determines, whether the pointed character is selected. More...
 
std::string getSelectedText () const
 This member function returns the selected text. More...
 
std::string getCurrentInputLine () const
 Returns the contents of the input line. More...
 
std::string getPreviousLine () const
 This member function returns the contents of the line before the current input line. More...
 
int GetSize () const
 
int GetMaxSize () const
 Returns the buffer size of the terminal. More...
 
int GetHeight () const
 
int GetNumLinesScrolled () const
 
int GetLinesReceived () const
 
std::string GetInputHistory (bool vcursorup=true)
 Get the next history line. More...
 
std::string GetTextRange (int y, int x0, int x1) const
 Extracts the text between the positions. More...
 
std::string GetWordAt (int y, int x) const
 Returns the word at the passed position. More...
 
std::string GetWordStartAt (int y, int x) const
 Returns the word start at the passed position. More...
 
char GetCharAdjusted (int y, int x) const
 
char GetCharLogical (const LogicalCursor &cursor) const
 Returns the character at the logical position. More...
 
bool IsUserText (int y, int x) const
 Determines, whether the character at (x,y) is a user text. More...
 
bool IsEditable (int y, int x) const
 Determines, whether the character at (x,y) is editable text. More...
 
bool IsEditableLogical (const LogicalCursor &logCursor) const
 Determines, whether the character at the logical position is editable text. More...
 
unsigned short GetColor (int y, int x) const
 
unsigned short GetColorAdjusted (int y, int x) const
 
void ChangeEditableState ()
 Removes the editable flag from the managed text. More...
 
void SetMaxSize (int newSize)
 
void ResetVirtualCursorLine ()
 
void SetColorAdjusted (int y, int x, unsigned short value)
 
bool Scroll (int numLines, bool scrollUp)
 
void Resize (int width, int height)
 
void Reset ()
 
std::string operator[] (int index)
 
int AdjustIndex (int index) const
 

Private Types

enum  { KERNEL_TEXT , USER_TEXT , EDITABLE_TEXT }
 

Private Member Functions

int calc_color (int fg, int bg, int flags)
 Helper function for converting the colors into a single int. More...
 
void updateColors (bool isErrorLine=false)
 Update the colors for the current line. More...
 
void renderLayout ()
 This function renders the layout. More...
 
void synchronizeRenderedBlock (int linesToDelete)
 Removes parts of the already rendered block. More...
 
size_t findNextLinebreak (const std::string &currentLine, size_t currentLinebreak) const
 Find the next linebreak position. More...
 

Private Attributes

GenericTerminalm_parent
 
int m_topLine
 
int m_bottomLine
 
int m_numLinesScrolledUp
 
int m_viewportWidth
 
int m_viewportHeight
 
int m_linesReceived
 
int m_maxWidth
 
int m_maxHeight
 
int m_virtualCursor
 
size_t m_tabLength
 
size_t m_indentDepth
 
std::deque< CharacterVectorm_managedText
 
std::deque< RenderedLinem_renderedBlock
 

Detailed Description

This class manages the actual text by storing it in an internal buffer. During an update the TextManager will render the text in the internal buffer into the text block in screen coordinates.

Definition at line 485 of file TextManager.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
KERNEL_TEXT 
USER_TEXT 
EDITABLE_TEXT 

Definition at line 575 of file TextManager.h.

Constructor & Destructor Documentation

◆ TextManager()

TextManager::TextManager ( GenericTerminal parent = nullptr,
int  width = 80,
int  height = 24,
int  maxWidth = 160,
int  maxHeight = 300 
)

public constructor TextManager It's a constructor. Yay.

Parameters
parentGTerm * [=0] The GTerm that owns this textmanager
widthint [=80] The starting width in characters
heightint [=24] The starting height in characters
maxWidthint [=160] The maximum possible characters in a line
maxHeightint [=100] The maximum lines of history to store
Returns
void
Author
Mark Erikson
Date
04-22-2004

Definition at line 46 of file TextManager.cpp.

References m_parent, and Reset().

Here is the call graph for this function:

◆ ~TextManager()

TextManager::~TextManager ( )

Destructor will reset the internal buffer.

Definition at line 60 of file TextManager.cpp.

References Reset().

Here is the call graph for this function:

Member Function Documentation

◆ AdjustIndex()

int TextManager::AdjustIndex ( int  index) const

private AdjustIndex Adjusts an index within the viewport to the absolute index in the main arrays

Parameters
indexint The unadjusted index
Returns
int The adjusted index
Author
Mark Erikson
Date
04-23-2004

Definition at line 1502 of file TextManager.cpp.

References m_numLinesScrolledUp, and m_topLine.

◆ backspace()

void TextManager::backspace ( const LogicalCursor logCursor)

Performs a backspace operation.

Parameters
logCursorconst LogicalCursor&
Returns
void

This member function performs a backspace operation at the passed logical cursor position. Backspaces are only allowed in the current input line, which is the last line of the managed text (but not necessarily the last line of the viewport line)

Definition at line 636 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, LogicalCursor::pos, renderLayout(), synchronizeRenderedBlock(), and updateColors().

Referenced by GenericTerminal::bs(), GenericTerminal::del(), and GenericTerminal::erase_usercontent_line().

Here is the call graph for this function:

◆ calc_color()

int TextManager::calc_color ( int  fg,
int  bg,
int  flags 
)
private

Helper function for converting the colors into a single int.

Parameters
fgint Color values ranging from 0-15
bgint Color values ranging from 0-15
flagsint
Returns
int

Definition at line 321 of file TextManager.cpp.

Referenced by renderLayout(), and updateColors().

◆ ChangeEditableState()

void TextManager::ChangeEditableState ( )

Removes the editable flag from the managed text.

Returns
void

This member function will switch every editable text to a simple user text

Definition at line 1481 of file TextManager.cpp.

References m_managedText.

Referenced by NumeReTerminal::filterKeyCodes().

◆ clearRange()

bool TextManager::clearRange ( const ViewCursor cursor1,
const ViewCursor cursor2 
)

Clears the range between two view cursors.

Parameters
cursor1const ViewCursor&
cursor2const ViewCursor&
Returns
bool

This member function is used to clear the range between the two view cursors. It may even clear the characters, which are spread across multiple lines

Definition at line 706 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, min, LogicalCursor::pos, renderLayout(), synchronizeRenderedBlock(), toLogicalCursor(), and updateColors().

Referenced by GenericTerminal::clear_area(), and GenericTerminal::delSelected().

Here is the call graph for this function:

◆ eraseLine()

void TextManager::eraseLine ( )

Erase the current line.

Returns
void

This member function erases the current line (i.e. the last line of the managed text) completely. This is used, if the printed string starts with a carriage return character

Definition at line 674 of file TextManager.cpp.

References m_managedText, renderLayout(), and synchronizeRenderedBlock().

Referenced by GenericTerminal::erase_line(), and GenericTerminal::normal_output().

Here is the call graph for this function:

◆ findNextLinebreak()

size_t TextManager::findNextLinebreak ( const std::string &  currentLine,
size_t  currentLinebreak 
) const
private

Find the next linebreak position.

Parameters
currentLineconst string&
currentLinebreaksize_t
Returns
size_t

This function finds the next possible linebreak position from the current position using a simple heuristic

Definition at line 534 of file TextManager.cpp.

References m_indentDepth, and m_viewportWidth.

Referenced by renderLayout().

◆ GetCharAdjusted()

char TextManager::GetCharAdjusted ( int  y,
int  x 
) const

public GetCharAdjusted Gets a character, adjusted for the viewport

Parameters
yint The line within the viewport that the character is on
xint The character position within that line
Returns
char The character at that position
Author
Mark Erikson
Date
04-23-2004

Definition at line 1317 of file TextManager.cpp.

References GetCharLogical(), and toLogicalCursor().

Referenced by GenericTerminal::GetChar(), GenericTerminal::getProcNameSpace(), GenericTerminal::tab(), and GenericTerminal::update_changes().

Here is the call graph for this function:

◆ GetCharLogical()

char TextManager::GetCharLogical ( const LogicalCursor cursor) const

Returns the character at the logical position.

Parameters
cursorconst LogicalCursor&
Returns
char

Definition at line 1331 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, and LogicalCursor::pos.

Referenced by GenericTerminal::ctrl_left(), GenericTerminal::ctrl_right(), and GetCharAdjusted().

◆ GetColor()

unsigned short TextManager::GetColor ( int  y,
int  x 
) const

public GetColor Gets an encoded color without adjusting for the viewport

Parameters
yint The line number
xint The character on that line
Returns
unsigned short The encoded color
Author
Mark Erikson
Date
04-23-2004

Definition at line 1418 of file TextManager.cpp.

References m_managedText.

◆ GetColorAdjusted()

unsigned short TextManager::GetColorAdjusted ( int  y,
int  x 
) const

public GetColorAdjusted Gets an encoded color, adjusted for the viewport

Parameters
yint The line number in the viewport
xint The character on that line
Returns
unsigned short The encoded color
Author
Mark Erikson
Date
04-23-2004

Definition at line 1435 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, LogicalCursor::pos, and toLogicalCursor().

Referenced by GenericTerminal::getProcNameSpace(), GenericTerminal::tab(), and GenericTerminal::update_changes().

Here is the call graph for this function:

◆ getCurrentInputLine()

string TextManager::getCurrentInputLine ( ) const

Returns the contents of the input line.

Returns
string

This member function will return the contents of the current user input line

Definition at line 889 of file TextManager.cpp.

References m_managedText.

Referenced by GenericTerminal::cursor_down(), GenericTerminal::cursor_up(), and NumeReTerminal::filterKeyCodes().

◆ getCurrentLogicalPos()

LogicalCursor TextManager::getCurrentLogicalPos ( ) const

Returns the current cursor position as logical cursor.

Returns
LogicalCursor

This function returns the current input cursor position (which is already a logical cursor). This position is extracted from the current position in the last line of the managed text

Definition at line 245 of file TextManager.cpp.

References m_managedText.

Referenced by GenericTerminal::delSelected(), getCurrentViewPos(), and GenericTerminal::normal_input().

◆ getCurrentViewPos()

ViewCursor TextManager::getCurrentViewPos ( ) const

Returns the current cursor position as view cursor.

Returns
ViewCursor

This function returns the current input cursor position (which is a logical cursor) and returns it as a view cursor

Definition at line 198 of file TextManager.cpp.

References getCurrentLogicalPos(), m_renderedBlock, and toViewCursor().

Referenced by GenericTerminal::bs(), GenericTerminal::erase_usercontent_line(), GenericTerminal::move_cursor(), GenericTerminal::normal_input(), GenericTerminal::normal_output(), and GenericTerminal::ResizeTerminal().

Here is the call graph for this function:

◆ GetHeight()

int TextManager::GetHeight ( ) const

◆ GetInputHistory()

string TextManager::GetInputHistory ( bool  vcursorup = true)

Get the next history line.

Parameters
vcursorupbool
Returns
string

This member function gets the next history line depending on the bool vcursorup

Definition at line 1125 of file TextManager.cpp.

References m_managedText, and m_virtualCursor.

Referenced by GenericTerminal::cursor_down(), and GenericTerminal::cursor_up().

◆ GetLinesReceived()

int TextManager::GetLinesReceived ( ) const

public GetLinesReceived Returns the number of lines received

Returns
int The number of lines received
Author
Mark Erikson
Date
04-23-2004

Definition at line 1579 of file TextManager.cpp.

References m_renderedBlock.

Referenced by GenericTerminal::GetScrollHeight().

◆ GetMaxSize()

int TextManager::GetMaxSize ( ) const

Returns the buffer size of the terminal.

Returns
int

Definition at line 1591 of file TextManager.cpp.

References m_maxHeight.

Referenced by GenericTerminal::GetScrollHeight().

◆ GetNumLinesScrolled()

int TextManager::GetNumLinesScrolled ( ) const

public GetNumLinesScrolled Returns the number of lines scrolled upwards

Returns
int The number of lines scrolled up
Author
Mark Erikson
Date
04-23-2004

Definition at line 1517 of file TextManager.cpp.

References m_numLinesScrolledUp.

Referenced by GenericTerminal::GetScrollPosition(), and GenericTerminal::IsScrolledUp().

◆ getPreviousLine()

string TextManager::getPreviousLine ( ) const

This member function returns the contents of the line before the current input line.

Returns
string

Definition at line 919 of file TextManager.cpp.

References m_managedText.

◆ getRenderedColors()

vector< unsigned short > TextManager::getRenderedColors ( size_t  viewLine) const

Return the rendered colors for the selected viewport line.

Parameters
viewLinesize_t
Returns
vector<unsigned short>

This function returns the colors for the rendered line, which goes into the selected viewLine. This function requires that the managed text is already rendered

Definition at line 289 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, m_numLinesScrolledUp, m_renderedBlock, m_topLine, m_viewportHeight, LogicalCursor::pos, and GenericTerminal::SELECTED.

Referenced by GenericTerminal::handle_calltip(), and GenericTerminal::update_changes().

◆ getRenderedString()

string TextManager::getRenderedString ( size_t  viewLine) const

Return the rendered line for the current viewport setting.

Parameters
viewLinesize_t
Returns
string

This function returns the rendered line, which goes into the selected viewLine. This function requires that the managed text is already rendered

Definition at line 268 of file TextManager.cpp.

References m_numLinesScrolledUp, m_renderedBlock, m_topLine, and m_viewportHeight.

Referenced by GenericTerminal::handle_calltip(), operator[](), and GenericTerminal::update_changes().

◆ getSelectedText()

string TextManager::getSelectedText ( ) const

This member function returns the selected text.

Returns
string

Definition at line 852 of file TextManager.cpp.

References isSelected(), and m_managedText.

Referenced by GenericTerminal::get_selected_text().

Here is the call graph for this function:

◆ GetSize()

int TextManager::GetSize ( ) const

public GetSize Returns the number of lines stored

Returns
int The number of lines stored
Author
Mark Erikson
Date
04-23-2004

Definition at line 1047 of file TextManager.cpp.

References m_managedText.

◆ GetTextRange()

string TextManager::GetTextRange ( int  y,
int  x0,
int  x1 
) const

Extracts the text between the positions.

Parameters
yint
x0int
x1int
Returns
string

Definition at line 1213 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, LogicalCursor::pos, and toLogicalCursor().

Referenced by GenericTerminal::getProcNameSpace().

Here is the call graph for this function:

◆ GetWordAt()

string TextManager::GetWordAt ( int  y,
int  x 
) const

Returns the word at the passed position.

Parameters
yint
xint
Returns
string

This member function returns the word, which contains the character at (x,y)

Definition at line 1237 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, LogicalCursor::pos, and toLogicalCursor().

Here is the call graph for this function:

◆ GetWordStartAt()

string TextManager::GetWordStartAt ( int  y,
int  x 
) const

Returns the word start at the passed position.

Parameters
yint
xint
Returns
string

This member function returns the word start, which contains the character at (x,y)

Definition at line 1281 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, LogicalCursor::pos, and toLogicalCursor().

Referenced by GenericTerminal::tab().

Here is the call graph for this function:

◆ insertInput()

void TextManager::insertInput ( const std::string &  sLine,
size_t  logicalpos = std::string::npos 
)

This is the user input function.

Parameters
sLineconst string&
logicalpossize_t
Returns
void

Adds the passed stringt to the internal managed text, stores it as user-given text and triggers the rendering section

Definition at line 115 of file TextManager.cpp.

References EDITABLE_TEXT, m_managedText, renderLayout(), synchronizeRenderedBlock(), and updateColors().

Referenced by GenericTerminal::normal_input().

Here is the call graph for this function:

◆ IsEditable()

bool TextManager::IsEditable ( int  y,
int  x 
) const

Determines, whether the character at (x,y) is editable text.

Parameters
yint
xint
Returns
bool

Definition at line 1372 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, LogicalCursor::pos, and toLogicalCursor().

Referenced by GenericTerminal::bs(), GenericTerminal::cursor_down(), GenericTerminal::cursor_up(), GenericTerminal::del(), GenericTerminal::delSelected(), GenericTerminal::end(), GenericTerminal::erase_usercontent_line(), GenericTerminal::home(), and GenericTerminal::move_cursor_editable_area().

Here is the call graph for this function:

◆ IsEditableLogical()

bool TextManager::IsEditableLogical ( const LogicalCursor logCursor) const

◆ isSelected()

bool TextManager::isSelected ( const ViewCursor viewCursor) const

Determines, whether the pointed character is selected.

Parameters
viewCursorconst ViewCursor&
Returns
bool

This member function returns true, if the character pointed by the passed view cursor is selected

Definition at line 819 of file TextManager.cpp.

References isSelectedLogical(), and toLogicalCursor().

Referenced by GenericTerminal::delSelected(), getSelectedText(), and GenericTerminal::IsSelected().

Here is the call graph for this function:

◆ isSelectedLogical()

bool TextManager::isSelectedLogical ( const LogicalCursor cursor) const

Determines, whether the pointed character is selected.

Parameters
cursorconst LogicalCursor&
Returns
bool

Definition at line 835 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, and LogicalCursor::pos.

Referenced by GenericTerminal::delSelected(), and isSelected().

◆ IsUserText()

bool TextManager::IsUserText ( int  y,
int  x 
) const

Determines, whether the character at (x,y) is a user text.

Parameters
yint
xint
Returns
bool

Definition at line 1349 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, LogicalCursor::pos, and toLogicalCursor().

Here is the call graph for this function:

◆ newLine()

void TextManager::newLine ( )

Adds a new line to the current managed text.

Returns
void

This function adds a new line to the internally managed text. If the managed text grows larger than the selected size, the first lines are dropped.

Definition at line 600 of file TextManager.cpp.

References EDITABLE_TEXT, m_managedText, m_maxHeight, renderLayout(), ResetVirtualCursorLine(), and synchronizeRenderedBlock().

Referenced by GenericTerminal::lf(), GenericTerminal::normal_output(), printOutput(), and tab().

Here is the call graph for this function:

◆ operator[]()

string TextManager::operator[] ( int  index)

public operator [] Allows access to a given line

Parameters
indexint The index of the line to retrieve (0 to number of lines displayed)
Returns
string & The line at that index
Author
Mark Erikson
Date
04-23-2004

Definition at line 963 of file TextManager.cpp.

References getRenderedString().

Here is the call graph for this function:

◆ printOutput()

void TextManager::printOutput ( const std::string &  sLine)

This is the read-only print function.

Parameters
sLineconst string&
Returns
void

Adds the passed stringt to the internal managed text, stores it as read-only text and triggers the rendering section

Definition at line 76 of file TextManager.cpp.

References KERNEL_TEXT, m_managedText, newLine(), renderLayout(), synchronizeRenderedBlock(), and updateColors().

Referenced by GenericTerminal::normal_output().

Here is the call graph for this function:

◆ renderLayout()

void TextManager::renderLayout ( )
private

This function renders the layout.

Returns
void

This function renders the layout for the current terminal size using the internally managed text. The rendered layout is cached, so only the missing lines have to be re- calculated

Definition at line 381 of file TextManager.cpp.

References calc_color(), RenderedLine::colors, RenderedLine::coords, findNextLinebreak(), m_indentDepth, m_managedText, m_renderedBlock, m_topLine, m_viewportHeight, LogicalCursor::pos, RenderedLine::sLine, and toString().

Referenced by backspace(), clearRange(), eraseLine(), insertInput(), newLine(), printOutput(), and Resize().

Here is the call graph for this function:

◆ Reset()

void TextManager::Reset ( )

public Reset Clears out the text and resets everything

Returns
void
Author
Mark Erikson
Date
04-22-2004

Definition at line 937 of file TextManager.cpp.

References m_bottomLine, m_indentDepth, m_linesReceived, m_managedText, m_maxHeight, m_numLinesScrolledUp, m_renderedBlock, m_tabLength, m_topLine, and m_viewportHeight.

Referenced by NumeReTerminal::clearTerminal(), GenericTerminal::reset(), TextManager(), and ~TextManager().

◆ ResetVirtualCursorLine()

void TextManager::ResetVirtualCursorLine ( )
inline

Definition at line 536 of file TextManager.h.

References m_managedText, and m_virtualCursor.

Referenced by newLine(), and GenericTerminal::resetAutoComp().

◆ Resize()

void TextManager::Resize ( int  width,
int  height 
)

public Resize Resizes the stored text to a given number of characters wide and high

Parameters
widthint The new number of characters displayed
heightint The new number of lines displayed
Returns
void
Author
Mark Erikson
Date
04-23-2004

Definition at line 1064 of file TextManager.cpp.

References LogicalCursor::line, m_numLinesScrolledUp, m_renderedBlock, m_topLine, m_viewportHeight, m_viewportWidth, LogicalCursor::pos, renderLayout(), and toLogicalCursor().

Referenced by GenericTerminal::ResizeTerminal().

Here is the call graph for this function:

◆ Scroll()

bool TextManager::Scroll ( int  numLines,
bool  scrollUp 
)

public Scroll Scrolls the viewport the given number of lines up or down

Parameters
numLinesint The number of lines to scroll
scrollUpbool True to scroll up, false to scroll down
Returns
void
Author
Mark Erikson
Date
04-23-2004

Definition at line 980 of file TextManager.cpp.

References m_numLinesScrolledUp, m_renderedBlock, m_topLine, and m_viewportHeight.

Referenced by GenericTerminal::Scroll().

◆ selectText()

void TextManager::selectText ( const ViewCursor viewCursor,
bool  bSelect = true 
)

Selects the text at the view cursor position.

Parameters
viewCursorconst ViewCursor&
bSelectbool
Returns
void

This member function is used to (de-)select the character at the position of the passed view cursor

Definition at line 775 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, LogicalCursor::pos, and toLogicalCursor().

Referenced by GenericTerminal::Select().

Here is the call graph for this function:

◆ SetColorAdjusted()

void TextManager::SetColorAdjusted ( int  y,
int  x,
unsigned short  value 
)

public SetColorAdjusted Sets an encoded color, adjusting the location for the viewport

Parameters
yint The line within the viewport
xint The character on that line
valueunsigned short The new encoded color
Returns
void
Author
Mark Erikson
Date
04-23-2004

Definition at line 1460 of file TextManager.cpp.

References LogicalCursor::line, m_managedText, LogicalCursor::pos, and toLogicalCursor().

Here is the call graph for this function:

◆ SetMaxSize()

void TextManager::SetMaxSize ( int  newSize)

public SetMaxSize Sets the maximum number of lines of history

Parameters
newSizeint The new maximum size
Returns
void
Author
Mark Erikson
Date
04-23-2004

Definition at line 1533 of file TextManager.cpp.

References m_bottomLine, m_linesReceived, m_managedText, m_maxHeight, m_numLinesScrolledUp, m_renderedBlock, m_topLine, and m_viewportHeight.

Referenced by GenericTerminal::SetTerminalHistory().

◆ synchronizeRenderedBlock()

void TextManager::synchronizeRenderedBlock ( int  linesToDelete)
private

Removes parts of the already rendered block.

Parameters
linesToDeleteint
Returns
void

This private member function removes parts of the already rendered block depending on the number of lines to delete. The number of lines corresponds to the text lines in the managed block. If the number is positive, the lines are deleted from the front, if the number is negative, then the lines are deleted from the back

Definition at line 474 of file TextManager.cpp.

References date::abs(), and m_renderedBlock.

Referenced by backspace(), clearRange(), eraseLine(), insertInput(), newLine(), printOutput(), and tab().

Here is the call graph for this function:

◆ tab()

size_t TextManager::tab ( )

Insert a tab character at the current position.

Returns
size_t

Definition at line 564 of file TextManager.cpp.

References m_managedText, m_tabLength, newLine(), and synchronizeRenderedBlock().

Referenced by GenericTerminal::normal_output().

Here is the call graph for this function:

◆ toLogicalCursor()

◆ toViewCursor()

ViewCursor TextManager::toViewCursor ( const LogicalCursor logCursor) const

◆ unselectAll()

void TextManager::unselectAll ( )

This member function unselects the whole text at once.

Returns
void

Definition at line 798 of file TextManager.cpp.

References m_managedText.

Referenced by NumeReTerminal::ClearSelection(), and NumeReTerminal::MarkSelection().

◆ updateColors()

void TextManager::updateColors ( bool  isErrorLine = false)
private

Update the colors for the current line.

Parameters
isErrorLinebool
Returns
void

This function determines the text snippets in the last line of the managed text and creates a color string for those snippets

Definition at line 337 of file TextManager.cpp.

References GenericTerminal::BOLD, calc_color(), GenericTerminal::getSyntax(), NumeReSyntax::highlightError(), NumeReSyntax::highlightLine(), m_managedText, m_parent, NumeReSyntax::SYNTAX_COMMAND, NumeReSyntax::SYNTAX_COMMENT, NumeReSyntax::SYNTAX_CONSTANT, NumeReSyntax::SYNTAX_FUNCTION, NumeReSyntax::SYNTAX_METHODS, NumeReSyntax::SYNTAX_PROCEDURE, NumeReSyntax::SYNTAX_SPECIALVAL, and GenericTerminal::UNDERLINE.

Referenced by backspace(), clearRange(), insertInput(), and printOutput().

Here is the call graph for this function:

Member Data Documentation

◆ m_bottomLine

int TextManager::m_bottomLine
private

Definition at line 554 of file TextManager.h.

Referenced by Reset(), and SetMaxSize().

◆ m_indentDepth

size_t TextManager::m_indentDepth
private

Definition at line 564 of file TextManager.h.

Referenced by findNextLinebreak(), renderLayout(), Reset(), and toViewCursor().

◆ m_linesReceived

int TextManager::m_linesReceived
private

Definition at line 558 of file TextManager.h.

Referenced by Reset(), and SetMaxSize().

◆ m_managedText

◆ m_maxHeight

int TextManager::m_maxHeight
private

Definition at line 560 of file TextManager.h.

Referenced by GetMaxSize(), newLine(), Reset(), and SetMaxSize().

◆ m_maxWidth

int TextManager::m_maxWidth
private

Definition at line 559 of file TextManager.h.

◆ m_numLinesScrolledUp

int TextManager::m_numLinesScrolledUp
private

◆ m_parent

GenericTerminal* TextManager::m_parent
private

Definition at line 551 of file TextManager.h.

Referenced by TextManager(), and updateColors().

◆ m_renderedBlock

◆ m_tabLength

size_t TextManager::m_tabLength
private

Definition at line 563 of file TextManager.h.

Referenced by Reset(), and tab().

◆ m_topLine

int TextManager::m_topLine
private

◆ m_viewportHeight

int TextManager::m_viewportHeight
private

◆ m_viewportWidth

int TextManager::m_viewportWidth
private

Definition at line 556 of file TextManager.h.

Referenced by findNextLinebreak(), and Resize().

◆ m_virtualCursor

int TextManager::m_virtualCursor
private

Definition at line 561 of file TextManager.h.

Referenced by GetInputHistory(), and ResetVirtualCursorLine().


The documentation for this class was generated from the following files: