From 5fa8e041356038034327ade41545677dd3007679 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Thu, 18 Feb 2021 15:14:02 -0500 Subject: Finishing touches for v. 0.4 --- README.md | 46 ++++++++++++++++++++++++---------------------- build.c | 14 ++++++++++---- main.c | 3 ++- ted.cfg | 2 +- util.c | 7 ++++++- 5 files changed, 43 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index a0a9c8f..cd9463b 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,9 @@ A text editor. -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`. 0.2 Line numbers, check if file changed by another program 2021 Feb 5 0.3 Find+replace, highlight matching parentheses, indent/dedent selection 2021 Feb 11 0.3a Find+replace bug fixes, view-only mode 2021 Feb 14 +0.4 :build 2021 Feb 18 ## License diff --git a/build.c b/build.c index 0112c0c..515709e 100644 --- a/build.c +++ b/build.c @@ -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)); } + diff --git a/main.c b/main.c index eafb1c0..bbcbeda 100644 --- a/main.c +++ b/main.c @@ -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 diff --git a/ted.cfg b/ted.cfg index 38d8c05..b65ba41 100644 --- a/ted.cfg +++ b/ted.cfg @@ -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 diff --git a/util.c b/util.c index 2872c37..81c4ce3 100644 --- a/util.c +++ b/util.c @@ -1,6 +1,10 @@ #if _WIN32 #include #include +#elif __unix__ +#include +#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 +} + -- cgit v1.2.3