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

Selecting some of the characters of the text in a cell's output (GH #825). More...

#include "CellPointers.h"
#include <optional>
#include <wx/gdicmn.h>
#include <wx/string.h>
Include dependency graph for OutputTextSelection.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::optional< DocumentCellPointers::TextRange > wxm::OutputTextRange (Cell *output, wxPoint down, wxPoint up)
 The characters a drag from down to up selects in an output.
 
wxString wxm::TextRangeToString (const DocumentCellPointers::TextRange &range)
 The text of a range of selected characters, as it is copied.
 

Detailed Description

Selecting some of the characters of the text in a cell's output (GH #825).

A drag in a cell's output used to select whole cells only, so copying half of an error message meant copying all of it. A drag that starts in text Maxima printed (TextCell::AllowsCharacterSelection()) now selects characters, as long as everything between where it started and where the pointer is now is such text.

How this stays out of the way of every other kind of selection:

Function Documentation

◆ OutputTextRange()

std::optional< DocumentCellPointers::TextRange > wxm::OutputTextRange ( Cell *  output,
wxPoint  down,
wxPoint  up 
)

The characters a drag from down to up selects in an output.

Parameters
outputthe first cell of a cell's output (GroupCell::GetLabel()), laid out.

Empty unless down is on a cell whose characters can be selected and every cell from there to the one up is at (or, if up is between or beside lines, the nearest one) can, too – the caller then selects whole cells, as before. Also empty if the drag covers no character at all, so that a drag that hasn't got anywhere yet selects what a click selects.

◆ TextRangeToString()

wxString wxm::TextRangeToString ( const DocumentCellPointers::TextRange &  range)

The text of a range of selected characters, as it is copied.

A line break between two lines of the output, but none where the worksheet only broke a long line to fit it into the window.