@lepinekong_twitter My previous suggestion for writing
history into file was inaccurate - it was getting history from latest to oldes, i.e. in reversed form. To get it in right order you have to reverse it beforehand. But as
reverse is modyfying command you have to
copy the history:
write/lines %history.tmp reverse copy system/console/history
To get only part of history use
copy/part system/console/history <length>. <length> may be integer! to get number of lines or,
if you want to copy from certain command, use
copy/part hist: system/console/history find hist "do %accordion.red".
To get history until certain point you ccan use
at, if you know until which line or how many line you want to get:
; e.g. until line 2, i.e. without the most recent (current) command copy at system/console/history 2 ; e.g. 10 lines from certain command found: find hist "do %accordion.red" copy/part at hist: system/console/history (index? found) - 10 found ; e.g. 10 lines from 30th command forth copy/part at system/console/history 30 - 10 10
For getting history directly into clipboard or console I didn't concieve other means than using concat:
write-clipboard copy concat reverse copy system/console/history newline
But beware, writing this to clipboard may put a huge string into your history entry, which may stall your console if you scroll backwards through history.
And finally to just print part of it on console:
print copy concat reverse copy/part system/console/history 10 newline
concat you can first
write/lines and then
read it, to get history with newlines.
There are many more ways to play with history, e.g.
probe concat take/part system/console/history 5 newline
Occasionally your history may become corrupt in the process though. :wink:
system/console/history: nodoesn't seem to break anything.
> gui-console-ctx/cfg/history == ["gui-console-ctx/cfg/history" "gui-console-ctx/history" "system/console/history" "... >> gui-console-ctx/terminal/history == ["gui-console-ctx/terminal/history" "gui-console-ctx/cfg/history" "gui-console-ctx/... >> system/console/history == false
... "dynamic" [ button "add" [ "some code here" ] text "1" field "#FF00C8" text "2" field "#FF00C8" ] ...
@GiuseppeChillemi they are the same (unless I don't know something):
a: [a b] ;== [a ; b ;] aa: [a b] ; == [a b] a = aa ; == true
if you want to add newline (I guess that what you mean by
CR) then you can just add newline in your code (hit enter):
a: [a] ; == [a] append a [ b] ;== [a ; b ;]
However certain operations may delete newlines. You can check and set/clear newlines manually using
arr: [a b c] ; [a b c] arr: next arr ; [b c] new-line? arr ; false new-line arr on ; on = true ; [ ; b c ; ] new-line? arr ; true head arr ; [a ; b c ; ]
foreachwon't work because it gives you element of the series. The element doesn't hold information about new-line markers.