Optimized code runner and implemented basic IDE feature in app.ed
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
from deck.input import input
|
||||
from deck.pager import print_paged
|
||||
from deck.runtime import runcode
|
||||
|
||||
class Ed:
|
||||
def __init__(self, filename=None):
|
||||
@@ -191,6 +192,11 @@ class Ed:
|
||||
self.filename = params
|
||||
print(self.filename if self.filename else "No current filename")
|
||||
|
||||
elif cmd_char == 'x': # execute current buffer range as Python code
|
||||
code = '\n'.join(self.buffer[start-1:end])
|
||||
print(f'Running lines {start} to {end} as Python code...')
|
||||
runcode(code)
|
||||
|
||||
else:
|
||||
print("Unknown command")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user