From 4007253649425ff37a503ea77cff2155ab9814ef Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Wed, 3 Feb 2021 22:08:14 -0500 Subject: fixed command line argument with / in it windows --- README.md | 7 ++++++- colors.h | 2 +- main.c | 8 +++++++- syntax.c | 1 - 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 57fce19..389b8e3 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,12 @@ a simple editor that starts up practically instantaneously, and performs well on ## Building from source -On Linux, run `make`; on Windows, run `make.bat`. +On Linux, run `make`. + +On Windows, you will need the SDL2 VC development libraries: https://www.libsdl.org/download-2.0.php +Copy SDL2-2.x.y into the ted directory, and rename it to SDL2. Additionally, copy SDL2\lib\x64\SDL2.dll +to the ted directory. +Then run `make.bat`. ## License diff --git a/colors.h b/colors.h index e2ac2af..28f9951 100644 --- a/colors.h +++ b/colors.h @@ -71,7 +71,7 @@ static ColorName const color_names[COLOR_COUNT] = { }; static ColorSetting color_setting_from_str(char const *str) { - // @OPTIM: sort color_names, binary search + // @OPTIMIZE: sort color_names, binary search for (int i = 0; i < COLOR_COUNT; ++i) { ColorName const *n = &color_names[i]; if (streq(n->name, str)) diff --git a/main.c b/main.c index 894ed85..e6c7d74 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,5 @@ // @TODO: -// - ensure buffer->filename never contains / on windows +// - popup to reload files and config on change // - split // - Windows installation #include "base.h" @@ -110,12 +110,18 @@ int main(int argc, char **argv) { switch (argc) { case 0: case 1: break; case 2: + // essentially, replace / with \ on windows. + for (char *p = argv[1]; *p; ++p) + if (strchr(ALL_PATH_SEPARATORS, *p)) + *p = PATH_SEPARATOR; starting_filename = argv[1]; break; default: fprintf(stderr, "Usage: %s [filename]\n", argv[0]); return EXIT_FAILURE; } + + SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1"); // if this program is sent a SIGTERM/SIGINT, don't turn it into a quit event if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) < 0) diff --git a/syntax.c b/syntax.c index 635beea..5d83cdb 100644 --- a/syntax.c +++ b/syntax.c @@ -418,7 +418,6 @@ static void syntax_highlight_python(SyntaxState *state, char32_t *line, u32 line break; case '\'': case '"': { - // @TODO: multi-line strings bool dbl_quoted = c == '"'; bool is_triple = i < line_len - 2 && line[i+1] == c && line[i+2] == c; -- cgit v1.2.3