diff --git a/src/winio.c b/src/winio.c
index 816cef3f021befc855ad4642533cf432ceba1f14..a4d6eb8b5554a8fda93f115a104653c3749e2a16 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1869,8 +1869,11 @@ bool do_statusbar_mouse(void)
 	if (wenclose(bottomwin, mouse_y, mouse_x)) {
 	    size_t start_col = strlenpt(prompt) + 1;
 
+	    /* Subtract out the sizes of topwin and edit. */
+	    mouse_y -= (2 - no_more_space()) + editwinrows;
+
 	    /* Move to where the click occurred. */
-	    if (mouse_x > start_col) {
+	    if (mouse_x > start_col && mouse_y == 0) {
 		size_t xpt = strnlenpt(answer, statusbar_x);
 
 		statusbar_x = actual_x(answer,