本文整理汇总了C++中TextEdit::cursor_set_column方法的典型用法代码示例。如果您正苦于以下问题:C++ TextEdit::cursor_set_column方法的具体用法?C++ TextEdit::cursor_set_column怎么用?C++ TextEdit::cursor_set_column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEdit
的用法示例。
在下文中一共展示了TextEdit::cursor_set_column方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _text_edit_gui_input
void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
Ref<InputEventMouseButton> mb = ev;
if (mb.is_valid()) {
if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
int col, row;
TextEdit *tx = shader_editor->get_text_edit();
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"));
if (tx->is_right_click_moving_caret()) {
if (tx->is_selection_active()) {
int from_line = tx->get_selection_from_line();
int to_line = tx->get_selection_to_line();
int from_column = tx->get_selection_from_column();
int to_column = tx->get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
// Right click is outside the selected text
tx->deselect();
}
}
if (!tx->is_selection_active()) {
tx->cursor_set_line(row, true, false);
tx->cursor_set_column(col);
}
}
_make_context_menu(tx->is_selection_active());
}
}
}
示例2: reload_text
void TextEditor::reload_text() {
ERR_FAIL_COND(text_file.is_null());
TextEdit *te = code_editor->get_text_edit();
int column = te->cursor_get_column();
int row = te->cursor_get_line();
int h = te->get_h_scroll();
int v = te->get_v_scroll();
te->set_text(text_file->get_text());
te->clear_undo_history();
te->cursor_set_line(row);
te->cursor_set_column(column);
te->set_h_scroll(h);
te->set_v_scroll(v);
te->tag_saved_version();
code_editor->update_line_and_column();
}
示例3: _edit_option
//.........这里部分代码省略.........
tx->update();
//tx->deselect();
} break;
case EDIT_CLONE_DOWN: {
TextEdit *tx = code_editor->get_text_edit();
Ref<Script> scr = get_edited_script();
if (scr.is_null())
return;
int from_line = tx->cursor_get_line();
int to_line = tx->cursor_get_line();
int column = tx->cursor_get_column();
if (tx->is_selection_active()) {
from_line = tx->get_selection_from_line();
to_line = tx->get_selection_to_line();
column = tx->cursor_get_column();
}
int next_line = to_line + 1;
tx->begin_complex_operation();
for (int i = from_line; i <= to_line; i++) {
if (i >= tx->get_line_count() - 1) {
tx->set_line(i, tx->get_line(i) + "\n");
}
String line_clone = tx->get_line(i);
tx->insert_at(line_clone, next_line);
next_line++;
}
tx->cursor_set_column(column);
if (tx->is_selection_active()) {
tx->select(to_line + 1, tx->get_selection_from_column(), next_line - 1, tx->get_selection_to_column());
}
tx->end_complex_operation();
tx->update();
} break;
case EDIT_TOGGLE_COMMENT: {
TextEdit *tx = code_editor->get_text_edit();
Ref<Script> scr = get_edited_script();
if (scr.is_null())
return;
tx->begin_complex_operation();
if (tx->is_selection_active())
{
int begin = tx->get_selection_from_line();
int end = tx->get_selection_to_line();
// End of selection ends on the first column of the last line, ignore it.
if(tx->get_selection_to_column() == 0)
end -= 1;
for (int i = begin; i <= end; i++)
{
String line_text = tx->get_line(i);
if (line_text.begins_with("#"))
line_text = line_text.substr(1, line_text.length());