mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Cleanup and rename caret operations
This commit is contained in:
parent
e60900a353
commit
d5dcaee4c5
9 changed files with 985 additions and 939 deletions
|
|
@ -132,14 +132,14 @@ void TextEditor::reload_text() {
|
|||
ERR_FAIL_COND(text_file.is_null());
|
||||
|
||||
CodeEdit *te = code_editor->get_text_editor();
|
||||
int column = te->cursor_get_column();
|
||||
int row = te->cursor_get_line();
|
||||
int column = te->get_caret_column();
|
||||
int row = te->get_caret_line();
|
||||
int h = te->get_h_scroll();
|
||||
int v = te->get_v_scroll();
|
||||
|
||||
te->set_text(text_file->get_text());
|
||||
te->cursor_set_line(row);
|
||||
te->cursor_set_column(column);
|
||||
te->set_caret_line(row);
|
||||
te->set_caret_column(column);
|
||||
te->set_h_scroll(h);
|
||||
te->set_v_scroll(v);
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ void TextEditor::_edit_option(int p_op) {
|
|||
code_editor->duplicate_selection();
|
||||
} break;
|
||||
case EDIT_TOGGLE_FOLD_LINE: {
|
||||
tx->toggle_foldable_line(tx->cursor_get_line());
|
||||
tx->toggle_foldable_line(tx->get_caret_line());
|
||||
tx->update();
|
||||
} break;
|
||||
case EDIT_FOLD_ALL_LINES: {
|
||||
|
|
@ -431,11 +431,11 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
|
|||
CodeEdit *tx = code_editor->get_text_editor();
|
||||
tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
|
||||
|
||||
tx->set_right_click_moves_caret(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret"));
|
||||
tx->set_move_caret_on_right_click_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret"));
|
||||
bool can_fold = tx->can_fold_line(row);
|
||||
bool is_folded = tx->is_line_folded(row);
|
||||
|
||||
if (tx->is_right_click_moving_caret()) {
|
||||
if (tx->is_move_caret_on_right_click_enabled()) {
|
||||
if (tx->is_selection_active()) {
|
||||
int from_line = tx->get_selection_from_line();
|
||||
int to_line = tx->get_selection_to_line();
|
||||
|
|
@ -448,8 +448,8 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
|
|||
}
|
||||
}
|
||||
if (!tx->is_selection_active()) {
|
||||
tx->cursor_set_line(row, true, false);
|
||||
tx->cursor_set_column(col);
|
||||
tx->set_caret_line(row, true, false);
|
||||
tx->set_caret_column(col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -460,10 +460,11 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
|
|||
}
|
||||
|
||||
Ref<InputEventKey> k = ev;
|
||||
if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_MENU) {
|
||||
if (k.is_valid() && k->is_pressed() && k->is_action("ui_menu", true)) {
|
||||
CodeEdit *tx = code_editor->get_text_editor();
|
||||
int line = tx->cursor_get_line();
|
||||
_make_context_menu(tx->is_selection_active(), tx->can_fold_line(line), tx->is_line_folded(line), (get_global_transform().inverse() * tx->get_global_transform()).xform(tx->_get_cursor_pixel_pos()));
|
||||
int line = tx->get_caret_line();
|
||||
tx->adjust_viewport_to_caret();
|
||||
_make_context_menu(tx->is_selection_active(), tx->can_fold_line(line), tx->is_line_folded(line), (get_global_transform().inverse() * tx->get_global_transform()).xform(tx->get_caret_draw_pos()));
|
||||
context_menu->grab_focus();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue