Skip to content

Commit

Permalink
Fixes #228 - prefix evaluated expressions in REPL log with =>
Browse files Browse the repository at this point in the history
  • Loading branch information
cemerick committed Mar 5, 2011
1 parent 1196537 commit b4fb081
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ccw.core/src/ccw/repl/REPLView.java
Expand Up @@ -2,6 +2,7 @@

import java.net.ConnectException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.ILaunch;
Expand Down Expand Up @@ -70,6 +71,7 @@ public class REPLView extends ViewPart implements IAdaptable {
}

private static final Keyword inputExprLogType = Keyword.intern("in-expr");
private static final Pattern boostIndent = Pattern.compile("^", Pattern.MULTILINE);

// TODO would like to eliminate separate log view, but:
// 1. PareditAutoEditStrategy gets all text from a source document, and bails badly if its not well-formed
Expand Down Expand Up @@ -97,6 +99,8 @@ public class REPLView extends ViewPart implements IAdaptable {
public REPLView () {}

private void copyToLog (StyledText s) {
// sadly, need to reset text on the ST in order to get formatting/style ranges...
s.setText(boostIndent.matcher(s.getText()).replaceAll(" ").replaceFirst("^\\s+", "=> "));
int start = logPanel.getCharCount();
try {
log.invoke(logPanel, s.getText(), inputExprLogType);
Expand Down

0 comments on commit b4fb081

Please sign in to comment.