diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2015-12-06 21:59:59 +0100 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2015-12-06 21:59:59 +0100 |
commit | 17a4ab992ce3282838225f2089684c582898fd96 (patch) | |
tree | 14be441f7e10348f51785bef7342e8cf3f4c221f | |
parent | 145af960c82d5867f2131c4270a269561d201f22 (diff) | |
parent | b3ce127e313e4fb8a481aedd3fb27e67c189ec2a (diff) |
Merge pull request #3002 from TheHX/pr-script-editor
Script Editor: maintain cursor column after duplicate a line
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 956e7a98a2..4e394f9e3f 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1137,12 +1137,14 @@ void ScriptEditor::_menu_option(int p_option) { return; int line = tx->cursor_get_line(); int next_line = line + 1; + int column = tx->cursor_get_column(); - if (line == tx->get_line_count() - 1 || next_line >= tx->get_line_count()) + if (line >= tx->get_line_count() - 1) tx->set_line(line, tx->get_line(line) + "\n"); String line_clone = tx->get_line(line); tx->insert_at(line_clone, next_line); + tx->cursor_set_column(column); tx->update(); } break; |