mirror of https://github.com/japl-lang/jale.git
updated todo; cleaned up defaults
This commit is contained in:
parent
e48cae8774
commit
49fa8ab937
37
defaults.nim
37
defaults.nim
|
@ -5,48 +5,33 @@ import event
|
|||
import tables
|
||||
import templates
|
||||
|
||||
# default populate
|
||||
proc defInsert(editor: LineEditor) =
|
||||
proc populateDefaults*(editor: LineEditor) =
|
||||
editor.bindEvent(jeKeypress):
|
||||
if editor.lastKeystroke > 31 and editor.lastKeystroke < 127:
|
||||
let ch = char(editor.lastKeystroke)
|
||||
editor.content.insert($ch)
|
||||
|
||||
proc defControl(editor: LineEditor) =
|
||||
block control:
|
||||
template check(key: string, blk: untyped) =
|
||||
if editor.lastKeystroke == keysByName[key]:
|
||||
blk
|
||||
break control
|
||||
check("left"):
|
||||
editor.bindKey("left"):
|
||||
editor.content.left()
|
||||
check("right"):
|
||||
editor.bindKey("right"):
|
||||
editor.content.right()
|
||||
check("up"):
|
||||
editor.bindKey("up"):
|
||||
editor.content.up()
|
||||
check("down"):
|
||||
editor.bindKey("down"):
|
||||
editor.content.down()
|
||||
check("backspace"):
|
||||
editor.bindKey("backspace"):
|
||||
editor.content.backspace()
|
||||
check("delete"):
|
||||
editor.bindKey("delete"):
|
||||
editor.content.delete()
|
||||
check("enter"):
|
||||
editor.bindKey("enter"):
|
||||
if editor.content.Y() == editor.content.high() and editor.content.getLine(editor.content.high()) == "":
|
||||
editor.finish()
|
||||
else:
|
||||
editor.content.insertline()
|
||||
check("ctrl+c"):
|
||||
editor.bindKey("ctrl+c"):
|
||||
editor.finish()
|
||||
editor.events.call(jeQuit)
|
||||
check("ctrl+d"):
|
||||
editor.bindKey("ctrl+d"):
|
||||
if editor.content.getContent() == "":
|
||||
editor.finish()
|
||||
editor.events.call(jeQuit)
|
||||
|
||||
proc defLog(editor: LineEditor) =
|
||||
echo editor.lastKeystroke
|
||||
|
||||
proc populateDefaults*(editor: LineEditor) =
|
||||
editor.bindEvent(jeKeypress):
|
||||
editor.defInsert()
|
||||
editor.defControl()
|
||||
|
||||
|
|
9
todo.md
9
todo.md
|
@ -1,20 +1,15 @@
|
|||
Soon:
|
||||
|
||||
Horizontal scrolling for the current line in render
|
||||
Add new keycodes (enter, ctrl+h, ctrl+j?)
|
||||
Add a way to hook for the quit event (ctrl+c or ctrl+d auto triggers in default)
|
||||
Move arrow keys to per-key events/create template that hooks by name
|
||||
create template that hooks any key
|
||||
|
||||
Multiline editing:
|
||||
|
||||
- when moving up/down render should re-render the line to reset horizontal scrolling
|
||||
- vertical scrolling
|
||||
|
||||
Other stuff:
|
||||
|
||||
- move codebase into multiple modules to ensure modularity (move away defaults and anything that can be submodules (keycodes) e.g.)
|
||||
- tab completion into the defaults
|
||||
- new events such as pre-terminate, pre-return, pre-render (filter)
|
||||
|
||||
- filters (for syntax highlighting)
|
||||
|
||||
Done:
|
||||
|
|
Loading…
Reference in New Issue