diff options
Diffstat (limited to 'graphics/macgui/mactextwindow.cpp')
-rw-r--r-- | graphics/macgui/mactextwindow.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp index 36c2bd6321..2194fddf36 100644 --- a/graphics/macgui/mactextwindow.cpp +++ b/graphics/macgui/mactextwindow.cpp @@ -155,16 +155,22 @@ void MacTextWindow::drawSelection() { if (_selectedText.endY == -1) return; - int start = MIN(_selectedText.startY, _selectedText.endY); - start -= _scrollPos; + SelectedText s = _selectedText; + + if (s.startY > s.endY) { + SWAP(s.startX, s.endX); + SWAP(s.startY, s.endY); + SWAP(s.startRow, s.endRow); + SWAP(s.startCol, s.endCol); + } + + int start = s.startY - _scrollPos; start = MAX(0, start); if (start > getInnerDimensions().height()) return; - int end = MAX(_selectedText.startY, _selectedText.endY); - - end -= _scrollPos; + int end = s.endY - _scrollPos; if (end < 0) return; |