diff --git a/flatpak/com.github.ransome1.sleek.appdata.xml b/flatpak/com.github.ransome1.sleek.appdata.xml
index 0a738160..1bb98f63 100755
--- a/flatpak/com.github.ransome1.sleek.appdata.xml
+++ b/flatpak/com.github.ransome1.sleek.appdata.xml
@@ -9,7 +9,7 @@
Robin Ahle
-
+
https://github.com/ransome1/sleek
https://github.com/ransome1/sleek/issues
diff --git a/flatpak/com.github.ransome1.sleek.desktop b/flatpak/com.github.ransome1.sleek.desktop
index e0fa4c82..8473da56 100755
--- a/flatpak/com.github.ransome1.sleek.desktop
+++ b/flatpak/com.github.ransome1.sleek.desktop
@@ -1,5 +1,5 @@
[Desktop Entry]
-Version=2.0.3-rc.2
+Version=2.0.3-rc.3
Name=sleek
Exec=sleek
Type=Application
diff --git a/package.json b/package.json
index c420dd22..d5177b49 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "sleek",
- "version": "2.0.3-rc.2",
+ "version": "2.0.3-rc.3",
"main": "./src/main/main.ts",
"scripts": {
"build": "concurrently \"yarn run peggy\" \"yarn run build:main\" \"yarn run build:renderer\"",
diff --git a/release/app/package.json b/release/app/package.json
index bbf1dd68..bf9f1a05 100644
--- a/release/app/package.json
+++ b/release/app/package.json
@@ -1,6 +1,6 @@
{
"name": "sleek",
- "version": "2.0.3-rc.2",
+ "version": "2.0.3-rc.3",
"description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"keywords": [
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index d97fad92..860519b9 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,6 +1,6 @@
name: sleek
base: core20
-version: "2.0.3-rc.2"
+version: "2.0.3-rc.3"
summary: todo.txt manager for Linux, free and open-source (FOSS)
description: |
sleek is an open-source (FOSS) todo manager based on the todo.txt syntax. Stripped down to only the most necessary features, and with a clean and simple interface, sleek aims to help you focus on getting things done.
diff --git a/src/main/config.tsx b/src/main/config.tsx
index 1f2d5230..0a2f7c49 100644
--- a/src/main/config.tsx
+++ b/src/main/config.tsx
@@ -98,9 +98,12 @@ if (!fs.existsSync(customStylesPath)) {
fs.writeFileSync(customStylesPath, '');
}
-const handleConfigChange = async (key: string, newValue: any) => {
+const handleConfigChange = async () => {
+ // TODO: If there was a search string before it will be ignored here, needs fix
const [todoObjects, attributes, headers, filters] = await processDataRequest('');
- mainWindow!.webContents.send('requestData', todoObjects, attributes, headers, filters);
+ if (todoObjects) {
+ mainWindow!.webContents.send('requestData', todoObjects, attributes, headers, filters);
+ }
};
filterStorage.onDidAnyChange((newValue, oldValue) => {
@@ -111,7 +114,6 @@ configStorage.onDidAnyChange((newValue, oldValue) => {
handleConfigChange();
});
-
configStorage.onDidChange('files', async (files: File[] | undefined) => {
if (files) {
diff --git a/src/renderer/TodoDialog/AutoSuggest.tsx b/src/renderer/TodoDialog/AutoSuggest.tsx
index 1a7762b1..d916a529 100644
--- a/src/renderer/TodoDialog/AutoSuggest.tsx
+++ b/src/renderer/TodoDialog/AutoSuggest.tsx
@@ -30,29 +30,22 @@ const AutoSuggest: React.FC = ({
textFieldRef,
}) => {
const [suggestions, setSuggestions] = useState([]);
- const [selectedSuggestionIndex, setSelectedSuggestionIndex] = useState(
- -1
- );
+ const [selectedSuggestionIndex, setSelectedSuggestionIndex] = useState(-1);
const [prefix, setPrefix] = useState(null);
- const [matchPosition, setMatchPosition] = useState<{ start: number; end: number }>(
- { start: -1, end: -1 }
- );
- const [multilineTextField, setMultilineTextField] = useState(
- store.get('multilineTextField')
- );
+ const [matchPosition, setMatchPosition] = useState<{ start: number; end: number }>({ start: -1, end: -1 });
+ const [multilineTextField, setMultilineTextField] = useState(store.get('multilineTextField'));
const handleSetMultilineTextField = () => {
setMultilineTextField((prevMultilineTextField) => !prevMultilineTextField);
};
const handleSuggestionsFetchRequested = ({ value }: { value: string }) => {
+
let content = value.replaceAll('\n', ' ').replaceAll(String.fromCharCode(16), ' ');
+ if (!content) return false;
- if (!content) return;
const cursorPosition = textFieldRef.current?.selectionStart;
- if (!cursorPosition) return;
-
- setSuggestions([]);
+ if (!cursorPosition) return false;
let match;
while ((match = regex.exec(content)) !== null) {
@@ -75,7 +68,6 @@ const AutoSuggest: React.FC = ({
_event: React.SyntheticEvent,
{ suggestion }: { suggestion: string }
) => {
-
if (!textFieldValue) return;
const createNewValue = (string: string, a: number, b: number) => {
return `${textFieldValue.slice(0, a)}${prefix}${string} ${textFieldValue.slice(
@@ -96,6 +88,13 @@ const AutoSuggest: React.FC = ({
setTextFieldValue(newValue);
};
+ const handleShouldRenderSuggestions = (value, reason) => {
+ if(reason === 'input-focused') {
+ return false;
+ }
+ return true;
+ }
+
const getSuggestions = (trigger: string, match: string): string[] => {
if (trigger === '@') {
setPrefix('@');
@@ -107,7 +106,7 @@ const AutoSuggest: React.FC = ({
return [];
};
- const renderSuggestion = (
+ const handleRenderSuggestion = (
suggestion: string,
{ isHighlighted }: { isHighlighted: boolean }
) => (
@@ -136,8 +135,8 @@ const AutoSuggest: React.FC = ({
string: string
) => {
if (suggestions.length > 0) {
- if (event.key === 'Enter') {
- if (suggestions.length > 0 && selectedSuggestionIndex !== -1) {
+ if (suggestions.length === 1 || event.key === 'Enter') {
+ if (selectedSuggestionIndex !== -1) {
event.stopPropagation();
const selectedSuggestion = suggestions[selectedSuggestionIndex];
handleSuggestionSelected(null, { suggestion: selectedSuggestion });
@@ -161,6 +160,12 @@ const AutoSuggest: React.FC = ({
}
};
+ const handleSuggestionHighlighted = (suggestion) => {
+ if(suggestions.length === 1) {
+ handleSuggestionSelected(null, { suggestion: suggestions[0] });
+ }
+ }
+
const value = () => {
return multilineTextField
? textFieldValue.replaceAll(String.fromCharCode(16), '\n')
@@ -172,8 +177,7 @@ const AutoSuggest: React.FC = ({
value: value(),
onChange: handleChange,
inputRef: textFieldRef,
- onKeyDown: (event: React.KeyboardEvent) =>
- handleKeyDown(event, todoObject?.id, textFieldValue),
+ onKeyDown: (event: React.KeyboardEvent) => handleKeyDown(event, todoObject?.id, textFieldValue),
};
useEffect(() => {
@@ -201,11 +205,16 @@ const AutoSuggest: React.FC = ({
)}
suggestions={suggestions}
+
+ shouldRenderSuggestions={handleShouldRenderSuggestions}
+
+
onSuggestionsFetchRequested={handleSuggestionsFetchRequested}
onSuggestionsClearRequested={handleSuggestionsClearRequested}
- getSuggestionValue={(suggestion: any) => suggestion}
- renderSuggestion={renderSuggestion}
+ getSuggestionValue={(suggestion: string) => suggestion}
+ renderSuggestion={handleRenderSuggestion}
onSuggestionSelected={handleSuggestionSelected}
+ onSuggestionHighlighted={handleSuggestionHighlighted}
inputProps={inputProps}
/>