summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--colors.c2
-rw-r--r--ds.h7
-rw-r--r--main.c2
-rw-r--r--os-win.c16
-rw-r--r--syntax.c4
-rw-r--r--text.c2
7 files changed, 24 insertions, 10 deletions
diff --git a/README.md b/README.md
index 0448170..2267ba7 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/colors.c b/colors.c
index e626b0f..3e704e9 100644
--- a/colors.c
+++ b/colors.c
@@ -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:
diff --git a/ds.h b/ds.h
index 86d8371..757c6f9 100644
--- a/ds.h
+++ b/ds.h
@@ -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;
diff --git a/main.c b/main.c
index ea0db56..642639e 100644
--- a/main.c
+++ b/main.c
@@ -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;
diff --git a/os-win.c b/os-win.c
index 8d751ff..3f93c53 100644
--- a/os-win.c
+++ b/os-win.c
@@ -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;
}
diff --git a/syntax.c b/syntax.c
index 53c2425..c7c4d6e 100644
--- a/syntax.c
+++ b/syntax.c
@@ -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];
diff --git a/text.c b/text.c
index 60bafd4..4e21143 100644
--- a/text.c
+++ b/text.c
@@ -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;