IDEA-127533 int field is displayed as char - show only reasonable ascii as chars
This commit is contained in:
@@ -133,7 +133,7 @@ public class ConstExprent extends Exprent {
|
||||
String ret = CHAR_ESCAPES.get(val);
|
||||
if (ret == null) {
|
||||
char c = (char)val.intValue();
|
||||
if (c >= 32 && c < 127 || !ascii && TextUtil.isPrintableUnicode(c)) {
|
||||
if (isPrintableAscii(c) || !ascii && TextUtil.isPrintableUnicode(c)) {
|
||||
ret = String.valueOf(c);
|
||||
}
|
||||
else {
|
||||
@@ -278,7 +278,7 @@ public class ConstExprent extends Exprent {
|
||||
// buffer.append("\\\'");
|
||||
// break;
|
||||
default:
|
||||
if (c >= 32 && c < 127 || !ascii && TextUtil.isPrintableUnicode(c)) {
|
||||
if (isPrintableAscii(c) || !ascii && TextUtil.isPrintableUnicode(c)) {
|
||||
buffer.append(c);
|
||||
}
|
||||
else {
|
||||
@@ -371,7 +371,7 @@ public class ConstExprent extends Exprent {
|
||||
// BYTECHAR and SHORTCHAR => CHAR in the CHAR context
|
||||
if (expectedType.equals(VarType.VARTYPE_CHAR) &&
|
||||
(constType.equals(VarType.VARTYPE_BYTECHAR) || constType.equals(VarType.VARTYPE_SHORTCHAR))) {
|
||||
if (getIntValue() != 0) {
|
||||
if (isPrintableAscii(getIntValue())) {
|
||||
setConstType(VarType.VARTYPE_CHAR);
|
||||
}
|
||||
}
|
||||
@@ -382,6 +382,11 @@ public class ConstExprent extends Exprent {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPrintableAscii(int c) {
|
||||
return c >= 32 && c < 127;
|
||||
}
|
||||
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user