Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ if(TD_BUILD_TESTS)
set_target_properties(test_console_access PROPERTIES C_STANDARD 11 C_STANDARD_REQUIRED ON)
target_compile_options(test_console_access PRIVATE ${TD_WARNINGS})
add_test(NAME test_console_access COMMAND test_console_access)
foreach(t test_utf8 test_input test_render test_vterm test_wm)
foreach(t test_utf8 test_input test_render test_vterm test_wm test_widgets)
add_executable(${t} tests/${t}.c)
target_link_libraries(${t} PRIVATE tinydesk_core)
set_target_properties(${t} PROPERTIES C_STANDARD 11)
Expand All @@ -251,4 +251,9 @@ if(TD_BUILD_TESTS)
set_target_properties(test_proto PROPERTIES C_STANDARD 11)
target_compile_options(test_proto PRIVATE ${TD_WARNINGS})
add_test(NAME test_proto COMMAND test_proto)
add_executable(test_editor tests/test_editor.c)
target_link_libraries(test_editor PRIVATE tinydesk_apps)
set_target_properties(test_editor PROPERTIES C_STANDARD 11)
target_compile_options(test_editor PRIVATE ${TD_WARNINGS})
add_test(NAME test_editor COMMAND test_editor)
endif()
4 changes: 3 additions & 1 deletion apps/editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,9 @@ static bool save_to(const char *path)
set_status("Save failed");
return false;
}
snprintf(E.path, sizeof(E.path), "%s", path);
/* save() passes E.path itself; copying a string onto itself is
* undefined (glibc empties it, and the next save asks for a name). */
if (path != E.path) snprintf(E.path, sizeof(E.path), "%s", path);
if (E.undo) {
E.undo->saved = E.undo->top;
E.undo->merge = false; /* typing after a save is a new step */
Expand Down
Loading
Loading