From cd3aa9a1bc263edaa3521eaad88b42e7dee562a6 Mon Sep 17 00:00:00 2001 From: "Roman.Sergeenko" Date: Tue, 8 Mar 2022 16:25:50 +0300 Subject: [PATCH] #RI-2478 - clear history position for wb after end of the list #RI-2476 - check suggestController for switching history commands --- redisinsight/ui/src/components/query/Query/Query.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/redisinsight/ui/src/components/query/Query/Query.tsx b/redisinsight/ui/src/components/query/Query/Query.tsx index e696c82a14..c5c8e76092 100644 --- a/redisinsight/ui/src/components/query/Query/Query.tsx +++ b/redisinsight/ui/src/components/query/Query/Query.tsx @@ -95,6 +95,11 @@ const Query = (props: Props) => { const onChange = (value: string = '') => { setQuery(value) + + // clear history position after scrolling all list with empty value + if (value === '' && execHistoryPos >= execHistory.length) { + execHistoryPos = 0 + } } const handleKeyDown = (e: React.KeyboardEvent) => { @@ -127,7 +132,8 @@ const Query = (props: Props) => { const { editor } = monacoObjects?.current const position = editor.getPosition() - if (position?.lineNumber !== 1) return + // @ts-ignore + if (position?.lineNumber !== 1 || editor.getContribution('editor.contrib.suggestController')?.model?.state) return if (execHistory[execHistoryPos]) { const command = execHistory[execHistoryPos].command || ''