fixed incorrect "view text" \n presentation for short strings

This commit is contained in:
Egor.Ushakov
2014-06-23 18:37:14 +04:00
parent a33da81613
commit 2249533ae6
3 changed files with 9 additions and 9 deletions
@@ -29,10 +29,7 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.debugger.ui.impl.DebuggerTreeRenderer;
import com.intellij.debugger.ui.impl.watch.*;
import com.intellij.debugger.ui.tree.*;
import com.intellij.debugger.ui.tree.render.ArrayRenderer;
import com.intellij.debugger.ui.tree.render.ChildrenBuilder;
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
import com.intellij.debugger.ui.tree.render.NodeRenderer;
import com.intellij.debugger.ui.tree.render.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
@@ -107,7 +104,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
final String[] strings = splitValue(myValueDescriptor.getValueLabel());
String value = StringUtil.notNullize(strings[1]);
XValuePresentation presentation = new XRegularValuePresentation(value, strings[0]);
if (myValueDescriptor.isString()) {
if (myValueDescriptor.isString() || myValueDescriptor.getLastRenderer() instanceof ToStringRenderer) {
presentation = new TypedStringValuePresentation(StringUtil.unquoteString(value), strings[0]);
}
if (value.length() > XValueNode.MAX_VALUE_LENGTH) {
@@ -110,9 +110,11 @@ public class ClassRenderer extends NodeRendererImpl{
final StringBuilder buf = StringBuilderSpinAllocator.alloc();
try {
if (value instanceof StringReference) {
buf.append('\"');
buf.append(DebuggerUtils.convertToPresentationString(((StringReference)value).value()));
buf.append('\"');
// no need to add quotes and escape characters here, XValueTextRendererImpl handles the presentation
//buf.append('\"');
//buf.append(DebuggerUtils.convertToPresentationString(((StringReference)value).value()));
//buf.append('\"');
buf.append(((StringReference)value).value());
}
else if (value instanceof ClassObjectReference) {
ReferenceType type = ((ClassObjectReference)value).reflectedType();
@@ -78,7 +78,8 @@ public class ToStringRenderer extends NodeRendererImpl {
BatchEvaluator.getBatchEvaluator(evaluationContext.getDebugProcess()).invoke(new ToStringCommand(evaluationContext, value) {
public void evaluationResult(String message) {
valueDescriptor.setValueLabel(
message == null? "" : "\"" + DebuggerUtils.convertToPresentationString(DebuggerUtilsEx.truncateString(message)) + "\""
// no need to add quotes and escape characters here, XValueTextRendererImpl handles the presentation
message == null? "" : /*"\"" + DebuggerUtils.convertToPresentationString(*/DebuggerUtilsEx.truncateString(message)/*) + "\""*/
);
labelListener.labelChanged();
}