diff --git a/components/codetools/ide/codyidentifiersdlg.lfm b/components/codetools/ide/codyidentifiersdlg.lfm index 90d8a8e6b9..2f4bcbe869 100644 --- a/components/codetools/ide/codyidentifiersdlg.lfm +++ b/components/codetools/ide/codyidentifiersdlg.lfm @@ -68,9 +68,12 @@ object CodyIdentifiersDlg: TCodyIdentifiersDlg BorderSpacing.Left = 6 BorderSpacing.Right = 6 BorderSpacing.Bottom = 1 + ClickOnSelChange = False ItemHeight = 0 + OnClick = ItemsListBoxClick OnContextPopup = ItemsListBoxContextPopup OnDblClick = ItemsListBoxDblClick + OnKeyDown = ItemsListBoxKeyDown OnSelectionChange = ItemsListBoxSelectionChange PopupMenu = PopupMenu1 TabOrder = 2 diff --git a/components/codetools/ide/codyidentifiersdlg.pas b/components/codetools/ide/codyidentifiersdlg.pas index c2283092fb..4a8344a59d 100644 --- a/components/codetools/ide/codyidentifiersdlg.pas +++ b/components/codetools/ide/codyidentifiersdlg.pas @@ -172,6 +172,9 @@ type procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); procedure HideOtherProjectsCheckBoxChange(Sender: TObject); + procedure ItemsListBoxKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure ItemsListBoxClick(Sender: TObject); procedure ItemsListBoxDblClick(Sender: TObject); procedure ItemsListBoxSelectionChange(Sender: TObject; {%H-}User: boolean); procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean); @@ -956,6 +959,9 @@ begin ItemsListBox.ItemIndex:=i-1; Key := 0; end; + + if Key <> 0 then + ItemsListBoxKeyDown(Sender, Key, Shift); end; procedure TCodyIdentifiersDlg.FormDestroy(Sender: TObject); @@ -1014,6 +1020,32 @@ begin IdleConnected:=true; end; +procedure TCodyIdentifiersDlg.ItemsListBoxKeyDown(Sender: TObject; + var Key: Word; Shift: TShiftState); +begin + if (Key = VK_RETURN) and (Shift = []) then + begin + if FindSelectedIdentifier = nil then + begin + MaxItems := MaxItems + CodyOptions.UDMaxListItems; + Key := 0; + end; + end; +end; + +procedure TCodyIdentifiersDlg.ItemsListBoxClick(Sender: TObject); +var + lClickPos: TPoint; +begin + // ignore clicks in empty area + lClickPos := ItemsListBox.ScreenToClient(Mouse.CursorPos); + if ItemsListBox.ItemAtPos(lClickPos, true) < 0 then exit; + + // if a special item "show more" is clicked + if (ItemsListBox.ItemIndex >= 0) and (FindSelectedIdentifier = nil) then + MaxItems := MaxItems + CodyOptions.UDMaxListItems; +end; + procedure TCodyIdentifiersDlg.ItemsListBoxDblClick(Sender: TObject); var lClickPos: TPoint; @@ -1243,8 +1275,13 @@ begin end; sl.Add(s); end; - if Found>sl.Count then - sl.Add(Format(crsAndMoreIdentifiers, [IntToStr(Found-sl.Count)])); + if Found > sl.Count then + begin + if Found - sl.Count > CodyOptions.UDMaxListItems then + sl.Add(Format(crsShowMoreIdentifiers, [CodyOptions.UDMaxListItems, Found - sl.Count])) + else + sl.Add(Format(crsShowRemainingIdentifiers, [Found - sl.Count])); + end; ItemsListBox.Items.Assign(sl); if Found>0 then diff --git a/components/codetools/ide/codystrconsts.pas b/components/codetools/ide/codystrconsts.pas index 548180246a..2307f295c1 100644 --- a/components/codetools/ide/codystrconsts.pas +++ b/components/codetools/ide/codystrconsts.pas @@ -182,7 +182,8 @@ resourcestring crsShowOnlyIdentifiersContainingFilterText = 'Show only identifiers ' +'containing filter text'; crsUseIdentifier = '&Use identifier'; - crsAndMoreIdentifiers = '... and %s more identifiers'; + crsShowMoreIdentifiers = '... click to show %d more (up to %d left)'; + crsShowRemainingIdentifiers = '... click to show remaining (up to %d left)'; crsContextUseIdentifier = 'Use "%s"'; crsContextJumpTo = 'Jump to "%s"'; crsContextDeleteUnit = 'Delete unit "%s"';