Commits

sk  committed 54c78e0

Fixed some new lines in repl output. Still have one extra newline before prompt.

  • Participants
  • Parent commits 8ad2552

Comments (0)

Files changed (1)

File src/org/lispdev/console/ConsoleEnterTrigger.java

 /**
- * 
+ *
  */
 package org.lispdev.console;
 
  */
 public class ConsoleEnterTrigger extends ConsoleInputTrigger
 {
-  private int stateMask;
-  
+  private final int stateMask;
+  private final boolean doit;
+
   /**
    * @param r - repl to connect with
    * @param stateMask - one of the following: SWT.NONE, or combination of
    * SWT.ALT, SWT.CTRL, SWT.SHIFT (combination performed using |, example:
    * SWT.ALT | SWT.CTRL
+   * @param doit - if true, the return operation is allowed (i.e. new
+   * line will be added in console)
    */
-  public ConsoleEnterTrigger(LispConsole repl, int stateMask, int partitionResolutionFlag)
+  public ConsoleEnterTrigger(LispConsole repl, int stateMask,
+      int partitionResolutionFlag, boolean doit)
   {
     super(repl,partitionResolutionFlag);
     this.stateMask = stateMask;
+    this.doit = doit;
   }
 
   /* (non-Javadoc)
   @Override
   protected boolean check(VerifyEvent event)
   {
-    return (event.stateMask == stateMask &&
+    final boolean result = (event.stateMask == stateMask &&
         (event.keyCode == '\r' || event.keyCode == '\n'));
+    if( !doit && result )
+    {
+      event.doit = false;
+    }
+    return result;
   }
 
 }