mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 20:07:32 +00:00
Improved replace exclusion QoL
This commit is contained in:
1 parent
05bb9c0081
commit
4b7effe2d7
1 file changed
+15
-13
@@ -1192,12 +1192,10 @@ public class SearchReplaceBar {
|
||||
*/
|
||||
public void goToNextMatch() {
|
||||
if (matches.isEmpty()) return;
|
||||
|
||||
int startIndex = currentMatchIndex;
|
||||
do {
|
||||
currentMatchIndex = (currentMatchIndex + 1) % matches.size();
|
||||
} while (excludedMatches.contains(currentMatchIndex) && currentMatchIndex != startIndex);
|
||||
|
||||
|
||||
if (currentMatchIndex < 0) currentMatchIndex = 0;
|
||||
else currentMatchIndex = (currentMatchIndex + 1) % matches.size();
|
||||
|
||||
navigateToCurrentMatch();
|
||||
}
|
||||
|
||||
@@ -1206,12 +1204,10 @@ public class SearchReplaceBar {
|
||||
*/
|
||||
public void goToPreviousMatch() {
|
||||
if (matches.isEmpty()) return;
|
||||
|
||||
int startIndex = currentMatchIndex;
|
||||
do {
|
||||
currentMatchIndex = (currentMatchIndex - 1 + matches.size()) % matches.size();
|
||||
} while (excludedMatches.contains(currentMatchIndex) && currentMatchIndex != startIndex);
|
||||
|
||||
|
||||
if (currentMatchIndex < 0) currentMatchIndex = matches.size() - 1;
|
||||
else currentMatchIndex = (currentMatchIndex - 1 + matches.size()) % matches.size();
|
||||
|
||||
navigateToCurrentMatch();
|
||||
}
|
||||
|
||||
@@ -1287,7 +1283,13 @@ public class SearchReplaceBar {
|
||||
* Exclude current match from replacement
|
||||
*/
|
||||
public void excludeCurrentMatch() {
|
||||
if (currentMatchIndex >= 0 && !excludedMatches.contains(currentMatchIndex)) {
|
||||
if (currentMatchIndex < 0) return;
|
||||
|
||||
if (excludedMatches.contains(currentMatchIndex)) {
|
||||
// If already excluded, remove the exclusion and keep selection on this match
|
||||
excludedMatches.remove(Integer.valueOf(currentMatchIndex));
|
||||
} else {
|
||||
// Otherwise exclude and move to the next match
|
||||
excludedMatches.add(currentMatchIndex);
|
||||
goToNextMatch();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user