## class Fl_Text_Editor

### Class Hierarchy

    Fl_Text_Display
       |
       +----Fl_Text_Editor

### Include Files

    #include <FL/Fl_Text_Editor.H>

### Description

This is the FLTK text editor widget. It allows the user to edit multiple lines of text and supports highlighting and scrolling. The buffer that is displayed in the widget is managed by the `Fl_Text_Buffer` class.

### Methods

Fl_Text_Editor ~Fl_Text_Editor add_default_key_bindings add_key_binding bound_key_function default_key_function insert_mode kf_backspace kf_copy kf_c_s_move kf_ctrl_move | kf_cut kf_default kf_delete kf_down kf_end kf_enter kf_home kf_ignore kf_insert kf_left | kf_move kf_page_down kf_page_up kf_paste kf_right kf_select_all kf_shift_move kf_up remove_all_key_bindings remove_key_binding

#### Fl_Text_Editor(int X, int Y, int W, int H, const char* l = 0);

The constructor creates a new text editor widget.

#### ~Fl_Text_Editor();

The destructor frees all memory used by the text editor widget.

#### void add_default_key_bindings(Key_Binding** list);

Adds all of the default editor key bindings to the specified key binding list.

#### void add_key_binding(int key, int state, Key_Func f, Key_Binding** list);
void add_key_binding(int key, int state, Key_Func f);

Adds a single key binding to the specified or current key binding list.

#### Key_Func bound_key_function(int key, int state, Key_Binding* list);
Key_Func bound_key_function(int key, int state);

Returns the function associated with a key binding.

#### void default_key_function(Key_Func f);

Sets the default key function for unassigned keys.

#### void insert_mode(int b);
int insert_mode();

Sets or gets the current insert mode; if non-zero, new text is inserted before the current cursor position. Otherwise, new text replaces text at the current cursor position.

#### int kf_backspace(int c, Fl_Text_Editor* e);

Does a backspace in the current buffer.

#### int kf_copy(int c, Fl_Text_Editor* e);

Does a copy of selected text in the current buffer.

#### int kf_c_s_move(int c, Fl_Text_Editor* e);

Extends the current selection in the direction indicated by control key `c`.

#### int kf_ctrl_move(int c, Fl_Text_Editor* e);

Moves the current text cursor in the direction indicated by control key `c`.

#### int kf_cut(int c, Fl_Text_Editor* e);

Does a cut of selected text in the current buffer.

#### int kf_default(int c, Fl_Text_Editor* e);

Inserts the text associated with the key `c`.

#### int kf_delete(int c, Fl_Text_Editor* e);

Does a delete of selected text or the current character in the current buffer.

#### int kf_down(int c, Fl_Text_Editor* e);

Moves the text cursor down one line.

#### int kf_end(int c, Fl_Text_Editor* e);

Moves the text cursor to the end of the current line.

#### int kf_enter(int c, Fl_Text_Editor* e);

Inserts a newline at the current cursor position.

#### int kf_home(int c, Fl_Text_Editor* e);

Moves the text cursor to the beginning of the current line.

#### int kf_ignore(int c, Fl_Text_Editor* e);

Ignores the keypress.

#### int kf_insert(int c, Fl_Text_Editor* e);

Toggles the insert mode in the text editor.

#### int kf_left(int c, Fl_Text_Editor* e);

Moves the text cursor to the left in the buffer.

#### int kf_move(int c, Fl_Text_Editor* e);

Moves the text cursor in the direction indicated by key `c`.

#### int kf_page_down(int c, Fl_Text_Editor* e);

Moves the text cursor down one page.

#### int kf_page_up(int c, Fl_Text_Editor* e);

Moves the text cursor up one page.

#### int kf_paste(int c, Fl_Text_Editor* e);

Pastes the contents of the clipboard at the current text cursor position.

#### int kf_right(int c, Fl_Text_Editor* e);

Moves the text cursor one character to the right.

#### int kf_select_all(int c, Fl_Text_Editor* e);

Selects all text in the buffer.

#### int kf_shift_move(int c, Fl_Text_Editor* e);

Extends the current selection in the direction of key `c`.

#### int kf_up(int c, Fl_Text_Editor* e);

Moves the text cursor up one line.

#### void remove_all_key_bindings(Key_Binding** list);
void remove_all_key_bindings();

Removes all of the key bindings associated with the text editor or list.

#### void remove_key_binding(int key, int state, Key_Binding** list);
void remove_key_binding(int key, int state);

Removes a single key binding from the text editor or list.