File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ namespace hex::ui {
55
55
}
56
56
57
57
ScrollPosition& operator =(ImS64 value) {
58
+ if (value < 0 )
59
+ value = 0 ;
60
+
58
61
this ->get () = value;
59
62
return *this ;
60
63
}
@@ -157,7 +160,7 @@ namespace hex::ui {
157
160
158
161
m_selectionStart = std::clamp<u64 >(start, 0 , maxAddress);
159
162
m_selectionEnd = std::clamp<u64 >(end, 0 , maxAddress);
160
- m_cursorPosition = m_selectionEnd ;
163
+ m_cursorPosition = m_selectionStart ;
161
164
162
165
if (m_selectionChanged) {
163
166
auto selection = this ->getSelection ();
Original file line number Diff line number Diff line change @@ -1054,15 +1054,15 @@ namespace hex::ui {
1054
1054
1055
1055
// Calculate the current top and bottom row numbers of the viewport
1056
1056
ImS64 currentTopRow = m_scrollPosition;
1057
- ImS64 currentBottomRow = m_scrollPosition + m_visibleRowCount - 3 ;
1057
+ ImS64 currentBottomRow = std::max<ImS64>( m_scrollPosition + m_visibleRowCount - 3 , 0 ) ;
1058
1058
1059
1059
// Check if the targetRowNumber is outside the current visible range
1060
1060
if (ImS64 (targetRowNumber) < currentTopRow) {
1061
1061
// If target is above the current view, scroll just enough to bring it into view at the top
1062
- m_scrollPosition = targetRowNumber - ( m_visibleRowCount * m_jumpPivot) ;
1062
+ m_scrollPosition = targetRowNumber + m_visibleRowCount * m_jumpPivot - 3 ;
1063
1063
} else if (ImS64 (targetRowNumber) > currentBottomRow) {
1064
1064
// If target is below the current view, scroll just enough to bring it into view at the bottom
1065
- m_scrollPosition = targetRowNumber - (m_visibleRowCount - 3 ) ;
1065
+ m_scrollPosition = targetRowNumber - 3 ;
1066
1066
}
1067
1067
1068
1068
m_jumpPivot = 0 .0F ;
You can’t perform that action at this time.
0 commit comments