2021-02-19 11:27:27 +01:00
|
|
|
import jale/plugin/defaults
|
2021-02-24 00:31:58 +01:00
|
|
|
import jale/plugin/viewprotector
|
2021-02-19 11:27:27 +01:00
|
|
|
import jale/editor
|
|
|
|
import jale/templates
|
|
|
|
import jale/multiline
|
2021-02-18 21:31:03 +01:00
|
|
|
|
|
|
|
import terminal
|
2021-02-19 11:27:27 +01:00
|
|
|
import strutils
|
2021-02-18 21:51:44 +01:00
|
|
|
import os
|
2021-02-18 21:31:03 +01:00
|
|
|
|
2021-02-18 21:51:44 +01:00
|
|
|
eraseScreen()
|
|
|
|
setCursorPos(stdout, 0,0)
|
2021-02-18 21:31:03 +01:00
|
|
|
let e = newLineEditor()
|
2021-02-18 21:51:44 +01:00
|
|
|
if paramCount() > 0:
|
|
|
|
let arg = paramStr(1)
|
|
|
|
if fileExists(arg):
|
2021-02-18 22:25:13 +01:00
|
|
|
e.content = readFile(arg).fromString()
|
2021-02-18 22:27:36 +01:00
|
|
|
|
|
|
|
var save = false
|
2021-02-18 21:51:44 +01:00
|
|
|
e.bindKey("ctrl+s"):
|
|
|
|
e.finish()
|
2021-02-18 22:27:36 +01:00
|
|
|
save = true
|
|
|
|
|
2021-02-18 21:31:03 +01:00
|
|
|
e.prompt = ""
|
2021-02-19 15:58:35 +01:00
|
|
|
e.populateDefaults(enterSubmits = false, ctrlForVerticalMove = false)
|
2021-02-24 00:31:58 +01:00
|
|
|
e.setViewBehavior(vbFullscreen)
|
2021-02-21 00:44:56 +01:00
|
|
|
e.scrollMode = sbAllScroll
|
2021-02-18 21:51:44 +01:00
|
|
|
let result = e.read()
|
2021-02-18 22:27:36 +01:00
|
|
|
if save and paramCount() > 0:
|
2021-02-18 21:51:44 +01:00
|
|
|
writeFile(paramStr(1), result)
|
2021-02-18 21:31:03 +01:00
|
|
|
|