You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
fix crash in editor when using alt+arrows to indent, thanks adolson and romulox_x
This commit is contained in:
@@ -3494,6 +3494,9 @@ void TextEdit::set_line(int line, String new_text)
|
|||||||
return;
|
return;
|
||||||
_remove_text(line, 0, line, text[line].length());
|
_remove_text(line, 0, line, text[line].length());
|
||||||
_insert_text(line, 0, new_text);
|
_insert_text(line, 0, new_text);
|
||||||
|
if (cursor.line==line) {
|
||||||
|
cursor.column=MIN(cursor.column,new_text.length());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEdit::insert_at(const String &p_text, int at)
|
void TextEdit::insert_at(const String &p_text, int at)
|
||||||
|
|||||||
@@ -816,11 +816,11 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||||||
if (scr.is_null())
|
if (scr.is_null())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int begin, end;
|
|
||||||
begin = tx->get_selection_from_line();
|
|
||||||
if (tx->is_selection_active())
|
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++)
|
for (int i = begin; i <= end; i++)
|
||||||
{
|
{
|
||||||
String line_text = tx->get_line(i);
|
String line_text = tx->get_line(i);
|
||||||
@@ -840,7 +840,7 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
begin = tx->cursor_get_line();
|
int begin = tx->cursor_get_line();
|
||||||
String line_text = tx->get_line(begin);
|
String line_text = tx->get_line(begin);
|
||||||
// begins with tab
|
// begins with tab
|
||||||
if (line_text.begins_with("\t"))
|
if (line_text.begins_with("\t"))
|
||||||
@@ -866,11 +866,10 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||||||
if (scr.is_null())
|
if (scr.is_null())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int begin, end;
|
|
||||||
begin = tx->get_selection_from_line();
|
|
||||||
if (tx->is_selection_active())
|
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++)
|
for (int i = begin; i <= end; i++)
|
||||||
{
|
{
|
||||||
String line_text = tx->get_line(i);
|
String line_text = tx->get_line(i);
|
||||||
@@ -880,7 +879,7 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
begin = tx->cursor_get_line();
|
int begin = tx->cursor_get_line();
|
||||||
String line_text = tx->get_line(begin);
|
String line_text = tx->get_line(begin);
|
||||||
line_text = '\t' + line_text;
|
line_text = '\t' + line_text;
|
||||||
tx->set_line(begin, line_text);
|
tx->set_line(begin, line_text);
|
||||||
@@ -913,11 +912,12 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||||||
if (scr.is_null())
|
if (scr.is_null())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int begin, end;
|
|
||||||
begin = tx->get_selection_from_line();
|
|
||||||
if (tx->is_selection_active())
|
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++)
|
for (int i = begin; i <= end; i++)
|
||||||
{
|
{
|
||||||
String line_text = tx->get_line(i);
|
String line_text = tx->get_line(i);
|
||||||
@@ -931,7 +931,7 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
begin = tx->cursor_get_line();
|
int begin = tx->cursor_get_line();
|
||||||
String line_text = tx->get_line(begin);
|
String line_text = tx->get_line(begin);
|
||||||
|
|
||||||
if (line_text.begins_with("#"))
|
if (line_text.begins_with("#"))
|
||||||
|
|||||||
Reference in New Issue
Block a user