wxMaxima
Loading...
Searching...
No Matches
Functions
TextBreaks.h File Reference

Splits a line of plain text Maxima sends into the pieces the worksheet may break it into lines between. More...

#include <wx/string.h>
#include <vector>
Include dependency graph for TextBreaks.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool wxm::IsTextBreakChar (wxUniChar ch)
 Is a line break allowed after this character?
 
std::vector< wxString > wxm::SplitAtTextBreaks (const wxString &line)
 Split one line of text (no newlines) after the characters a line may be broken after.
 

Detailed Description

Splits a line of plain text Maxima sends into the pieces the worksheet may break it into lines between.

Text Maxima sends outside of its XML – warnings, errors, status messages, printf() output – used to become one cell per line. The worksheet only breaks output between cells, so a long message ran off the right edge of the window. MaximaOutputAppender::DoRawConsoleAppend() therefore turns such a line into one TextCell per piece returned here, the pieces after the first marked as continuing the one before (TextCell::IsTextContinuation()), so that, as long as the line fits, it looks exactly as it did before.

Text Maxima marks as 2D ASCII-art maths (<wxxml-asciimath>) is never split: its columns only line up if every line stays in one piece.

GUI-free, so test_TextBreaks can pin it directly.

Function Documentation

◆ IsTextBreakChar()

bool wxm::IsTextBreakChar ( wxUniChar  ch)

Is a line break allowed after this character?

True for a space, a tab, "+", "-", ",", ";", ".", "*" and "/".

◆ SplitAtTextBreaks()

std::vector< wxString > wxm::SplitAtTextBreaks ( const wxString &  line)

Split one line of text (no newlines) after the characters a line may be broken after.

Concatenating the pieces always gives back line unchanged. The character that allows the break stays at the end of the piece before the break. A run of such characters stays together (", " breaks after the space, "--" after the second "-"), and the line isn't broken

  • before its first character that isn't a break character, so indentation stays with the word it indents, or
  • after a "." or a "," that is followed by a digit, so a number like 3.14 or 1,000 is never torn apart, or
  • inside a link (see wxm::FindUrls()): a link is only shown as one if all of it is in the same cell.