full history API implemented
[CleanReadLine.git] / ReadLine.icl
index 4faf3ba..64a7fa4 100644 (file)
@@ -179,6 +179,30 @@ historyTotalBytes e = code {
        }
 
 //Moving Around the History List
+historySetPos :: !Int !*env -> (!Int, !*env)
+historySetPos i e = code {
+               ccall cleanHistorySetPos "I:I:A"
+       }
+
+previousHistory :: !*env -> (!Maybe HistoryItem, !*env)
+previousHistory e
+# (line, timestamp, null, e) = previousHistoryItem e
+= (if null Nothing (Just {HistoryItem | line=line, timestamp=timestamp}), e)
+       where
+               previousHistoryItem :: !*env -> (!String, !String, !Bool, !*env)
+               previousHistoryItem e = code {
+                               ccall cleanPreviousHistory ":VSSI:A"
+                       }
+
+nextHistory :: !*env -> (!Maybe HistoryItem, !*env)
+nextHistory e
+# (line, timestamp, null, e) = nextHistoryItem e
+= (if null Nothing (Just {HistoryItem | line=line, timestamp=timestamp}), e)
+       where
+               nextHistoryItem :: !*env -> (!String, !String, !Bool, !*env)
+               nextHistoryItem e = code {
+                               ccall cleanNextHistory ":VSSI:A"
+                       }
 
 //Searching the History List
 historySearch :: !String !Int !*env-> (!Int, !*env)