From 02b7b916b7efb6685f9f8ea31dcae1407d467462 Mon Sep 17 00:00:00 2001 From: Eric McCarthy Date: Thu, 19 Apr 2018 19:30:52 -0400 Subject: Fix clone down newline bug Previously cloning down at the end of a script was broken if there was not an additional empty line. This fix ensures there is an empty line before attempting to clone downwards. Fixes #18206, cheers! --- editor/plugins/script_text_editor.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'editor/plugins') diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index bcc575a7ac..61bc58cee3 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1007,6 +1007,10 @@ void ScriptTextEditor::_edit_option(int p_op) { } int next_line = to_line + 1; + if (to_line >= tx->get_line_count() - 1) { + tx->set_line(to_line, tx->get_line(to_line) + "\n"); + } + tx->begin_complex_operation(); for (int i = from_line; i <= to_line; i++) { -- cgit v1.2.3