Fix ctrl-f immediate jump when selecting a word

This commit is contained in:
Krzosa Karol
2026-01-25 09:05:07 +01:00
parent f3e709f07c
commit 88dbfb1a6c
3 changed files with 14 additions and 10 deletions

View File

@@ -1576,6 +1576,15 @@ void SaveBuffer(Buffer *buffer) {
} }
} }
void SaveAll() {
For(Buffers) {
// NOTE: file_mod_time is only set when buffer got read or written to disk already so should be saved
if (it->file_mod_time && it->dirty) {
SaveBuffer(it);
}
}
}
String GetDirectory(Buffer *buffer) { String GetDirectory(Buffer *buffer) {
#if PLUGIN_DIRECTORY_NAVIGATION #if PLUGIN_DIRECTORY_NAVIGATION
if (buffer->is_dir) { if (buffer->is_dir) {

View File

@@ -1,3 +1,5 @@
View *GetViewForFixingWhenBufferCommand(Buffer *buffer, bool *is_active = NULL) { View *GetViewForFixingWhenBufferCommand(Buffer *buffer, bool *is_active = NULL) {
View *view = NULL; View *view = NULL;
if (is_active) { if (is_active) {
@@ -176,15 +178,6 @@ void ApplyFormattingTool(Buffer *buffer, String tool) {
} }
} }
void SaveAll() {
For(Buffers) {
// NOTE: file_mod_time is only set when buffer got read or written to disk already so should be saved
if (it->file_mod_time && it->dirty) {
SaveBuffer(it);
}
}
}
// @todo: plugin_languages ? and then branch out language_cpp ... // @todo: plugin_languages ? and then branch out language_cpp ...
void CMD_FormatSelection() { void CMD_FormatSelection() {
Scratch scratch; Scratch scratch;

View File

@@ -1,3 +1,5 @@
Int SearchBufferChangeID;
void CMD_Search() { void CMD_Search() {
BSet main = GetBSet(ActiveWindowID); BSet main = GetBSet(ActiveWindowID);
String16 string = {}; String16 string = {};
@@ -13,6 +15,7 @@ void CMD_Search() {
Replace(set.view, string); Replace(set.view, string);
SelectEntireBuffer(set.view); SelectEntireBuffer(set.view);
} }
SearchBufferChangeID = set.buffer->change_id;
} RegisterCommand(CMD_Search, "ctrl-f", "Open up a search window"); } RegisterCommand(CMD_Search, "ctrl-f", "Open up a search window");
void SearchWindowFindNext(bool forward = true) { void SearchWindowFindNext(bool forward = true) {
@@ -89,7 +92,6 @@ void LayoutSearchWindow(Rect2I *rect, int16_t wx, int16_t wy) {
window->line_numbers_rect = CutLeft(&window->document_rect, window->font->char_spacing * 6); window->line_numbers_rect = CutLeft(&window->document_rect, window->font->char_spacing * 6);
} }
Int SearchBufferChangeID;
void UpdateSearchWindow() { void UpdateSearchWindow() {
if (ActiveWindowID == SearchWindowID) { if (ActiveWindowID == SearchWindowID) {
BSet active = GetBSet(ActiveWindowID); BSet active = GetBSet(ActiveWindowID);