From 98e365ae5ce90c147b748379885f2c7966a72638 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Thu, 10 Jun 2010 14:05:38 +0800 Subject: [PATCH] Fix history combobox show twice item search miss search first item of combobox. so item will show twice if add new one, which is same as the first item. Signed-off-by: Frank Li --- src/Utils/MiscUI/HistoryCombo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Utils/MiscUI/HistoryCombo.cpp b/src/Utils/MiscUI/HistoryCombo.cpp index 555c1acec..a51940223 100644 --- a/src/Utils/MiscUI/HistoryCombo.cpp +++ b/src/Utils/MiscUI/HistoryCombo.cpp @@ -112,6 +112,7 @@ int CHistoryCombo::AddString(CString str, INT_PTR pos,BOOL isSel) CString combostring = str; combostring.Replace('\r', ' '); combostring.Replace('\n', ' '); + str=combostring=combostring.Trim(); cbei.pszText = const_cast(combostring.GetString()); #ifdef HISTORYCOMBO_WITH_SYSIMAGELIST @@ -154,13 +155,13 @@ int CHistoryCombo::AddString(CString str, INT_PTR pos,BOOL isSel) //search the Combo for another string like this //and delete it if one is found str.Trim(); - int nIndex = FindStringExact(0, combostring); + int nIndex = FindStringExact(-1, combostring); if (nIndex != -1 && nIndex != nRet) { DeleteItem(nIndex); m_arEntries.RemoveAt(nIndex); //nRet is now (potentially) invalid. Reset it. - nRet = FindStringExact(0, str); + nRet = FindStringExact(-1, str); } //truncate list to m_nMaxHistoryItems -- 2.11.4.GIT