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 <skylot@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user