From 613092a6a55a69b2ff91ed3a2d5198ffc57806b6 Mon Sep 17 00:00:00 2001
From: Lawson Whitney <lawson_whitney@juno.com>
Date: Mon, 22 Mar 1999 14:46:43 +0000
Subject: [PATCH] Made LB_GETCURSEL return focus_item if no item has been
 selected.

---
 controls/listbox.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/controls/listbox.c b/controls/listbox.c
index a298ff9989e..736922ad2e9 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -2229,6 +2229,9 @@ LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg,
     case LB_GETCURSEL16:
     case LB_GETCURSEL:
         retvalue = descr->selected_item;
+        if (retvalue == -1) retvalue = descr->focus_item;
+        /* otherwise, if the user tries to move the selection with the    */
+        /* arrow keys, we will give the application something to choke on */
         goto END;
 
     case LB_GETTOPINDEX16:
-- 
GitLab