diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | colors.c | 2 | ||||
-rw-r--r-- | ds.h | 7 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | os-win.c | 16 | ||||
-rw-r--r-- | syntax.c | 4 | ||||
-rw-r--r-- | text.c | 2 |
7 files changed, 24 insertions, 10 deletions
@@ -322,6 +322,7 @@ Then, open windows\_installer\\ted\\ted.sln, and build. <tr><td>2.4.1</td> <td>JSX highlighting fix, Windows DPI awareness</td> <td>2023 Jul 20</td></tr> <tr><td>2.4.2</td> <td>Fix font absolute paths</td> <td>2023 Jul 21</td></tr> <tr><td>2.4.3</td> <td>Some font related fixes</td> <td>2023 Aug 1</td></tr> +<tr><td>2.5</td> <td>Rename symbol, document links, bug fixes</td> <td>2023 Aug 15</td></tr> </table> ## License @@ -100,7 +100,7 @@ const char *color_setting_to_str(ColorSetting s) { // converts #rrggbb/#rrggbbaa to a color. returns false if it's not in the right format. Status color_from_str(const char *str, u32 *color) { - uint r = 0, g = 0, b = 0, a = 0xff; + u32 r = 0, g = 0, b = 0, a = 0xff; bool success = false; switch (strlen(str)) { case 4: @@ -222,11 +222,14 @@ static i32 arr_index_of_(void *arr, size_t member_size, const void *item) { static void *arr_remove_multiple_(void *arr, size_t member_size, size_t index, size_t count) { ArrHeader *hdr = arr_hdr_(arr); - assert(index < hdr->len); + u32 old_len = hdr->len; + if (index >= old_len) return arr; + if (count > old_len - index) + count = old_len - index; memmove((char *)arr + index * member_size, (char *)arr + (index + count) * member_size, (hdr->len - (index + count)) * member_size); - hdr->len -= count; + hdr->len -= (u32)count; if (hdr->len == 0) { free(hdr); return NULL; @@ -353,7 +353,7 @@ int main(int argc, char **argv) { wchar_t *appdata = NULL; KNOWNFOLDERID id = FOLDERID_LocalAppData; if (SHGetKnownFolderPath(&id, 0, NULL, &appdata) == S_OK) { - strbuf_printf(ted->local_data_dir, "%ls" PATH_SEPARATOR_STR "ted", appdata); + strbuf_printf(ted->local_data_dir, "%ls%cted", appdata, PATH_SEPARATOR); CoTaskMemFree(appdata); } id = FOLDERID_Profile; @@ -6,7 +6,7 @@ #include <sys/stat.h> #include <io.h> #include <sysinfoapi.h> - +#include <direct.h> static FsType windows_file_attributes_to_type(DWORD attrs) { if (attrs == INVALID_FILE_ATTRIBUTES) @@ -43,7 +43,7 @@ FsDirectoryEntry **fs_list_directory(const char *dirname) { HANDLE fhandle; assert(*dirname); sprintf_s(file_pattern, sizeof file_pattern, "%s%s*", dirname, - dirname[strlen(dirname) - 1] == PATH_SEPARATOR ? "" : PATH_SEPARATOR_STR); + strchr(ALL_PATH_SEPARATORS, dirname[strlen(dirname) - 1]) ? "" : "\\"); wchar_t wide_pattern[4100] = {0}; if (MultiByteToWideChar(CP_UTF8, 0, file_pattern, -1, wide_pattern, arr_count(wide_pattern)) == 0) return NULL; @@ -414,7 +414,17 @@ int process_check_status(Process **pprocess, ProcessExitInfo *info) { bool open_with_default_application(const char *path) { - todo ShellExecuteW? + WCHAR wide_path[4100]; + if (MultiByteToWideChar(CP_UTF8, 0, path, -1, wide_path, arr_count(wide_path)) == 0) + return false; + return (u64)ShellExecuteW( + NULL, + L"open", + wide_path, + NULL, + NULL, + 0 + ) > 32; } @@ -720,7 +720,7 @@ static void syntax_highlight_python(SyntaxState *state, const char32_t *line, u3 bool string_is_dbl_quoted = (*state & SYNTAX_STATE_PYTHON_STRING_DBL_QUOTED) != 0; bool string_is_multiline = true; bool in_number = false; - uint backslashes = 0; + u32 backslashes = 0; for (u32 i = 0; i < line_len; ++i) { char32_t c = line[i]; @@ -1356,7 +1356,7 @@ static void syntax_highlight_javascript_like( bool string_is_regex = false; bool in_number = false; bool in_string = string_is_template; - uint backslashes = 0; + u32 backslashes = 0; for (u32 i = 0; i < line_len; ++i) { char32_t c = line[i]; @@ -265,7 +265,7 @@ Font *text_font_load(const char *ttf_filename, float font_size) { u32 file_size = (u32)ftell(ttf_file); fseek(ttf_file, 0, SEEK_SET); if (file_size >= (50UL<<20)) { // fonts aren't usually bigger than 50 MB - text_set_err("Font file too big (%u megabytes).", (uint)(file_size >> 20)); + text_set_err("Font file too big (%u megabytes).", (unsigned)(file_size >> 20)); } u8 *file_data = NULL; |