From d4d2f52ec13a3c5cfea2cdce2d09777317de3545 Mon Sep 17 00:00:00 2001 From: Productive2 <48047721+Productive2@users.noreply.github.com> Date: Fri, 26 Feb 2021 14:23:53 +0100 Subject: [PATCH] fix history bug, add jale.nim for version info --- src/jale.nim | 1 + src/jale/plugin/editor_history.nim | 1 + src/jale/plugin/history.nim | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 src/jale.nim diff --git a/src/jale.nim b/src/jale.nim new file mode 100644 index 0000000..eec8e75 --- /dev/null +++ b/src/jale.nim @@ -0,0 +1 @@ +const jaleVersion = "0.1" diff --git a/src/jale/plugin/editor_history.nim b/src/jale/plugin/editor_history.nim index ddb9484..99957ea 100644 --- a/src/jale/plugin/editor_history.nim +++ b/src/jale/plugin/editor_history.nim @@ -10,6 +10,7 @@ proc plugHistory*(ed: LineEditor): History = # after reading finished, it adds to history # before reading, it adds the temporary input to the history let hist = newHistory() + ed.bindEvent(jeFinish): hist.clean() hist.newEntry(ed.content) diff --git a/src/jale/plugin/history.nim b/src/jale/plugin/history.nim index 0d8aee1..f5039bf 100644 --- a/src/jale/plugin/history.nim +++ b/src/jale/plugin/history.nim @@ -68,7 +68,10 @@ proc clean*(h: History) = h.lowestTouchedIndex = h.elements.len() proc newEntry*(h: History, ml: Multiline, temp: bool = false) = - h.elements.add(HistoryElement(original: ml, current: ml.copy(), temp: temp)) + if not temp: + h.elements.add(HistoryElement(original: ml, current: ml.copy(), temp: temp)) + else: + h.elements.add(HistoryElement(original: ml, current: ml, temp: temp)) proc save*(h: History, path: string) = # discards currents and temps, only saves originals