Add macros
This commit is contained in:
@@ -65,6 +65,8 @@ Vec2I MouseMiddleAnchor;
|
||||
|
||||
RandomSeed UniqueBufferNameSeed = {};
|
||||
Array<Event> EventPlayback;
|
||||
Array<Event> MacroPlayback;
|
||||
bool RecordingMacro = false;
|
||||
BlockArena Perm;
|
||||
|
||||
// clipboard
|
||||
|
||||
@@ -253,3 +253,21 @@ void CMD_ClearCarets() {
|
||||
active.view->carets.len = 1;
|
||||
active.view->carets[0] = MakeCaret(GetFront(active.view->carets[0]));
|
||||
} RegisterCommand(CMD_ClearCarets, "escape", "Clear all carets and reset to 1 caret, also do some windowing stuff that closes things on escape");
|
||||
|
||||
void CMD_ToggleMacroRecording() {
|
||||
if (RecordingMacro) {
|
||||
RecordingMacro = false;
|
||||
Pop(&MacroPlayback); // Remove the ctrl-m from macro playback thing
|
||||
} else {
|
||||
RecordingMacro = true;
|
||||
MacroPlayback.len = 0;
|
||||
}
|
||||
} RegisterCommand(CMD_ToggleMacroRecording, "ctrl-m", "Start recording a macro");
|
||||
|
||||
void CMD_PlayMacro() {
|
||||
if (RecordingMacro) {
|
||||
return;
|
||||
}
|
||||
|
||||
For (MacroPlayback) Add(&EventPlayback, it);
|
||||
} RegisterCommand(CMD_PlayMacro, "alt-m", "Start playing back a macro recording");
|
||||
@@ -48,7 +48,7 @@
|
||||
- [ ] Undo kinds (to enable history in fuzzy buffers)
|
||||
- [ ] Add undo kind. Snapshot kind, so that history is possible in weird buffers without paying a huge memory cost. The idea is that we would store the exact buffer state to replace with, editor would just save history of first line etc.
|
||||
|
||||
- [ ] Macros
|
||||
- [x] Macros
|
||||
- [ ] Regex
|
||||
- [ ] ctags based indexing
|
||||
- [ ] WordComplete
|
||||
@@ -874,6 +874,9 @@ void MainLoop() {
|
||||
FrameEvents.len = 0;
|
||||
GetEventsForFrame(&FrameEvents);
|
||||
For (FrameEvents) {
|
||||
if (RecordingMacro) {
|
||||
Add(&MacroPlayback, it);
|
||||
}
|
||||
#if PLUGIN_RECORD_EVENTS
|
||||
if (it.kind != EVENT_UPDATE && !Testing) {
|
||||
Serialize(EventBuffer, &it);
|
||||
|
||||
Reference in New Issue
Block a user