Struct fltk::text::TextBuffer[][src]

pub struct TextBuffer { /* fields omitted */ }
Expand description

Wraps a text buffer, Cloning a text buffer invalidates the underlying pointer, thus the no derive(Clone)

Implementations

Initialized a default text buffer

Deletes the TextBuffer

Safety

The buffer shouldn’t be deleted while the Display widget still needs it

Deletes the TextBuffer

Safety

The buffer shouldn’t be deleted while the Display widget still needs it

Initialized a text buffer from a pointer

Safety

The pointer must be valid

Returns the inner pointer from a text buffer

Safety

Can return multiple mutable pointers to the same buffer

Sets the text of the buffer

Returns the text of the buffer

Appends to the buffer. To append and scroll to the end of the buffer:

use fltk::{prelude::*, *};
let txt = "Some long text!";
let buf = text::TextBuffer::default();
let mut disp = text::TextDisplay::default();
disp.set_buffer(Some(buf));
disp.buffer().unwrap().append(txt);
disp.set_insert_position(disp.buffer().unwrap().length());
disp.scroll(
    disp.count_lines(0, disp.buffer().unwrap().length(), true),
    0,
);

Get the length of the buffer

Removes from the buffer

Returns the text within the range

Inserts text into a position

Replaces text from position start to end

Copies text from a source buffer into the current buffer

Copies whole text from a source buffer into a new buffer

Performs an undo operation on the buffer

Errors

Errors on failure to undo

Sets whether the buffer can undo

Loads a file into the buffer

Errors

Errors on failure to load file

Saves a buffer into a file

Errors

Errors on failure to save file

Returns the tab distance for the buffer

Sets the tab distance

Selects the text from start to end

Returns whether text is selected

Unselects text

Returns the selection position

Returns the selection text

Removes the selection

Replaces selection

Highlights selection

Returns whether text is highlighted

Unhighlights text

Returns the highlight position

Returns the highlighted text

Returns the line at pos

Returns the index of the line’s start position at pos

Returns the index of the first character of a word at pos

Returns the index of the last character of a word at pos

Counts the lines from start to end

Calls the modify callbacks

Adds a modify callback. callback args: pos: i32, inserted items: i32, deleted items: i32, restyled items: i32, deleted_text

Removes a modify callback. callback args: pos: i32, inserted items: i32, deleted items: i32, restyled items: i32, deleted_text

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.