Misc refactor

This commit is contained in:
Krzosa Karol
2025-12-30 13:08:18 +01:00
parent 8270fe2542
commit e5a028ff93
2 changed files with 18 additions and 22 deletions

View File

@@ -21,7 +21,6 @@ Debug session:
- Some bad allocating happening in Clipboard for sure - Some bad allocating happening in Clipboard for sure
New UI Session New UI Session
- Move CommandWindow hooks to hooks
- Cleanup String16/String with Open and EvalCommands after lua refactor - Cleanup String16/String with Open and EvalCommands after lua refactor
- Uneditable buffers ? - Uneditable buffers ?
- Maybe marked allocations??? So that we can associate allocations with a buffer or view and then dealloc all at the same time - Maybe marked allocations??? So that we can associate allocations with a buffer or view and then dealloc all at the same time
@@ -35,7 +34,6 @@ New UI Session
- DBBuffer - DBBuffer
- 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
- 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
- Maybe fix OS layer returning with "/" at the end for directories - Maybe fix OS layer returning with "/" at the end for directories
- Fix open code pattern - Fix open code pattern

View File

@@ -45,28 +45,26 @@ void CommandWindowUpdate() {
ProfileFunction(); ProfileFunction();
BSet active = GetBSet(ActiveWindowID); BSet active = GetBSet(ActiveWindowID);
if (active.window->id == CommandWindowID) { if (active.window->id == CommandWindowID) {
if (!ProcessIsActive(active.view->id)) { Scratch scratch;
Scratch scratch; String16 line_string = GetLineStringWithoutNL(active.buffer, 0);
String16 line_string = GetLineStringWithoutNL(active.buffer, 0); if (active.view->prev_search_line != line_string) {
if (active.view->prev_search_line != line_string) { active.view->prev_search_line = line_string;
active.view->prev_search_line = line_string; Array<FuzzyPair> ratings = FuzzySearchLines(scratch, active.buffer, 1, active.buffer->line_starts.len, line_string);
Array<FuzzyPair> ratings = FuzzySearchLines(scratch, active.buffer, 1, active.buffer->line_starts.len, line_string);
Buffer *scratch_buff = CreateScratchBuffer(scratch, active.buffer->cap); Buffer *scratch_buff = CreateScratchBuffer(scratch, active.buffer->cap);
RawAppend(scratch_buff, line_string); RawAppend(scratch_buff, line_string);
For(IterateInReverse(&ratings)) { For(IterateInReverse(&ratings)) {
String16 s = GetLineStringWithoutNL(active.buffer, it.index); String16 s = GetLineStringWithoutNL(active.buffer, it.index);
if (s.len == 0) continue; if (s.len == 0) continue;
RawAppend(scratch_buff, u"\n"); RawAppend(scratch_buff, u"\n");
RawAppend(scratch_buff, s); RawAppend(scratch_buff, s);
}
Caret caret = active.view->carets[0];
SaveCaretHistoryBeforeBeginEdit(active.buffer, active.view->carets);
SelectEntireBuffer(active.view);
Replace(active.view, GetString(scratch_buff));
active.view->carets[0] = caret;
} }
Caret caret = active.view->carets[0];
SaveCaretHistoryBeforeBeginEdit(active.buffer, active.view->carets);
SelectEntireBuffer(active.view);
Replace(active.view, GetString(scratch_buff));
active.view->carets[0] = caret;
} }
} }
} }