From 94b3e786cd9d23ef972d366333abfbcfb1f7b989 Mon Sep 17 00:00:00 2001 From: Ian Date: Fri, 10 Nov 2017 23:07:41 -0500 Subject: shader editor context menu and line operations and style fix --- scene/gui/text_edit.cpp | 7 ++++++- scene/gui/text_edit.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'scene/gui') diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index f4876668f6..5d4048f928 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3900,7 +3900,12 @@ void TextEdit::select(int p_from_line, int p_from_column, int p_to_line, int p_t update(); } - +void TextEdit::swap_lines(int line1, int line2) { + String tmp = get_line(line1); + String tmp2 = get_line(line2); + set_line(line2, tmp); + set_line(line1, tmp2); +} bool TextEdit::is_selection_active() const { return selection.active; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 094474b264..c81b41c2e3 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -463,6 +463,7 @@ public: void select_all(); void select(int p_from_line, int p_from_column, int p_to_line, int p_to_column); void deselect(); + void swap_lines(int line1, int line2); void set_search_text(const String &p_search_text); void set_search_flags(uint32_t p_flags); -- cgit v1.2.3