diff --git a/src/text_editor/buffer.cpp b/src/text_editor/buffer.cpp index 6711d6a..e966e87 100644 --- a/src/text_editor/buffer.cpp +++ b/src/text_editor/buffer.cpp @@ -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) { #if PLUGIN_DIRECTORY_NAVIGATION if (buffer->is_dir) { diff --git a/src/text_editor/commands.cpp b/src/text_editor/commands.cpp index 6869447..184d0d2 100644 --- a/src/text_editor/commands.cpp +++ b/src/text_editor/commands.cpp @@ -1,3 +1,5 @@ + + View *GetViewForFixingWhenBufferCommand(Buffer *buffer, bool *is_active = NULL) { View *view = NULL; 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 ... void CMD_FormatSelection() { Scratch scratch; diff --git a/src/text_editor/plugin_search_window.cpp b/src/text_editor/plugin_search_window.cpp index 5639f1e..718e8d8 100644 --- a/src/text_editor/plugin_search_window.cpp +++ b/src/text_editor/plugin_search_window.cpp @@ -1,3 +1,5 @@ +Int SearchBufferChangeID; + void CMD_Search() { BSet main = GetBSet(ActiveWindowID); String16 string = {}; @@ -13,6 +15,7 @@ void CMD_Search() { Replace(set.view, string); SelectEntireBuffer(set.view); } + SearchBufferChangeID = set.buffer->change_id; } RegisterCommand(CMD_Search, "ctrl-f", "Open up a search window"); 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); } -Int SearchBufferChangeID; void UpdateSearchWindow() { if (ActiveWindowID == SearchWindowID) { BSet active = GetBSet(ActiveWindowID);