Fix automatic buffer reopen, modifying ctrl-left/right semantics inline with vscode/sublime, modifying load word semantics

This commit is contained in:
Krzosa Karol
2026-01-04 18:28:55 +01:00
parent 04e5642ce3
commit a7afdac4fa
4 changed files with 80 additions and 24 deletions

View File

@@ -364,7 +364,7 @@ void OnCommand(Event event) {
caret.ifront = 1;
}
} else if (event.clicks >= 2 && InBounds({caret.range.min - 1, caret.range.max + 1}, p)) {
Range range = EncloseWord(active.buffer, p);
Range range = EncloseLoadWord(active.buffer, p);
if (event.clicks >= 3) {
range = EncloseFullLine(active.buffer, p);
}
@@ -477,6 +477,18 @@ void GarbageCollect() {
ProfileFunction();
Allocator sys_allocator = GetSystemAllocator();
For(Buffers) {
if (it->file_mod_time) {
int64_t new_file_mod_time = GetFileModTime(it->name);
if (it->file_mod_time != new_file_mod_time) {
it->changed_on_disk = true;
if (it->dirty == false) {
ReopenBuffer(it);
}
}
}
}
IterRemove(Views) {
IterRemovePrepare(Views);
@@ -655,19 +667,6 @@ void Update(Event event) {
}
}
For(Buffers) {
if (it->file_mod_time) {
int64_t new_file_mod_time = GetFileModTime(it->name);
if (it->file_mod_time != new_file_mod_time) {
it->changed_on_disk = true;
if (it->dirty == false) {
ReopenBuffer(it);
}
}
}
}
GarbageCollect();
}