diff options
author | pommicket <pommicket@gmail.com> | 2025-09-28 00:45:33 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-09-28 00:46:21 -0400 |
commit | 3c9e139aec08d1bb406a6219122ca982b4b7dc34 (patch) | |
tree | 4d7993152bbb76f1d8b7df6de45fb032332b94d0 | |
parent | e78bf3013ddb588638a93bed1f6eff4d0beb5106 (diff) |
Remove trailing white space in source files
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | base.h | 2 | ||||
-rw-r--r-- | buffer.c | 4 | ||||
-rw-r--r-- | command.c | 4 | ||||
-rw-r--r-- | config.c | 6 | ||||
-rw-r--r-- | ds.h | 4 | ||||
-rw-r--r-- | find.c | 6 | ||||
-rw-r--r-- | ide-autocomplete.c | 8 | ||||
-rw-r--r-- | ide-definitions.c | 2 | ||||
-rw-r--r-- | ide-hover.c | 2 | ||||
-rw-r--r-- | ide-usages.c | 2 | ||||
-rw-r--r-- | lib/glcorearb.h | 2 | ||||
-rw-r--r-- | lsp-parse.c | 2 | ||||
-rw-r--r-- | lsp-write.c | 2 | ||||
-rw-r--r-- | lsp.c | 4 | ||||
-rw-r--r-- | lsp.h | 4 | ||||
-rw-r--r-- | main.c | 10 | ||||
-rw-r--r-- | make.bat | 4 | ||||
-rw-r--r-- | menu.c | 4 | ||||
-rw-r--r-- | node.c | 4 | ||||
-rw-r--r-- | os-posix.c | 14 | ||||
-rwxr-xr-x | pre-commit.sh | 10 | ||||
-rw-r--r-- | syntax.c | 56 | ||||
-rw-r--r-- | tags.c | 6 | ||||
-rw-r--r-- | ted-internal.h | 6 | ||||
-rw-r--r-- | ted.c | 2 | ||||
-rw-r--r-- | ted.h | 2 | ||||
-rw-r--r-- | test/test.java | 2 | ||||
-rw-r--r-- | text.c | 2 | ||||
-rw-r--r-- | ui.c | 6 |
30 files changed, 101 insertions, 90 deletions
@@ -50,7 +50,7 @@ are mostly what you'd expect them to be (Ctrl+o for open, Ctrl+n for new, Ctrl+s ### Tips -- Even if you don't want to change anything with ted, it's a good idea to look at the config file (see below) to +- Even if you don't want to change anything with ted, it's a good idea to look at the config file (see below) to check out all of the keyboard shortcuts! - You can use Ctrl+f for "find", but if you want to search for something across multiple files, you can do Ctrl+! (run shell command), then run `grep -n search_term *.py`, for example (on Windows, you will need to have @@ -86,7 +86,7 @@ it clear it's a command. A list of key names can be found [here](https://wiki.libsdl.org/SDL2/SDL_Keycode). Colors are formatted like `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`, where r, g, b, and a are red, green, -blue, and alpha (transparency/opacity). You can use a [color picker](https://www.google.com/search?q=color+picker) to help you out. +blue, and alpha (transparency/opacity). You can use a [color picker](https://www.google.com/search?q=color+picker) to help you out. The extensions section is fairly self-explanatory. You can set settings for specific programming languages like this: @@ -182,7 +182,7 @@ You can Ctrl+Click on an identifier to go to its definition, or Ctrl+Shift+Click to its declaration, or Ctrl+Alt+Click to go to its type's definition. You can also press Ctrl+D to get a searchable list of all functions/types where you can select one to go to -its definition. +its definition. Press Ctrl+space to autocomplete. If there is only one possible completion, it will be selected automatically. Otherwise, you'll get a popup showing all possible completions. You can press tab to select a completion (or click on it), and press @@ -304,7 +304,8 @@ On Windows, install Microsoft Visual Studio 2022, then find and add vcvarsall.ba (most likely lives at `C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build`). Also, install the [Visual Studio Installer Projects extension](https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2022InstallerProjects) (needed to build the .msi installer). -Next you will need the SDL2 VC development libraries: https://www.libsdl.org/download-2.0.php + +Next you will need the SDL2 VC development libraries: https://www.libsdl.org/download-2.0.php. Extract the zip, copy SDL2-2.x.y into the ted directory, and rename it to SDL2. Also copy SDL2\\lib\\x64\\SDL2.dll to the ted directory. Then run `make.bat release`. @@ -115,7 +115,7 @@ typedef int64_t i64; /// maximum value of \ref i64 #define I64_MAX 0x7fffffffffffffff -/// allows +/// allows /// ``` /// switch (c) { /// case ANY_DIGIT: @@ -1019,7 +1019,7 @@ static void buffer_free_inner(TextBuffer *buffer) { if (!ted->quit) { // don't send didClose on quit (calling buffer_lsp would actually create a LSP if this is called after destroying all the LSPs which isnt good) LSP *lsp = buffer_lsp(buffer); if (lsp) { - buffer_send_lsp_did_close(buffer, lsp, NULL); + buffer_send_lsp_did_close(buffer, lsp, NULL); } } @@ -2546,7 +2546,7 @@ void buffer_delete_chars_at_pos(TextBuffer *buffer, BufferPos pos, i64 nchars_) } BufferPos del_start = pos, del_end = buffer_pos_advance(buffer, del_start, nchars); - bool create_new_edit = + bool create_new_edit = !last_edit || // if there is no previous edit to combine it with buffer_pos_cmp(del_end, edit_start) < 0 || // or if delete does not overlap last_edit buffer_pos_cmp(del_start, edit_end) > 0 || @@ -492,7 +492,7 @@ void command_execute_ex(Ted *ted, Command c, const CommandArgument *full_argumen case CMD_AUTOCOMPLETE_BACK: if (autocomplete_is_open(ted)) autocomplete_prev(ted); - break; + break; case CMD_GOTO_DEFINITION: menu_open(ted, MENU_GOTO_DEFINITION); break; @@ -558,7 +558,7 @@ void command_execute_ex(Ted *ted, Command c, const CommandArgument *full_argumen break; case CMD_TEXT_SIZE_DECREASE: if (argument != 0) { - i64 new_text_size = settings->text_size - argument; + i64 new_text_size = settings->text_size - argument; if (new_text_size >= TEXT_SIZE_MIN && new_text_size <= TEXT_SIZE_MAX) { settings->text_size = (u16)new_text_size; ted_change_text_size(ted, (float)new_text_size); @@ -678,7 +678,7 @@ static void settings_load_bg_texture(Ted *ted, Config *cfg, const char *path) { return; } - cfg->settings.bg_texture = gl_rc_texture_new(texture); + cfg->settings.bg_texture = gl_rc_texture_new(texture); } static void config_parse_line(ConfigReader *reader, Config *cfg) { @@ -1283,7 +1283,7 @@ static char *editorconfig_glob_to_regex(ConfigReader *reader, const char *glob) { // add base path - char dirname[4096]; + char dirname[4096]; strbuf_cpy(dirname, reader->filename); path_dirname(dirname); if (!dirname[0]) { @@ -1672,7 +1672,7 @@ static void editorconfig_glob_test_expect(Ted *ted, const char *pattern, const c .ted = ted, .filename = "/test.editorconfig", .line_number = 1, - }; + }; char *regex = editorconfig_glob_to_regex(&reader, pattern); int error_code = 0; PCRE2_SIZE error_offset = 0; @@ -152,7 +152,7 @@ static void *arr_add_ptr_(void **arr, size_t member_size) { } static void arr_reserve_(void **arr, size_t member_size, size_t n) { - if (n >= U32_MAX-1) { + if (n >= U32_MAX-1) { // too big; free arr. if (*arr) free(arr_hdr_(*arr)); *arr = NULL; @@ -338,7 +338,7 @@ static void *arr_copy_(const void *arr, size_t member_size) { } while (0) /// Ensure that enough space is allocated for `n` elements. -#define arr_reserve(a, n) arr_reserve_((void **)&(a), sizeof *(a), (n)) +#define arr_reserve(a, n) arr_reserve_((void **)&(a), sizeof *(a), (n)) /// set the length of `a` to `n`, increasing the capacity if necessary. /// the newly-added elements are zero-initialized. #define arr_set_len(a, n) arr_set_len_((void **)&(a), sizeof *(a), (n)) @@ -161,7 +161,7 @@ void find_redo_search(Ted *ted) { } arr_foreach_ptr(ted->find_results, FindResult, res) { - if (best_scroll_candidate.line == U32_MAX + if (best_scroll_candidate.line == U32_MAX || (buffer_pos_cmp(best_scroll_candidate, cursor_pos) < 0 && buffer_pos_cmp(res->start, cursor_pos) >= 0)) best_scroll_candidate = res->start; } @@ -481,7 +481,7 @@ void find_menu_frame(Ted *ted, Rect menu_bounds) { void find_open(Ted *ted, bool replace) { if (menu_is_any_open(ted)) return; - if (ted->active_buffer == ted->build_buffer) return; + if (ted->active_buffer == ted->build_buffer) return; if (!ted->find) ted->prev_active_buffer = ted->active_buffer; ted_switch_to_buffer(ted, ted->find_buffer); @@ -580,7 +580,7 @@ static void find_edit_notify(void *context, TextBuffer *buffer, const EditInfo * } } else if (buffer == ted->find_buffer) { find_redo_search(ted); - buffer_scroll_to_cursor(buffer); + buffer_scroll_to_cursor(buffer); } } diff --git a/ide-autocomplete.c b/ide-autocomplete.c index b469051..73f0031 100644 --- a/ide-autocomplete.c +++ b/ide-autocomplete.c @@ -17,7 +17,7 @@ struct Autocompletion { /// this can be NULL! char *documentation; bool deprecated; - SymbolKind kind; + SymbolKind kind; }; struct Autocomplete { @@ -41,7 +41,7 @@ struct Autocomplete { /// dynamic array of completions to be suggested (indices into completions) u32 *suggested; /// position of cursor last time completions were generated. if this changes, we need to recompute completions. - BufferPos last_pos; + BufferPos last_pos; /// which completion is currently selected (index into suggested) i32 cursor; i32 scroll; @@ -453,7 +453,7 @@ void autocomplete_process_lsp_response(Ted *ted, const LSPResponse *response) { // if autocomplete was invoked by Ctrl+Space, and there's only one completion, select it. if (ac->trigger == TRIGGER_INVOKED) autocomplete_complete(ted, ac->completions[ac->suggested[0]]); - return; + return; } } @@ -483,7 +483,7 @@ void autocomplete_open(Ted *ted, uint32_t trigger) { regenerated = true; tags_generate(ted, false); goto find_completions; - } else { + } else { autocomplete_no_suggestions(ted); } return; diff --git a/ide-definitions.c b/ide-definitions.c index 8b895db..f416aba 100644 --- a/ide-definitions.c +++ b/ide-definitions.c @@ -193,7 +193,7 @@ void definitions_process_lsp_response(Ted *ted, LSP *lsp, const LSPResponse *res } LSPLocation location = response_def->locations[0]; const char *path = lsp_document_path(lsp, location.document); - if (!ted_open_file(ted, path)) { + if (!ted_open_file(ted, path)) { ted_flash_error_cursor(ted); return; } diff --git a/ide-hover.c b/ide-hover.c index e77ffa5..b401c0c 100644 --- a/ide-hover.c +++ b/ide-hover.c @@ -64,7 +64,7 @@ static void hover_send_request(Ted *ted) { if (get_hover_position(ted, &h->position, NULL, &lsp)) { hover->requested_position = h->position; hover->last_request = lsp_send_request(lsp, &request); - } + } } void hover_process_lsp_response(Ted *ted, const LSPResponse *response) { diff --git a/ide-usages.c b/ide-usages.c index b94eb45..35bba24 100644 --- a/ide-usages.c +++ b/ide-usages.c @@ -51,7 +51,7 @@ void usages_process_lsp_response(Ted *ted, const LSPResponse *response) { } LSP *lsp = ted_get_lsp_by_id(ted, usages->last_request.lsp); const LSPResponseReferences *refs = &response->data.references; - if (lsp && arr_len(refs->locations)) { + if (lsp && arr_len(refs->locations)) { TextBuffer *buffer = ted->build_buffer; build_setup_buffer(ted); ted->build_shown = true; diff --git a/lib/glcorearb.h b/lib/glcorearb.h index 872d5a6..fe532c1 100644 --- a/lib/glcorearb.h +++ b/lib/glcorearb.h @@ -56,7 +56,7 @@ extern "C" { ** included as <GL/glcorearb.h>. ** ** glcorearb.h includes only APIs in the latest OpenGL core profile -** implementation together with APIs in newer ARB extensions which +** implementation together with APIs in newer ARB extensions which ** can be supported by the core profile. It does not, and never will ** include functionality removed from the core profile, such as ** fixed-function vertex and fragment processing. diff --git a/lsp-parse.c b/lsp-parse.c index 5a38453..63d5605 100644 --- a/lsp-parse.c +++ b/lsp-parse.c @@ -335,7 +335,7 @@ static bool parse_completion_response(LSP *lsp, const JSON *json, LSPResponse *r break; default: lsp_set_error(lsp, "Weird result type for textDocument/completion response: %s.", json_type_to_str(result.type)); - break; + break; } if (!lsp_expect_array(lsp, items_value, "completion list")) diff --git a/lsp-write.c b/lsp-write.c index 506369e..c1c846a 100644 --- a/lsp-write.c +++ b/lsp-write.c @@ -322,7 +322,7 @@ static JSONWriter message_writer_new(LSP *lsp, StrBuilder *builder) { writer.length_idx = str_builder_len(builder); str_builder_append(builder, "XXXXXXXXXX\r\n\r\n"); writer.content_start_idx = str_builder_len(builder); - return writer; + return writer; } static void message_writer_finish(JSONWriter *o) { @@ -627,7 +627,7 @@ static int lsp_communication_thread(void *data) { if (!lsp_receive(lsp, (size_t)10<<20)) break; if (SDL_SemWaitTimeout(lsp->quit_sem, send_delay_ms) == 0) - break; + break; } lsp->exited = true; @@ -715,7 +715,7 @@ LSP *lsp_create(const LSPSetup *setup) { lsp->command = str_dup(command); if (configuration && *configuration) lsp->configuration_to_send = str_dup(configuration); - lsp->quit_sem = SDL_CreateSemaphore(0); + lsp->quit_sem = SDL_CreateSemaphore(0); lsp->error_mutex = SDL_CreateMutex(); lsp->messages_mutex = SDL_CreateMutex(); @@ -273,7 +273,7 @@ typedef struct { LSPRequestType type; LSPString id_string; // if non-empty, this is the ID (only for server-to-client messages; we always use integer IDs) // one member of this union is set depending on `type`. - union { + union { LSPRequestCancel cancel; LSPRequestDidOpen open; LSPRequestDidClose close; @@ -365,7 +365,7 @@ typedef enum { } LSPCompletionKind; // interface TextEdit in the LSP spec -typedef struct { +typedef struct { LSPRange range; LSPString new_text; } LSPTextEdit; @@ -124,7 +124,7 @@ static Rect message_box_rect(Ted *ted) { } #if DEBUG -static void APIENTRY gl_message_callback(GLenum source, GLenum type, unsigned int id, GLenum severity, +static void APIENTRY gl_message_callback(GLenum source, GLenum type, unsigned int id, GLenum severity, GLsizei length, const char *message, const void *userParam) { (void)source; (void)type; (void)id; (void)length; (void)userParam; if (severity == GL_DEBUG_SEVERITY_NOTIFICATION) return; @@ -227,7 +227,7 @@ static LONG WINAPI error_signal_handler(EXCEPTION_POINTERS *info) { fprintf(log, "Instruction: 0x%llx\n", (unsigned long long)context->Rip); } else { fprintf(log, "Backtrace:\n"); - HANDLE process = GetCurrentProcess(), thread = GetCurrentThread(); + HANDLE process = GetCurrentProcess(), thread = GetCurrentThread(); // backtrace // this here was very helpful: https://gist.github.com/jvranish/4441299 if (SymInitialize(process, NULL, true)) { @@ -693,7 +693,7 @@ int main(int argc, char **argv) { double frame_start = ted->frame_time; SDL_PumpEvents(); - u32 key_modifier = ted_get_key_modifier(ted); + u32 key_modifier = ted_get_key_modifier(ted); { // get mouse position int mouse_x = 0, mouse_y = 0; ted->mouse_state = SDL_GetMouseState(&mouse_x, &mouse_y); @@ -839,7 +839,7 @@ int main(int argc, char **argv) { const char *text = event.text.text; if (buffer // unfortunately, some key combinations like ctrl+minus still register as a "-" text input event - && (key_modifier & ~KEY_MODIFIER_SHIFT) == 0) { + && (key_modifier & ~KEY_MODIFIER_SHIFT) == 0) { // insert the text command_execute_string_argument(ted, CMD_INSERT_TEXT, text); // check for trigger character @@ -869,7 +869,7 @@ int main(int argc, char **argv) { } } } - + } } break; } @@ -1,5 +1,5 @@ @echo off -if _%VCVARS% == _ ( +if _%VCVARS% == _ ( set VCVARS=1 call vcvarsall x64 ) @@ -12,7 +12,7 @@ if not exist pcre2-8-static.lib ( copy /y pcre2\Release\pcre2-8-static.lib ) SET C_FLAGS=/nologo /W4 /MD /wd4200 /wd4204 /wd4221 /wd4706 /wd4214 /D_CRT_SECURE_NO_WARNINGS /I SDL2/include /I pcre2 User32.lib SDL2/lib/x64/SDL2main.lib SDL2/lib/x64/SDL2.lib pcre2-8-static.lib pcre2-32-static.lib -rc /nologo ted.rc +rc /nologo ted.rc if _%1 == _ ( if not exist debug mkdir debug pushd debug @@ -274,7 +274,7 @@ static void warn_unsaved_menu_update(Ted *ted) { case CMD_TAB_CLOSE: { menu_close(ted); TextBuffer *buffer = ted->active_buffer; - command_execute(ted, CMD_SAVE, 1); + command_execute(ted, CMD_SAVE, 1); if (!buffer_unsaved_changes(buffer)) { command_execute(ted, CMD_TAB_CLOSE, 1); } @@ -426,7 +426,7 @@ static void goto_line_menu_update(Ted *ted) { TextBuffer *buffer = ted->prev_active_buffer; if (*contents != '\0' && *end == '\0') { if (line_number < 1) line_number = 1; - if (line_number > (long)buffer_line_count(buffer)) line_number = (long)buffer_line_count(buffer); + if (line_number > (long)buffer_line_count(buffer)) line_number = (long)buffer_line_count(buffer); BufferPos pos = {(u32)line_number - 1, 0}; if (line_buffer_is_submitted(line_buffer)) { @@ -397,7 +397,7 @@ void node_frame(Ted *ted, Node *node, Rect r) { if (node == ted->dragging_tab_node && i == ted->dragging_tab_idx) { // make tab follow mouse - tab_rect.pos = vec2_add(tab_rect.pos, + tab_rect.pos = vec2_add(tab_rect.pos, vec2_sub(ted_mouse_pos(ted), ted->dragging_tab_origin)); } @@ -502,7 +502,7 @@ void node_frame(Ted *ted, Node *node, Rect r) { if (ted_mouse_in_rect(ted, r_between)) { ted->cursor = resize_cursor; } - if (ted_clicked_in_rect(ted, r_between)) + if (ted_clicked_in_rect(ted, r_between)) ted->resizing_split = node; node_frame(ted, a, r1); @@ -20,7 +20,7 @@ static FsType statbuf_path_type(const struct stat *statbuf) { return FS_FILE; if (S_ISDIR(statbuf->st_mode)) return FS_DIRECTORY; - return FS_OTHER; + return FS_OTHER; } FsType fs_path_type(const char *path) { @@ -84,7 +84,7 @@ FsDirectoryEntry **fs_list_directory(const char *dirname) { default: entry->type = FS_OTHER; } - if (idx < nentries) // this could actually fail if someone creates files between calculating nentries and here. + if (idx < nentries) // this could actually fail if someone creates files between calculating nentries and here. entries[idx++] = entry; } } @@ -96,16 +96,16 @@ FsDirectoryEntry **fs_list_directory(const char *dirname) { int fs_mkdir(const char *path) { if (mkdir(path, 0755) == 0) { - // directory created successfully + // directory created successfully return 1; } else if (errno == EEXIST) { struct stat statbuf = {0}; if (stat(path, &statbuf) == 0) { if (S_ISDIR(statbuf.st_mode)) { - // already exists, and it's a directory + // already exists, and it's a directory return 0; } else { - // already exists, but not a directory + // already exists, but not a directory return -1; } } else { @@ -177,7 +177,7 @@ Process *process_run_ex(const char *command, const ProcessSettings *settings) { int stdin_pipe[2] = {0}, stdout_pipe[2] = {0}, stderr_pipe[2] = {0}; if (pipe(stdin_pipe) != 0) { strbuf_printf(proc->error, "%s", strerror(errno)); - return proc; + return proc; } if (pipe(stdout_pipe) != 0) { strbuf_printf(proc->error, "%s", strerror(errno)); @@ -234,7 +234,7 @@ Process *process_run_ex(const char *command, const ProcessSettings *settings) { // so we don't need the write end of the stdout pipe or the // read end of the stdin pipe. close(stdout_pipe[1]); - if (stderr_pipe[1]) + if (stderr_pipe[1]) close(stderr_pipe[1]); close(stdin_pipe[0]); // set pipes to non-blocking diff --git a/pre-commit.sh b/pre-commit.sh new file mode 100755 index 0000000..3553140 --- /dev/null +++ b/pre-commit.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Pre-commit hook for ted development +# To install: +# ln -s ../../pre-commit.sh .git/hooks/pre-commit + +# Check for trailing whitespace +git grep -In ' $' && { echo 'Fix trailing whitespace!'; exit 1; } +git grep -In '\w'"$(printf '\t')"'$' && { echo 'Fix trailing whitespace!'; exit 1; } +exit 0 @@ -296,7 +296,7 @@ static bool syntax_number_continues(Language lang, const char32_t *line, u32 lin break; } - return (line[i] < CHAR_MAX && + return (line[i] < CHAR_MAX && (strchr(digits, (char)line[i]) || (i && line[i-1] == 'e' && (line[i] == '+' || line[i] == '-')))); } @@ -339,7 +339,7 @@ static u32 syntax_keyword_len(Language lang, const char32_t *line, u32 i, u32 li } } return keyword_end - i; -} +} // highlighting for C, C++, and GLSL static void syntax_highlight_c_cpp(SyntaxState *state_ptr, const char32_t *line, u32 line_len, SyntaxCharType *char_types, Language lang) { @@ -740,7 +740,7 @@ static void syntax_highlight_rust(SyntaxState *state, const char32_t *line, u32 } - u32 max_comment_depth = ((u32)1<<SYNTAX_STATE_RUST_COMMENT_DEPTH_BITS); + u32 max_comment_depth = ((u32)1<<SYNTAX_STATE_RUST_COMMENT_DEPTH_BITS); if (comment_depth >= max_comment_depth) comment_depth = max_comment_depth; *state = (SyntaxState)( @@ -777,7 +777,7 @@ static void syntax_highlight_python(SyntaxState *state, const char32_t *line, u3 break; // format/raw/byte/unicode/template string case 'f': case 'r': case 'b': case 'u': case 't': - case 'F': case 'R': case 'B': case 'U': case 'T': + case 'F': case 'R': case 'B': case 'U': case 'T': if (!in_string && !interpolating) { bool is_string = true; u32 j; @@ -1541,7 +1541,7 @@ static void syntax_highlight_javascript_like( for (; i < line_len; ++i) { if (line[i] >= 128 || !strchr("dgimsuy", (char)line[i])) break; - char_types[i] = SYNTAX_STRING; + char_types[i] = SYNTAX_STRING; } --i; // back to last char in flags } @@ -2030,7 +2030,7 @@ static void syntax_highlight_css(SyntaxState *state_ptr, const char32_t *line, u case '.': case '#': if (!in_braces && char_types) { - char_types[i++] = SYNTAX_KEYWORD; + char_types[i++] = SYNTAX_KEYWORD; for (; i < line_len; ++i) { if (is32_alnum(line[i]) || line[i] == '-' || line[i] == '_') { char_types[i] = SYNTAX_KEYWORD; @@ -2043,28 +2043,28 @@ static void syntax_highlight_css(SyntaxState *state_ptr, const char32_t *line, u while (i < line_len && line[i] == ':') { // handle pseudo-classes and pseudo-elements static const char *const pseudo[] = { - ":active", ":any-link", ":autofill", ":blank", ":checked", - ":current", ":default", ":defined", ":dir", ":disabled", - ":empty", ":enabled", ":first", ":first-child", - ":first-of-type", ":fullscreen", ":future", ":focus", - ":focus-visible", ":focus-within", ":has", ":host", - ":host-context", ":hover", ":indeterminate", ":in-range", - ":invalid", ":is", ":lang", ":last-child", ":last-of-type", - ":left", ":link", ":local-link", ":modal", ":not", - ":nth-child", ":nth-col", ":nth-last-child", - ":nth-last-col", ":nth-last-of-type", ":nth-of-type", - ":only-child", ":only-of-type", ":optional", - ":out-of-range", ":past", ":picture-in-picture", - ":placeholder-shown", ":paused", ":playing", ":read-only", - ":read-write", ":required", ":right", ":root", ":scope", - ":state", ":target", ":target-within", ":user-invalid", - ":valid", ":visited", ":where", "::after", "::before", + ":active", ":any-link", ":autofill", ":blank", ":checked", + ":current", ":default", ":defined", ":dir", ":disabled", + ":empty", ":enabled", ":first", ":first-child", + ":first-of-type", ":fullscreen", ":future", ":focus", + ":focus-visible", ":focus-within", ":has", ":host", + ":host-context", ":hover", ":indeterminate", ":in-range", + ":invalid", ":is", ":lang", ":last-child", ":last-of-type", + ":left", ":link", ":local-link", ":modal", ":not", + ":nth-child", ":nth-col", ":nth-last-child", + ":nth-last-col", ":nth-last-of-type", ":nth-of-type", + ":only-child", ":only-of-type", ":optional", + ":out-of-range", ":past", ":picture-in-picture", + ":placeholder-shown", ":paused", ":playing", ":read-only", + ":read-write", ":required", ":right", ":root", ":scope", + ":state", ":target", ":target-within", ":user-invalid", + ":valid", ":visited", ":where", "::after", "::before", ":after", ":before", - "::backdrop", "::cue", "::cue-region", "::first-letter", - "::first-line", "::file-selector-button", - "::grammar-error", "::marker", "::part", "::placeholder", - "::selection", "::slotted", "::spelling-error", - "::target-text", + "::backdrop", "::cue", "::cue-region", "::first-letter", + "::first-line", "::file-selector-button", + "::grammar-error", "::marker", "::part", "::placeholder", + "::selection", "::slotted", "::spelling-error", + "::target-text", }; String32 s32 = { .len = line_len - i, @@ -2139,7 +2139,7 @@ static void syntax_highlight_css(SyntaxState *state_ptr, const char32_t *line, u dealt_with = true; if (!in_braces && char_types) { goto handle_pseudo; - } else { + } else { --i; // we'll increment i from the for loop } break; @@ -34,7 +34,7 @@ static bool is_source_file(const char *filename) { if (streq(dot + 1, extensions[i])) { return true; } - } + } return false; } @@ -49,7 +49,7 @@ static void tags_generate_at_dir(Ted *ted, bool run_in_build_window, const char char command[2048]; // 2048 is the limit on Windows XP, apparently #if __unix__ - // ctags.emacs's sorting depends on the locale + // ctags.emacs's sorting depends on the locale // (ctags-universal doesn't) const char *cmd_prefix = "LC_ALL=C ctags --append"; #else @@ -385,7 +385,7 @@ SymbolInfo *tags_get_symbols(Ted *ted) { if (file) { char line[1024]; while (fgets(line, sizeof line, file)) { - if (line[0] != '!') { // tag metadata is formatted as tag names beginning with ! + if (line[0] != '!') { // tag metadata is formatted as tag names beginning with ! size_t len = strcspn(line, "\t"); SymbolInfo *info = arr_addp(infos); info->name = strn_dup(line, len); diff --git a/ted-internal.h b/ted-internal.h index a18228a..ccbbb9c 100644 --- a/ted-internal.h +++ b/ted-internal.h @@ -85,7 +85,7 @@ typedef struct { /// All of ted's settings /// /// NOTE: to add more options to ted, add fields here, -/// and change the settings_<type> global constant near the top of config.c +/// and change the settings_<type> global constant near the top of config.c struct Settings { u32 colors[COLOR_COUNT]; float cursor_blink_time_on, cursor_blink_time_off; @@ -298,7 +298,7 @@ struct Ted { TextBuffer *drag_buffer; /// while a menu or something is open, there is no active buffer. when the menu is closed, /// the old active buffer needs to be restored. that's what this stores. - TextBuffer *prev_active_buffer; + TextBuffer *prev_active_buffer; Node *active_node; Config *all_configs; /// cwd where \ref default_settings was computed @@ -312,7 +312,7 @@ struct Ted { MouseClick *mouse_clicks[4]; MouseRelease *mouse_releases[4]; /// total amount scrolled this frame - int scroll_total_x, scroll_total_y; + int scroll_total_x, scroll_total_y; MenuInfo *all_menus; /// index of currently open menu, or 0 if no menu is open u32 menu_open_idx; @@ -434,7 +434,7 @@ static Font *ted_load_single_font(Ted *ted, const char *filename) { arr_foreach_ptr(ted->all_fonts, LoadedFont, f) { if (paths_eq(path, f->path)) return f->font; - } + } Font *font = text_font_load(path, ted_active_settings(ted)->text_size); if (!font) { @@ -5,7 +5,7 @@ /// \mainpage ted doxygen documentation -/// +/// /// See "files" above. You probably want to look at \ref ted.h. #ifndef TED_H_ diff --git a/test/test.java b/test/test.java index 7183aed..418c318 100644 --- a/test/test.java +++ b/test/test.java @@ -6,7 +6,7 @@ class Test { is a test*/ String x = "hello, world!\""; - System.out.println(x + + System.out.println(x + "yes\n\\"+ x); } @@ -1,5 +1,5 @@ #include "ted-internal.h" - + no_warn_start #if DEBUG #include "lib/stb_rect_pack.h" @@ -546,7 +546,7 @@ char *file_selector_update(Ted *ted, FileSelector *fs) { if (file_selector_cd(ted, fs, dir_name)) { buffer_delete_chars_at_pos(line_buffer, buffer_pos_start_of_file(line_buffer), last_path_sep + 1); // delete up to and including the last path separator - buffer_clear_undo_redo(line_buffer); + buffer_clear_undo_redo(line_buffer); } else { // delete up to first path separator in line buffer BufferPos pos = {.line = 0, .index = first_path_sep}; @@ -676,7 +676,7 @@ vec2 button_get_size(Ted *ted, const char *text) { return vec2_add_const(text_get_size_vec2(ted->font, text), 2 * border_thickness); } -void button_render(Ted *ted, Rect button, const char *text, u32 color) { +void button_render(Ted *ted, Rect button, const char *text, u32 color) { if (ted_mouse_in_rect(ted, button)) { // highlight button when hovering over it u32 new_color = (color & 0xffffff00) | ((color & 0xff) / 3); @@ -715,7 +715,7 @@ static void popup_get_rects(Ted const *ted, u32 options, Rect *popup, Rect *butt if (options & POPUP_CANCEL) { *button_cancel = r; r.pos.x += button_width; - } + } } PopupOption popup_update(Ted *ted, u32 options) { |