summaryrefslogtreecommitdiffstats
path: root/scene/gui/text_edit.cpp
diff options
context:
space:
mode:
authorMikolaj Kaczmarek <extern.mikolaj.kaczmarek@elektrobit.com>2019-12-12 20:17:41 +0100
committerMikolaj Kaczmarek <extern.mikolaj.kaczmarek@elektrobit.com>2019-12-14 19:11:19 +0100
commiteced81e359a61b6cabb5ec070095c0c343d977df (patch)
tree3ed5796e78f9ae44d1b6585090d8851f2191cd16 /scene/gui/text_edit.cpp
parentf065b34e969f93e5ecc9046e01c5c14c416d2d16 (diff)
downloadredot-engine-eced81e359a61b6cabb5ec070095c0c343d977df.tar.gz
Fix- using cut in first line of a script file does not remove the line
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r--scene/gui/text_edit.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index bf3ec9b05b..9bcacd6ee3 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -5177,11 +5177,16 @@ void TextEdit::cut() {
OS::get_singleton()->set_clipboard(clipboard);
cursor_set_line(cursor.line);
cursor_set_column(0);
- _remove_text(cursor.line, 0, cursor.line, text[cursor.line].length());
- backspace_at_cursor();
+ if (cursor.line == 0 && get_line_count() > 1) {
+ _remove_text(cursor.line, 0, cursor.line + 1, 0);
+ } else {
+ _remove_text(cursor.line, 0, cursor.line, text[cursor.line].length());
+ backspace_at_cursor();
+ cursor_set_line(cursor.line + 1);
+ }
+
update();
- cursor_set_line(cursor.line + 1);
cut_copy_line = clipboard;
} else {