| 1609 | _scroll_to_cursor = true; |
| 1610 | } |
| 1611 | void reshade::imgui::code_editor::move_top(bool selection) |
| 1612 | { |
| 1613 | assert(!_lines.empty()); |
| 1614 | |
| 1615 | const text_pos prev_pos = _cursor_pos; |
| 1616 | _cursor_pos = text_pos(0, 0); |
| 1617 | |
| 1618 | if (prev_pos == _cursor_pos) |
| 1619 | return; |
| 1620 | |
| 1621 | if (selection) |
| 1622 | { |
| 1623 | // This logic ensures the selection is updated depending on which direction it was created in (mimics behavior of popular text editors) |
| 1624 | if (_interactive_beg > _interactive_end) |
| 1625 | std::swap(_interactive_beg, _interactive_end); |
| 1626 | if (prev_pos != _interactive_beg) |
| 1627 | _interactive_end = _interactive_beg; |
| 1628 | |
| 1629 | _interactive_beg = _cursor_pos; |
| 1630 | } |
| 1631 | else |
| 1632 | { |
| 1633 | _interactive_beg = _cursor_pos; |
| 1634 | _interactive_end = _cursor_pos; |
| 1635 | } |
| 1636 | |
| 1637 | select(_interactive_beg, _interactive_end); |
| 1638 | _scroll_to_cursor = true; |
| 1639 | } |
| 1640 | void reshade::imgui::code_editor::move_bottom(bool selection) |
| 1641 | { |
| 1642 | assert(!_lines.empty()); |