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
Returns the inner pointer from a text buffer
Safety
Can return multiple mutable pointers to the same 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,
);
Returns the text within the range
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
Returns the tab distance for the buffer
Sets the tab distance
Returns the selection text
Removes the selection
Replaces selection
Returns whether text is highlighted
Unhighlights text
Returns the highlighted text
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
Trait Implementations
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more