From f661cad6a3d8c28988e9de82f0222c5bb484dc75 Mon Sep 17 00:00:00 2001 From: mic074b Date: Tue, 21 Jan 2020 20:06:28 +1100 Subject: [PATCH] More note searchbar enhancements. Indicate selected match Fade search result text Ctrl-F selects input content upon repeat --- ElectronClient/app/gui/NoteSearchBar.jsx | 13 ++++++++++--- ElectronClient/app/gui/NoteText.jsx | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ElectronClient/app/gui/NoteSearchBar.jsx b/ElectronClient/app/gui/NoteSearchBar.jsx index 9baa678b3..2b9c36b18 100644 --- a/ElectronClient/app/gui/NoteSearchBar.jsx +++ b/ElectronClient/app/gui/NoteSearchBar.jsx @@ -87,6 +87,13 @@ class NoteSearchBarComponent extends React.Component { if (this.props.onClose) this.props.onClose(); } + + if (event.keyCode === 70) { + // F key + if (event.ctrlKey) { + event.target.select(); + } + } } previousButton_click() { @@ -114,9 +121,9 @@ class NoteSearchBarComponent extends React.Component { return _('No matches found'); } if (this.props.resultCount === 1) { - return _('%d match found', this.props.resultCount); + return _('1 of 1 match'); } - return _('%d matches found', this.props.resultCount); + return _('%d of %d matches', this.props.selectedIndex + 1, this.props.resultCount); } render() { @@ -136,7 +143,7 @@ class NoteSearchBarComponent extends React.Component { const textStyle = Object.assign({ fontSize: theme.fontSize, fontFamily: theme.fontFamily, - color: theme.color, + color: theme.colorFaded, backgroundColor: theme.backgroundColor, }); const matchesFoundString = (this.props.query.length > 0) ? ( diff --git a/ElectronClient/app/gui/NoteText.jsx b/ElectronClient/app/gui/NoteText.jsx index 8496a609f..c23e990a3 100644 --- a/ElectronClient/app/gui/NoteText.jsx +++ b/ElectronClient/app/gui/NoteText.jsx @@ -2157,6 +2157,7 @@ class NoteTextComponent extends React.Component { }} query={this.state.localSearch.result.query} resultCount={this.state.localSearch.result.count} + selectedIndex={this.state.localSearch.selectedIndex} onChange={this.noteSearchBar_change} onNext={this.noteSearchBar_next} onPrevious={this.noteSearchBar_previous}