diff options
-rw-r--r-- | README.md | 46 | ||||
-rw-r--r-- | build.c | 14 | ||||
-rw-r--r-- | main.c | 3 | ||||
-rw-r--r-- | ted.cfg | 2 | ||||
-rw-r--r-- | util.c | 7 |
5 files changed, 43 insertions, 29 deletions
@@ -6,26 +6,9 @@ A text editor. <img src="ted.png"> -To install `ted` on Linux, you will need: - -- A C compiler -- SDL2 -- The GL development libraries - -These can be installed on Ubuntu/Debian with: - -``` -sudo apt install gcc libsdl2-dev libgl-dev -``` - -Then run - -``` -wget https://ftp.pcre.org/pub/pcre/pcre2-10.36.zip -sudo make install -j4 -``` -There is no nice way of installing on Windows yet. +To install ted, you will need to build it from source (see below). Eventually there will be a nice installer, but only when it's stable and bug-free enough for +ordinary use. ## Why? @@ -40,13 +23,31 @@ a simple editor that starts up practically instantaneously, and performs well on - Customization of (pretty much) all colours and keyboard commands. - Syntax highlighting for C, C++, Rust, and Python. - Find and replace (with regular expressions!) +- Run build command (default keybinding F4) ## Building from source -On Linux, run `make`. +To install `ted` on Linux, you will need: + +- A C compiler +- The SDL2 development libraries +- wget, unzip (for downloading, extracting PCRE2) + +These can be installed on Ubuntu/Debian with: + +``` +sudo apt install gcc libsdl2-dev wget unzip +``` + +Then run + +``` +wget https://ftp.pcre.org/pub/pcre/pcre2-10.36.zip +sudo make install -j4 +``` -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. Also copy SDL2\lib\x64\SDL2.dll +On Windows (64-bit), 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. You will also need PCRE2. Download it here: https://ftp.pcre.org/pub/pcre/pcre2-10.36.zip, unzip it, and put pcre2-10.36 in the same folder as ted. @@ -62,6 +63,7 @@ Then run `make.bat`. <tr><td>0.2</td> <td>Line numbers, check if file changed by another program</td> <td>2021 Feb 5</td></tr> <tr><td>0.3</td> <td>Find+replace, highlight matching parentheses, indent/dedent selection</td> <td>2021 Feb 11</td></tr> <tr><td>0.3a</td> <td>Find+replace bug fixes, view-only mode</td> <td>2021 Feb 14</td></tr> +<tr><td>0.4</td> <td>:build</td> <td>2021 Feb 18</td></tr> </table> ## License @@ -58,12 +58,17 @@ static void build_start(Ted *ted) { if (process_run(&ted->build_process, command)) { ted->building = true; ted->build_shown = true; + TextBuffer *build_buffer = &ted->build_buffer; // new empty build output buffer - buffer_new_file(&ted->build_buffer, NULL); - ted->build_buffer.store_undo_events = false; // don't need undo events for build output buffer - ted->build_buffer.view_only = true; + buffer_new_file(build_buffer, NULL); + build_buffer->store_undo_events = false; // don't need undo events for build output buffer + char32_t text[] = {'$', ' '}; + buffer_insert_text_at_cursor(build_buffer, str32(text, 2)); + buffer_insert_utf8_at_cursor(build_buffer, command); + buffer_insert_char_at_cursor(build_buffer, '\n'); + build_buffer->view_only = true; } else { - ted_seterr("Couldn't start build: %s", process_geterr(&ted->build_process)); + ted_seterr(ted, "Couldn't start build: %s", process_geterr(&ted->build_process)); } } @@ -293,3 +298,4 @@ static void build_frame(Ted *ted, float x1, float y1, float x2, float y2) { } buffer_render(buffer, rect4(x1, y1, x2, y2)); } + @@ -1,7 +1,8 @@ // @TODO: // - go to definition (with ctags) -- ctrl+click would be nice -// - :run -- if .html file, open in browser, otherwise figure out a way of sending a command to bash?? +// - :run -- if .html file, open in browser, otherwise figure out a way of sending a command to shell +// running in terminal emulator?? (don't want to implement stdin/ANSI codes/etc.) // - split @@ -23,7 +23,7 @@ syntax-highlighting = on line-numbers = on # If set to "on", when a file is changed by another program, it will be reloaded by ted without asking you. auto-reload = off -build-default-command = timeout /t 5 +build-default-command = make [keyboard] # motion and selection @@ -1,6 +1,10 @@ #if _WIN32 #include <intrin.h> #include <direct.h> +#elif __unix__ +#include <unistd.h> +#else +#error "Unrecognized operating system." #endif static u8 util_popcount(u64 x) { @@ -281,4 +285,5 @@ static void change_directory(char const *path) { #else chdir(path); #endif -}
\ No newline at end of file +} + |