From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9720 invoked by alias); 21 Apr 2014 11:16:34 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 9695 invoked by uid 89); 21 Apr 2014 11:16:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: smtpout17.bt.lon5.cpcloud.co.uk Received: from smtpout17.bt.lon5.cpcloud.co.uk (HELO smtpout17.bt.lon5.cpcloud.co.uk) (65.20.0.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Apr 2014 11:16:32 +0000 X-CTCH-RefID: str=0001.0A090208.5354FE0E.0060,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-Junkmail-Premium-Raw: score=7/97,refid=2.7.2:2014.3.18.91815:17:7.944,ip=,rules=__HAS_FROM, __TO_MALFORMED_2, __TO_NO_NAME, __SUBJ_ALPHA_END, __HAS_MSGID, __SANE_MSGID, __HAS_X_MAILER, __IN_REP_TO, __ANY_URI, __URI_NO_WWW, __CP_URI_IN_BODY, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, BODY_SIZE_7000_LESS X-CTCH-Spam: Unknown Received: from localhost.localdomain (86.164.67.104) by smtpout17.bt.lon5.cpcloud.co.uk (8.6.100.99.10223) (authenticated as jonturney@btinternet.com) id 5318507B025AA7FF; Mon, 21 Apr 2014 12:16:31 +0100 From: Jon TURNEY To: cygwin-apps@cygwin.com Cc: Jon TURNEY Subject: [PATCH setup 1/3] Fix selecting sites added to the download site list box Date: Mon, 21 Apr 2014 11:16:00 -0000 Message-Id: <1398078987-5116-2-git-send-email-jon.turney@dronecode.org.uk> In-Reply-To: <1398078987-5116-1-git-send-email-jon.turney@dronecode.org.uk> References: <1398078987-5116-1-git-send-email-jon.turney@dronecode.org.uk> X-SW-Source: 2014-04/txt/msg00053.txt.bz2 Fix selecting sites added to the download site list box which have the same protocol and hostname as an offical cygwin mirror. If I add the site http://mirrors.kernel.org/sources.redhat.com/cygwinports/ to setup's mirror list, using the GUI or --site option, I get two indistinguishable entries named http://mirrors.kernel.org in the mirror list box. Because PopulateListBox() uses the displayed string in the list control to locate the itesm to select, we end up with a random one of those two indistinguishable entries selected (usually the previously existing one). Even if you manually correct the selection, the same problem will re-occur when the selected sites are saved and restored on the next setup run. Fix this by selecting by the index in the all_site_list vector, instead of by displayed text. 2014-04-19 Jon TURNEY * site.cc (PopulateListBox): Select listbox items by finding the index of the item with a matching full URL, not by LB_FINDSTRING which does an inexact match on the displayed URL. Signed-off-by: Jon TURNEY --- site.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/site.cc b/site.cc index 2ed5d7b..e7d4113 100644 --- a/site.cc +++ b/site.cc @@ -637,10 +637,12 @@ SitePage::PopulateListBox () for (SiteList::const_iterator n = site_list.begin (); n != site_list.end (); ++n) { - int index = SendMessage (listbox, LB_FINDSTRING, (WPARAM) - 1, - (LPARAM) n->displayed_url.c_str()); - if (index != LB_ERR) - { + SiteList::iterator i = find (all_site_list.begin(), + all_site_list.end(), *n); + if (i != all_site_list.end()) + { + int index = i - all_site_list.begin(); + // Highlight the selected item SendMessage (listbox, LB_SELITEMRANGE, TRUE, (index << 16) | index); // Make sure it's fully visible -- 1.8.5.5