diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-10-26 08:13:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-26 08:13:51 +0100 |
commit | d92d16926e38c0764cffaeafd8578400daa387b7 (patch) | |
tree | 7140d7e71f7369d154b71f8123ea7d76d70aeb9e /scene/gui/text_edit.h | |
parent | 33ff670d3094e2a7d0d40fff582d1796f6e88b64 (diff) | |
parent | b9c35af15d62f5259ace3f3bf670da93c9b3c64d (diff) |
Merge pull request #42723 from Devination/linenumber-select
ScriptEditor: Fix line number gutter drag select
Diffstat (limited to 'scene/gui/text_edit.h')
-rw-r--r-- | scene/gui/text_edit.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 562f4768ae..5cfa70bc55 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -47,6 +47,14 @@ public: GUTTER_TPYE_CUSTOM }; + enum SelectionMode { + SELECTION_MODE_NONE, + SELECTION_MODE_SHIFT, + SELECTION_MODE_POINTER, + SELECTION_MODE_WORD, + SELECTION_MODE_LINE + }; + private: struct GutterInfo { GutterType type = GutterType::GUTTER_TYPE_STRING; @@ -157,16 +165,7 @@ private: } cursor; struct Selection { - enum Mode { - - MODE_NONE, - MODE_SHIFT, - MODE_POINTER, - MODE_WORD, - MODE_LINE - }; - - Mode selecting_mode; + SelectionMode selecting_mode; int selecting_line, selecting_column; int selected_word_beg, selected_word_end, selected_word_origin; bool selecting_text; @@ -178,7 +177,7 @@ private: bool shiftclick_left; Selection() { - selecting_mode = MODE_NONE; + selecting_mode = SelectionMode::SELECTION_MODE_NONE; selecting_line = 0; selecting_column = 0; selected_word_beg = 0; @@ -636,6 +635,11 @@ public: void set_right_click_moves_caret(bool p_enable); bool is_right_click_moving_caret() const; + SelectionMode get_selection_mode() const; + void set_selection_mode(SelectionMode p_mode, int p_line = -1, int p_column = -1); + int get_selection_line() const; + int get_selection_column() const; + void set_readonly(bool p_readonly); bool is_readonly() const; @@ -761,6 +765,7 @@ public: }; VARIANT_ENUM_CAST(TextEdit::GutterType); +VARIANT_ENUM_CAST(TextEdit::SelectionMode); VARIANT_ENUM_CAST(TextEdit::MenuItems); VARIANT_ENUM_CAST(TextEdit::SearchFlags); |