When coroutines active don't wait

This commit is contained in:
krzosa
2025-12-23 09:41:03 +01:00
parent c67db4e495
commit 74ae806978
6 changed files with 5 additions and 18 deletions

View File

@@ -8,28 +8,13 @@
- Maybe 2 windows? - Maybe 2 windows?
- Guide on the first page for new users with links to configs, tutorials - Guide on the first page for new users with links to configs, tutorials
- Window, View, Buffer + flags design (or is completely new kind based approach needed for Windows/Views?)
- How to make non-editable, informative, with different font size, title bar. Which might also contain tabs
- How to design clickable tree view in this way?
- How to design Command view?
- How to design popup view (input field)?
- How to design search view? or search and replace view?
Splits:
- Why constraint that name of buffer needs to be unique? For Open() and default behavior but is this required? - Why constraint that name of buffer needs to be unique? For Open() and default behavior but is this required?
- Try to add Tracking Allocator and rewrite the app, free all memory at the end of the app and check all is well - Try to add Tracking Allocator and rewrite the app, free all memory at the end of the app and check all is well
Commands TODO: Commands TODO:
- Search
- Ctrl + F
- Next occurence: Enter
- Prev occurence: Shift + Enter
- next occurence: F3
- prev occurence: Shift + F3
- Console: OK concept but constrain - Console: OK concept but constrain
- Turned off by default - Turned off by default
- Special: non editable, hotkeys don't work etc. - Special: non editable, hotkeys don't work etc.
- I'M SETTING ACTIVE WINDOW AFTER COMMAND!!! DO WE CONTINUE WITH THIS?
- CONSIDER AUTOMATING: CheckpointBeforeGoto - CONSIDER AUTOMATING: CheckpointBeforeGoto
- GotoBackward how to handle that in case we want to automate and create on every move? - GotoBackward how to handle that in case we want to automate and create on every move?

View File

@@ -675,7 +675,7 @@ void Coro_OpenCode(mco_coro *co) {
} }
if ((i%16) == 0) { if ((i%32) == 0) {
CoYield(co); CoYield(co);
} }
i += 1; i += 1;

View File

@@ -1,5 +1,4 @@
typedef void CoroutineProc(mco_coro *co); typedef void CoroutineProc(mco_coro *co);
Array<mco_coro *> ActiveCoroutines;
mco_coro *CoAdd(CoroutineProc *proc) { mco_coro *CoAdd(CoroutineProc *proc) {
mco_desc desc = mco_desc_init(proc, 0); mco_desc desc = mco_desc_init(proc, 0);

View File

@@ -465,6 +465,7 @@ inline void AddEvent(Array<Event> *events, Event ev) {
} }
Array<Event> GetEventsForFrame(Allocator allocator) { Array<Event> GetEventsForFrame(Allocator allocator) {
ProfileFunction();
Array<Event> result = {allocator}; Array<Event> result = {allocator};
if (EventPlayback.len) { if (EventPlayback.len) {
result = TightCopy(allocator, EventPlayback); result = TightCopy(allocator, EventPlayback);

View File

@@ -81,6 +81,7 @@ Array<Variable> Variables;
Array<Process> ActiveProcesses = {}; Array<Process> ActiveProcesses = {};
Array<String> ProcessEnviroment = {}; Array<String> ProcessEnviroment = {};
Array<mco_coro *> ActiveCoroutines;
/////////////////////////////// ///////////////////////////////

View File

@@ -605,13 +605,14 @@ void MainLoop() {
} }
WaitForEvents = ConfigWaitForEvents; WaitForEvents = ConfigWaitForEvents;
if (IsDocumentSelectionValid() || IsScrollbarSelectionValid() || ActiveProcesses.len) { if (IsDocumentSelectionValid() || IsScrollbarSelectionValid() || ActiveProcesses.len || ActiveCoroutines.len) {
WaitForEvents = false; WaitForEvents = false;
} }
// This shouldn't matter to the state of the program, only appearance for // This shouldn't matter to the state of the program, only appearance for
// the user // the user
{ {
ProfileScope(SetWindowTitle);
Window *window = GetActiveWind(); Window *window = GetActiveWind();
View *view = GetView(window->active_view); View *view = GetView(window->active_view);
Buffer *buffer = GetBuffer(view->active_buffer); Buffer *buffer = GetBuffer(view->active_buffer);