summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-05-05 00:17:22 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-05-05 00:17:22 -0300
commit74b0e0c296ac438df2f0826482310e788d0ba898 (patch)
tree4e834e8c3dfe2fed89f57cbf2f9353e07ca900a8 /tools
parentcb93e064a9378af3b8a31cae43aa55f3cd4168f2 (diff)
fix crash in editor when using alt+arrows to indent, thanks adolson and romulox_x
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index e6e311cfa1..edc5d460e7 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -816,11 +816,11 @@ void ScriptEditor::_menu_option(int p_option) {
if (scr.is_null())
return;
- int begin, end;
- begin = tx->get_selection_from_line();
+
if (tx->is_selection_active())
{
- end = tx->get_selection_to_line();
+ int begin = tx->get_selection_from_line();
+ int end = tx->get_selection_to_line();
for (int i = begin; i <= end; i++)
{
String line_text = tx->get_line(i);
@@ -840,7 +840,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
else
{
- begin = tx->cursor_get_line();
+ int begin = tx->cursor_get_line();
String line_text = tx->get_line(begin);
// begins with tab
if (line_text.begins_with("\t"))
@@ -866,11 +866,10 @@ void ScriptEditor::_menu_option(int p_option) {
if (scr.is_null())
return;
- int begin, end;
- begin = tx->get_selection_from_line();
if (tx->is_selection_active())
{
- end = tx->get_selection_to_line();
+ int begin = tx->get_selection_from_line();
+ int end = tx->get_selection_to_line();
for (int i = begin; i <= end; i++)
{
String line_text = tx->get_line(i);
@@ -880,7 +879,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
else
{
- begin = tx->cursor_get_line();
+ int begin = tx->cursor_get_line();
String line_text = tx->get_line(begin);
line_text = '\t' + line_text;
tx->set_line(begin, line_text);
@@ -913,11 +912,12 @@ void ScriptEditor::_menu_option(int p_option) {
if (scr.is_null())
return;
- int begin, end;
- begin = tx->get_selection_from_line();
+
+
if (tx->is_selection_active())
{
- end = tx->get_selection_to_line();
+ int begin = tx->get_selection_from_line();
+ int end = tx->get_selection_to_line();
for (int i = begin; i <= end; i++)
{
String line_text = tx->get_line(i);
@@ -931,7 +931,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
else
{
- begin = tx->cursor_get_line();
+ int begin = tx->cursor_get_line();
String line_text = tx->get_line(begin);
if (line_text.begins_with("#"))