Skip to content

Commit d24a04a

Browse files
Fixed: Fix issue where menu wouldn't show when text on bottom row of terminal was selected
Closes #2233
1 parent aee0da4 commit d24a04a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

terminal-view/src/main/java/com/termux/view/textselection/TextSelectionCursorController.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,19 @@ public void onGetContentRect(ActionMode mode, View view, Rect outRect) {
183183
int y1 = Math.round((mSelY1 - 1 - terminalView.getTopRow()) * terminalView.mRenderer.getFontLineSpacing());
184184
int y2 = Math.round((mSelY2 + 1 - terminalView.getTopRow()) * terminalView.mRenderer.getFontLineSpacing());
185185

186-
187186
if (x1 > x2) {
188187
int tmp = x1;
189188
x1 = x2;
190189
x2 = tmp;
191190
}
192191

193-
outRect.set(x1, y1 + mHandleHeight, x2, y2 + mHandleHeight);
192+
int terminalBottom = terminalView.getBottom();
193+
int top = y1 + mHandleHeight;
194+
int bottom = y2 + mHandleHeight;
195+
if (top > terminalBottom) top = terminalBottom;
196+
if (bottom > terminalBottom) bottom = terminalBottom;
197+
198+
outRect.set(x1, top, x2, bottom);
194199
}
195200
}, ActionMode.TYPE_FLOATING);
196201
}

0 commit comments

Comments
 (0)