mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Overhaul multiple caret editing in TextEdit.
Use a multicaret edit to delay merging overlapping carets until the end.
This commit is contained in:
		
							parent
							
								
									154f727c7a
								
							
						
					
					
						commit
						773a473807
					
				
					 17 changed files with 7562 additions and 2706 deletions
				
			
		|  | @ -380,10 +380,10 @@ void TextEditor::_edit_option(int p_op) { | |||
| 			callable_mp((Control *)tx, &Control::grab_focus).call_deferred(); | ||||
| 		} break; | ||||
| 		case EDIT_MOVE_LINE_UP: { | ||||
| 			code_editor->move_lines_up(); | ||||
| 			code_editor->get_text_editor()->move_lines_up(); | ||||
| 		} break; | ||||
| 		case EDIT_MOVE_LINE_DOWN: { | ||||
| 			code_editor->move_lines_down(); | ||||
| 			code_editor->get_text_editor()->move_lines_down(); | ||||
| 		} break; | ||||
| 		case EDIT_INDENT: { | ||||
| 			tx->indent_lines(); | ||||
|  | @ -392,24 +392,16 @@ void TextEditor::_edit_option(int p_op) { | |||
| 			tx->unindent_lines(); | ||||
| 		} break; | ||||
| 		case EDIT_DELETE_LINE: { | ||||
| 			code_editor->delete_lines(); | ||||
| 			code_editor->get_text_editor()->delete_lines(); | ||||
| 		} break; | ||||
| 		case EDIT_DUPLICATE_SELECTION: { | ||||
| 			code_editor->duplicate_selection(); | ||||
| 			code_editor->get_text_editor()->duplicate_selection(); | ||||
| 		} break; | ||||
| 		case EDIT_DUPLICATE_LINES: { | ||||
| 			code_editor->get_text_editor()->duplicate_lines(); | ||||
| 		} break; | ||||
| 		case EDIT_TOGGLE_FOLD_LINE: { | ||||
| 			int previous_line = -1; | ||||
| 			for (int caret_idx : tx->get_caret_index_edit_order()) { | ||||
| 				int line_idx = tx->get_caret_line(caret_idx); | ||||
| 				if (line_idx != previous_line) { | ||||
| 					tx->toggle_foldable_line(line_idx); | ||||
| 					previous_line = line_idx; | ||||
| 				} | ||||
| 			} | ||||
| 			tx->queue_redraw(); | ||||
| 			tx->toggle_foldable_lines_at_carets(); | ||||
| 		} break; | ||||
| 		case EDIT_FOLD_ALL_LINES: { | ||||
| 			tx->fold_all_lines(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 kit
						kit