| 2687 | } |
| 2688 | |
| 2689 | void CodeEdit::duplicate_lines() { |
| 2690 | begin_complex_operation(); |
| 2691 | begin_multicaret_edit(); |
| 2692 | |
| 2693 | Vector<Point2i> line_ranges = get_line_ranges_from_carets(false, false); |
| 2694 | int line_offset = 0; |
| 2695 | for (Point2i line_range : line_ranges) { |
| 2696 | // The text that will be inserted. All lines in one string. |
| 2697 | String text_to_insert; |
| 2698 | |
| 2699 | for (int i = line_range.x + line_offset; i <= line_range.y + line_offset; i++) { |
| 2700 | text_to_insert += get_line(i) + "\n"; |
| 2701 | unfold_line(i); |
| 2702 | } |
| 2703 | |
| 2704 | // Insert new text before the line. |
| 2705 | insert_text(text_to_insert, line_range.x + line_offset, 0); |
| 2706 | line_offset += line_range.y - line_range.x + 1; |
| 2707 | } |
| 2708 | |
| 2709 | end_multicaret_edit(); |
| 2710 | end_complex_operation(); |
| 2711 | } |
| 2712 | |
| 2713 | /* Visual */ |
| 2714 | Color CodeEdit::_get_brace_mismatch_color() const { |
no outgoing calls
no test coverage detected