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