Compare commits

...

2 Commits

Author SHA1 Message Date
Krzosa Karol
beaf072740 Show dirty buffer in status window 2025-12-30 18:23:34 +01:00
Krzosa Karol
e5a028ff93 Misc refactor 2025-12-30 13:08:18 +01:00
5 changed files with 25 additions and 25 deletions

View File

@@ -2,6 +2,10 @@
! From a user (novice) point of view, how does it look like?
Use session 3:
- Maybe status view, commit changes (like to buffer name or line) on enter?
- Search over buffer directory, close search, quick enter buffer? Not sure if line, more general purpose
How to go about search/replace, opening code and other considerations
- We can use sed + find to search and replace, the automatic reopen should do the job
- Maybe also we can List all files recursively instead of opening them, how fast is that???
@@ -21,7 +25,6 @@ Debug session:
- Some bad allocating happening in Clipboard for sure
New UI Session
- Move CommandWindow hooks to hooks
- Cleanup String16/String with Open and EvalCommands after lua refactor
- Uneditable buffers ?
- Maybe marked allocations??? So that we can associate allocations with a buffer or view and then dealloc all at the same time
@@ -35,7 +38,6 @@ New UI Session
- DBBuffer
- 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
- Maybe fix OS layer returning with "/" at the end for directories
- Fix open code pattern

View File

@@ -763,7 +763,6 @@ void Command_Rename() {
String Coro_YesNoCancel(mco_coro *co, BSet main, String question) {
JumpTempBuffer(&main);
NextActiveWindowID = main.window->id;
RawAppendf(main.buffer, R"==(
%S

View File

@@ -109,7 +109,7 @@ View *WindowOpenBufferView(Window *new_parent_window, String name) {
}
Assert(window->active_view.id == view->id.id);
View *result = OpenBufferView(name);
View *result = OpenBufferView(name);
new_parent_window->active_view = result->id;
return result;
}

View File

@@ -45,28 +45,26 @@ void CommandWindowUpdate() {
ProfileFunction();
BSet active = GetBSet(ActiveWindowID);
if (active.window->id == CommandWindowID) {
if (!ProcessIsActive(active.view->id)) {
Scratch scratch;
String16 line_string = GetLineStringWithoutNL(active.buffer, 0);
if (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);
Scratch scratch;
String16 line_string = GetLineStringWithoutNL(active.buffer, 0);
if (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);
Buffer *scratch_buff = CreateScratchBuffer(scratch, active.buffer->cap);
RawAppend(scratch_buff, line_string);
For(IterateInReverse(&ratings)) {
String16 s = GetLineStringWithoutNL(active.buffer, it.index);
if (s.len == 0) continue;
RawAppend(scratch_buff, u"\n");
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;
Buffer *scratch_buff = CreateScratchBuffer(scratch, active.buffer->cap);
RawAppend(scratch_buff, line_string);
For(IterateInReverse(&ratings)) {
String16 s = GetLineStringWithoutNL(active.buffer, it.index);
if (s.len == 0) continue;
RawAppend(scratch_buff, u"\n");
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;
}
}
}

View File

@@ -78,7 +78,8 @@ void StatusWindowUpdate() {
const char *reopen = main.buffer->changed_on_disk ? " :Reopen" : "";
const char *case_sens = SearchCaseSensitive ? " C" : "";
const char *word_bound = SearchWordBoundary ? " W" : "";
String s = Format(scratch, " %S:%lld:%lld%s%s", main.buffer->name, (long long)xy.line + 1ll, (long long)xy.col + 1ll, case_sens, word_bound, reopen);
const char *dirty = main.buffer->dirty ? " !" : "";
String s = Format(scratch, " %S:%lld:%lld%s%s%s", main.buffer->name, (long long)xy.line + 1ll, (long long)xy.col + 1ll, dirty, case_sens, word_bound, reopen);
For (ActiveProcesses) {
if (it.view_id == main.view->id.id) {
s = Format(scratch, "%S %lld :KillProcess", s, (long long)it.id);