Skip to content
Snippets Groups Projects
Commit fc635d12 authored by chris's avatar chris
Browse files

fix find and replace wrong selection

parent 94f6637c
No related branches found
No related tags found
1 merge request!278fix find and replace wrong selection
......@@ -176,6 +176,9 @@ const ExpandedFindAndReplaceComponent = ({
useEffect(() => {
delayedSearch();
let counter = 0;
counter = helpers.getMatchesByView(view, searchValue, matchCaseSearch);
setCounterSearches(counter);
}, [searchValue, delayedSearch, matchCaseSearch, JSON.stringify(allStates)]);
const setCounterSearches = counter => {
......@@ -229,12 +232,11 @@ const ExpandedFindAndReplaceComponent = ({
};
const searchDocument = () => {
let counter = 0;
findAndReplacePlugin.props.setSearchText(searchValue);
findAndReplacePlugin.props.setSearchMatchCase(matchCaseSearch);
counter = helpers.getMatchesByView(view, searchValue, matchCaseSearch);
setCounterSearches(counter);
// let counter = 0;
// counter = helpers.getMatchesByView(view, searchValue, matchCaseSearch);
// setCounterSearches(counter);
if (searchRef.current === document.activeElement) {
eachRight(view, (singleView, viewId) => {
......
......@@ -47,6 +47,7 @@ const FindAndReplaceComponent = ({ close }) => {
};
const findNextMatch = (searchValue, matchCaseSearch) => {
if (!view[activeViewId].focused) view[activeViewId].focus();
const counter = helpers.getMatchesByView(
view,
searchValue,
......@@ -125,6 +126,8 @@ const FindAndReplaceComponent = ({ close }) => {
};
const findPreviousMatch = (searchValue, matchCaseSearch) => {
if (!view[activeViewId].focused) view[activeViewId].focus();
const counter = helpers.getMatchesByView(
view,
searchValue,
......
......@@ -134,6 +134,10 @@ const FindComponent = ({
useEffect(() => {
delayedSearch();
let counter = 0;
counter = helpers.getMatchesByView(view, searchValue, matchCaseSearch);
setCounterSearches(counter);
if (isFirstRun) {
setTimeout(() => {
searchRef.current.focus();
......@@ -191,12 +195,11 @@ const FindComponent = ({
};
const searchDocument = () => {
let counter = 0;
findAndReplacePlugin.props.setSearchText(searchValue);
findAndReplacePlugin.props.setSearchMatchCase(matchCaseSearch);
counter = helpers.getMatchesByView(view, searchValue, matchCaseSearch);
setCounterSearches(counter);
// let counter = 0;
// counter = helpers.getMatchesByView(view, searchValue, matchCaseSearch);
// setCounterSearches(counter);
if (searchRef.current === document.activeElement) {
eachRight(view, (singleView, viewId) => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment