Code Monkey home page Code Monkey logo

Comments (1)

hmah avatar hmah commented on June 9, 2024

The following DIFF describes a fix. Additionally, the ESCAPE key can be used to delete the whole line.

diff --git "a/C:\\DOKUME~1\\Harald\\LOKALE~1\\Temp\\TortoiseGit\\Int8CA.tmp\\InteractiveInterpreterConsole-8981b6c-left.boo" "b/C:\\Boo\\boo_master\\boo\\src\\Boo.Lang.Interpreter\\InteractiveInterpreterConsole.boo"
index 300dd92..3494ef9 100644
--- "a/C:\\DOKUME~1\\Harald\\LOKALE~1\\Temp\\TortoiseGit\\Int8CA.tmp\\InteractiveInterpreterConsole-8981b6c-left.boo"
+++ "b/C:\\Boo\\boo_master\\boo\\src\\Boo.Lang.Interpreter\\InteractiveInterpreterConsole.boo"
@@ -257,11 +257,13 @@ class InteractiveInterpreterConsole:
        _indent--
 
    protected def Delete(count as int): #if count is 0, forward-delete
+       return if LineLen == 0
        cx = Console.CursorLeft-len(CurrentPrompt)-count
-       return if cx < LineLen and count == 0
+       count=1 if cx >= LineLen and count == 0
+       return if cx >= LineLen
        dcount = (count if count != 0 else 1)
        _line.Remove(cx, dcount)
-       curX = Console.CursorLeft - dcount
+       curX = Console.CursorLeft - count
        Console.CursorLeft = curX
        Console.Write("${_line.ToString(cx, LineLen-cx)} ")
        Console.CursorLeft = curX
@@ -368,7 +370,16 @@ class InteractiveInterpreterConsole:
                    DisplaySuggestions()
                else:
                    Indent()
-
+           
+           # delete the whole line
+           if key == ConsoleKey.Escape:
+               curX = len(CurrentPrompt)
+               sizeL = _line.Length
+               _line.Remove(0, sizeL)
+               Console.CursorLeft = curX
+               Console.Write(string(' '[0], sizeL))
+               Console.CursorLeft = curX
+           
            #line-editing support
            if not _multiline and LineLen > 0:
                if Console.CursorLeft > len(CurrentPrompt):
@@ -580,7 +591,7 @@ Enter boo code in the prompt below (or type /help)."""
        WithColor color:
            for problem as duck in problems:
                markLocation(problem.LexicalInfo)
-               type = ("WARNING", "ERROR")[problem isa CompilerError]
+               type = ("ERROR" if problem isa CompilerError else "WARNING")
                Console.WriteLine("${type}: ${problem.Message}")
        return true

from boo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.