Libraryless. Click here for Pure Java version (10141L/67K/235K).
!7 !include #1006440 // Concepts static double maxSleepTime = 2; // compress pauses to this time (seconds) static Session session; static JTextArea ta; static int caretPos; // Reorder caret moves & edits p { loadConceptsFrom(#1006438); print("Sessions: " + collectField('id, list(Session))); session = latest(Session); if (session == null) { print("Editor has not been run yet"); ret; } L<Event> events = sortConceptsByID(findBackRefs(Event, session)); print("Using session " + session.id + " with " + n(events, "events")); ta = showText(""); S text = ""; long time = session.created; setFrameTitle(ta, "Replaying"); for (Event e : events) { print(sfu(e)); long sleepTime = min(toMS(maxSleepTime), e.created-time); time = e.created; sleep(sleepTime); if (e << EChange) { text = replayEdit(e/EChange, text); setText(ta, text); if (caretPos != 0 && setCaretIfPossible(ta, caretPos)) caretPos = 0; } else if (e << ECaret) { int pos = e/ECaret.pos; if (!setCaretIfPossible(ta, pos)) caretPos = pos; } else print("Ignoring unknown event type: " + e); } setFrameTitle(ta, "Replay Done"); }
Began life as a copy of #1006438
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006441 |
Snippet name: | WORKS: Replay Last Session From Auto-Saving Text Editor |
Eternal ID of this version: | #1006441/7 |
Text MD5: | b1119bb8755e676d54fed67ae913ba54 |
Transpilation MD5: | 2cfa2f33edc8c1cbdf687f4226915ebc |
Author: | stefan |
Category: | javax / tools |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-03-25 16:30:36 |
Source code size: | 1249 bytes / 44 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 737 / 942 |
Version history: | 6 change(s) |
Referenced in: | [show references] |