Class Hierarchy
Fl_Text_Buffer
Include Files
#include <FL/Fl_Text_Buffer.H>
Description
The Fl_Text_Buffer class is used by the
Fl_Text_Display
and
Fl_Text_Editor
to manage complex text data and is based upon the
excellent NEdit text editor engine - see
http://www.nedit.org/.
Methods
Creates a new text buffer of the specified initial size.
Destroys a text buffer.
Adds a callback function that is called whenever the text buffer is
modified. The callback function is declared as follows:
typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
int nRestyled, const char* deletedText,
void* cbArg);
Appends the text string to the end of the buffer.
Appends the named file to the end of the buffer. Returns 0 on
success, non-zero on error (strerror() contains reason). 1 indicates
open for read failed (no data loaded). 2 indicates error occurred
while reading data (data was partially loaded).
Calls all modify callbacks that have been registered using
the add_modify_callback()
method.
Returns the character at the specified position in the buffer.
Returns the column width of the specified character. The
indent argument specifies the current column position,
and tabDist specifies the number of columns to use for
each tab.
The nullSubsChar argument specifies the current
nul character.
Clears text in the specified area.
Copies text from one buffer to this one; fromBuf may
be the same as this.
Determines the number of characters that will be displayed
between lineStartPos and targetPos.
Determines the number of lines between startPos and
endPos.
Expands the given character to a displayable format. Tabs and
other control characters are given special treatment.
Finds the previous occurrence of the specified character.
Finds the next occurrence of the specified character.
Finds the previous occurrence of the specified characters.
Finds the next occurrence of the specified characters.
Search forwards in buffer for characters in searchChars, starting
with the character startPos, and returning the result in foundPos
returns 1 if found, 0 if not.
Highlights the specified text within the buffer.
Returns the current highlight positions.
Highlights the specified rectangle of text within the buffer.
Returns the current highlight selection.
Returns the highlighted text. When you are done with the
text, free it using the free() function.
Inserts a column of text without calling the modify callbacks.
Inserts a file at the specified position. Returns 0 on success,
non-zero on error (strerror() contains reason). 1 indicates open
for read failed (no data loaded). 2 indicates error occurred
while reading data (data was partially loaded).
Inserts text at the specified position.
Returns the number of characters in the buffer.
Returns the end position of the line.
Returns the start position of the line.
Returns the text for the line containing the specified
character position. When you are done with the text, free it
using the free() function.
Replaces the current buffer with the contents of a file. Returns 0
on success, non-zero on error (strerror() contains reason). 1 indicates
open for read failed (no data loaded). 2 indicates error occurred
while reading data (data was partially loaded).
Returns the current nul substitution character.
Writes the specified portions of the file to a file. Returns 0 on success, non-zero
on error (strerror() contains reason). 1 indicates open for write failed
(no data saved). 2 indicates error occurred while writing data
(data was partially saved).
Replaces a rectangular region of text with the given text.
Returns the primary selection.
Removes a modify callback.
Deletes a rectangular area of text in the buffer.
Deletes a range of characters in the buffer.
Removes the text in the secondary selection.
Removes the text in the primary selection.
Replaces the text in a rectangular area.
Replaces the text in the specified range of characters in the buffer.
Replaces the text in the secondary selection.
Replaces the text in the primary selection.
Returns the buffer position for the Nth previous line.
Saves the entire buffer to a file. Returns 0 on success, non-zero
on error (strerror() contains reason). 1 indicates open for write failed
(no data saved). 2 indicates error occurred while writing data
(data was partially saved).
Searches backwards for the specified string.
Searches forwards for the specified string.
Returns the secondary selection.
Returns the text in the secondary selection. When you are
done with the text, free it using the free() function.
Selects a rectangle of characters in the secondary selection.
Selects a range of characters in the secondary selection.
Turns the secondary selection off.
Returns a non-zero number if any text has been selected, or 0
if no text is selected.
Returns the current selection.
Returns the currently selected text. When you are done with
the text, free it using the free() function.
Selects a rectangle of characters in the buffer.
Selects a range of characters in the buffer.
Skips forward the indicated number of characters in the
buffer from the start position.
Returns the buffer position for the Nth line after the start
position.
Replaces nul characters in the given string with the
nul substitution character.
Gets or sets the tab width.
Returns the text from the given rectangle. When you are done
with the text, free it using the free() function.
Returns the text from the range of characters. When you are
done with the text, free it using the free() function.
Gets or sets the text in the buffer. The first form
returns a copy of the text in the buffer which you must
later free() when done using it. The second form sets the text in
the buffer, making an internal copy of the string that is automatically managed.
Unhighlights text in the buffer.
Unselects text in the buffer.
Replaces the nul substitution characters in the
provided string with the nul character.
Returns the position for the end of the word.
Returns the position for the start of the word.
From greg.ercolano, 22:49 Apr 02, 2007 (score=3)
I would say the current docs for the two text() methods (get+set) do not make it clear that the 'free()' comment pertains only to the text(void) (get) method, which returns a malloc()'ed copy of the internal buffer, and not a pointer to the buffer itself.
[ Reply ] From Anonymous, 17:10 Aug 26, 2004 (score=1)
How do I get the <cr>'s at the end of every line to go away? It is important that I have the carriage returns in there (for copying and pasting purposes into other Windows applications), but I don't want them to show up as "<cr>"
[ Reply ] |