mirror of
https://github.com/SuspiciousActivity/ByteEdit.git
synced 2026-08-13 17:56:17 +00:00
Fixed a search/replace bug and a new class bug
This commit is contained in:
1 parent
a773480a23
commit
d492b79a8f
3 files changed
+13
-4
No files matched your search
@@ -4,6 +4,7 @@ import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.swing.JButton;
|
||||
@@ -111,7 +112,8 @@ public class SearchBox extends JFrame {
|
||||
: Main.txtByteEditView.getText().substring(startPos).toLowerCase();
|
||||
int index = txt.indexOf(chckbxCaseSensitive.isSelected() ? toFind : toFind.toLowerCase());
|
||||
if (index == -1) {
|
||||
txt = chckbxCaseSensitive.isSelected() ? Main.txtByteEditView.getText() : Main.txtByteEditView.getText().toLowerCase();
|
||||
txt = chckbxCaseSensitive.isSelected() ? Main.txtByteEditView.getText()
|
||||
: Main.txtByteEditView.getText().toLowerCase();
|
||||
index = txt.indexOf(chckbxCaseSensitive.isSelected() ? toFind : toFind.toLowerCase());
|
||||
startPos = 0;
|
||||
if (index == -1) {
|
||||
@@ -141,7 +143,9 @@ public class SearchBox extends JFrame {
|
||||
if (chckbxCaseSensitive.isSelected()) {
|
||||
Main.txtByteEditView.replaceRange(txt.replace(toFind, toReplace), 0, txt.length());
|
||||
} else {
|
||||
Main.txtByteEditView.replaceRange(txt.replaceAll("(?i)" + Pattern.quote(toFind), toReplace), 0, txt.length());
|
||||
Main.txtByteEditView.replaceRange(
|
||||
txt.replaceAll("(?i)" + Pattern.quote(toFind), Matcher.quoteReplacement(toReplace)), 0,
|
||||
txt.length());
|
||||
}
|
||||
Main.txtByteEditView.setCaretPosition(prev);
|
||||
}
|
||||
|
||||
@@ -422,10 +422,10 @@ public class Assembler {
|
||||
System.err.println("Error at line: " + read.currentLine);
|
||||
try {
|
||||
Main.txtByteEditView.setCaretPosition(Main.txtByteEditView.getLineStartOffset(read.currentLine));
|
||||
Main.showError(e.getMessage());
|
||||
} catch (BadLocationException e1) {
|
||||
System.err.println("Can't show line!");
|
||||
}
|
||||
Main.showError(e.getMessage());
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} finally {
|
||||
|
||||
@@ -667,7 +667,12 @@ public class Main extends JFrame {
|
||||
} else {
|
||||
model = (ArchiveTreeModel) tree.getModel();
|
||||
}
|
||||
model.paths.add(node.name + ".class");
|
||||
if (node.name.contains("/") ? (!node.name.split("/")[node.name.split("/").length - 1].contains("$"))
|
||||
: (!node.name.contains("$"))) {
|
||||
model.paths.add(node.name + ".class");
|
||||
} else if (node.name.startsWith("$") || node.name.contains("$$") || node.name.endsWith("$")) { // obfuscated
|
||||
model.paths.add(node.name + ".class");
|
||||
}
|
||||
model.refresh();
|
||||
model.reload();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user