From 8760b4ddde79a10ce05b46f2110181b8cabf18be Mon Sep 17 00:00:00 2001 From: JustFor <35858818+zhongqingsong@users.noreply.github.com> Date: Sun, 17 Mar 2024 02:55:57 +0800 Subject: [PATCH] fix(gui): copy strings without quotes (PR #2121) * Update AbstractCodeArea.java In general, we need data, not text in code. But now every time you copy the highlighted text, you copy the highlighted quotes as well. This often results in an extra need to delete the quotation marks around the sides, which is confusing. Now when copying selected highlighted text, quotes are not copied in. * Update AbstractCodeArea.java fix code format * additional checks, move to common method --------- Co-authored-by: Skylot --- .../java/jadx/gui/ui/codearea/AbstractCodeArea.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jadx-gui/src/main/java/jadx/gui/ui/codearea/AbstractCodeArea.java b/jadx-gui/src/main/java/jadx/gui/ui/codearea/AbstractCodeArea.java index 7cda35033..655b14de7 100644 --- a/jadx-gui/src/main/java/jadx/gui/ui/codearea/AbstractCodeArea.java +++ b/jadx-gui/src/main/java/jadx/gui/ui/codearea/AbstractCodeArea.java @@ -272,10 +272,15 @@ public abstract class AbstractCodeArea extends RSyntaxTextArea { public @Nullable String getWordByPosition(int offset) { Token token = getWordTokenAtOffset(offset); - if (token != null) { - return token.getLexeme(); + if (token == null) { + return null; } - return null; + String str = token.getLexeme(); + int len = str.length(); + if (len > 2 && str.startsWith("\"") && str.endsWith("\"")) { + return str.substring(1, len - 1); + } + return str; } /**