1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Fix selection being deleted and indentation not being accounted for

This commit is contained in:
Preslavb
2021-12-12 22:07:46 +00:00
parent 81c28dd706
commit 6f1089af86
3 changed files with 55 additions and 1 deletions

View File

@@ -937,8 +937,10 @@ void CodeEdit::_new_line(bool p_split_current_line, bool p_above) {
return;
}
const int cc = get_caret_column();
/* When not splitting the line, we need to factor in indentation from the end of the current line. */
const int cc = p_split_current_line ? get_caret_column() : get_line(get_caret_line()).length();
const int cl = get_caret_line();
const String line = get_line(cl);
String ins = "\n";
@@ -1012,6 +1014,8 @@ void CodeEdit::_new_line(bool p_split_current_line, bool p_above) {
bool first_line = false;
if (!p_split_current_line) {
deselect();
if (p_above) {
if (cl > 0) {
set_caret_line(cl - 1, false);