|
@@ -44,8 +44,6 @@
|
|
#include "globals.h"
|
|
#include "globals.h"
|
|
#include "message_queue.h"
|
|
#include "message_queue.h"
|
|
|
|
|
|
-#include "tools/editor/editor_settings.h"
|
|
|
|
-
|
|
|
|
#define TAB_PIXELS
|
|
#define TAB_PIXELS
|
|
|
|
|
|
static bool _is_text_char(CharType c) {
|
|
static bool _is_text_char(CharType c) {
|
|
@@ -64,7 +62,7 @@ static bool _is_pair_right_symbol(CharType c) {
|
|
c == '\'' ||
|
|
c == '\'' ||
|
|
c == ')' ||
|
|
c == ')' ||
|
|
c == ']' ||
|
|
c == ']' ||
|
|
- c == '}';
|
|
|
|
|
|
+ c == '}';
|
|
}
|
|
}
|
|
|
|
|
|
static bool _is_pair_left_symbol(CharType c) {
|
|
static bool _is_pair_left_symbol(CharType c) {
|
|
@@ -839,8 +837,7 @@ void TextEdit::backspace_at_cursor() {
|
|
|
|
|
|
int prev_line = cursor.column?cursor.line:cursor.line-1;
|
|
int prev_line = cursor.column?cursor.line:cursor.line-1;
|
|
int prev_column = cursor.column?(cursor.column-1):(text[cursor.line-1].length());
|
|
int prev_column = cursor.column?(cursor.column-1):(text[cursor.line-1].length());
|
|
- bool auto_brace_complete = EDITOR_DEF("text_editor/auto_brace_complete", false);
|
|
|
|
- if(auto_brace_complete &&
|
|
|
|
|
|
+ if(auto_brace_completion_enabled &&
|
|
cursor.column > 0 &&
|
|
cursor.column > 0 &&
|
|
_is_pair_left_symbol(text[cursor.line][cursor.column - 1])) {
|
|
_is_pair_left_symbol(text[cursor.line][cursor.column - 1])) {
|
|
_consume_backspace_for_pair_symbol(prev_line, prev_column);
|
|
_consume_backspace_for_pair_symbol(prev_line, prev_column);
|
|
@@ -1246,8 +1243,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
|
|
default:
|
|
default:
|
|
if (k.unicode>=32 && !k.mod.command && !k.mod.alt && !k.mod.meta)
|
|
if (k.unicode>=32 && !k.mod.command && !k.mod.alt && !k.mod.meta)
|
|
clear=true;
|
|
clear=true;
|
|
- bool auto_brace_complete=EDITOR_DEF("text_editor/auto_brace_complete", false);
|
|
|
|
- if (auto_brace_complete && _is_pair_left_symbol(k.unicode))
|
|
|
|
|
|
+ if (auto_brace_completion_enabled && _is_pair_left_symbol(k.unicode))
|
|
clear=false;
|
|
clear=false;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1671,12 +1667,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
|
|
if (readonly)
|
|
if (readonly)
|
|
break;
|
|
break;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
const CharType chr[2] = {k.unicode, 0};
|
|
const CharType chr[2] = {k.unicode, 0};
|
|
- bool auto_brace_complete = EDITOR_DEF("text_editor/auto_brace_complete", false);
|
|
|
|
|
|
|
|
- if(auto_brace_complete && _is_pair_symbol(chr[0])) {
|
|
|
|
|
|
+ if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) {
|
|
_consume_pair_symbol(chr[0]);
|
|
_consume_pair_symbol(chr[0]);
|
|
} else {
|
|
} else {
|
|
_insert_text_at_cursor(chr);
|
|
_insert_text_at_cursor(chr);
|
|
@@ -2025,7 +2018,6 @@ void TextEdit::adjust_viewport_to_cursor() {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
void TextEdit::cursor_set_column(int p_col) {
|
|
void TextEdit::cursor_set_column(int p_col) {
|
|
|
|
|
|
if (p_col<0)
|
|
if (p_col<0)
|
|
@@ -3148,6 +3140,7 @@ TextEdit::TextEdit() {
|
|
tooltip_obj=NULL;
|
|
tooltip_obj=NULL;
|
|
line_numbers=false;
|
|
line_numbers=false;
|
|
next_operation_is_complex=false;
|
|
next_operation_is_complex=false;
|
|
|
|
+ auto_brace_completion_enabled=false;
|
|
}
|
|
}
|
|
|
|
|
|
TextEdit::~TextEdit(){
|
|
TextEdit::~TextEdit(){
|