diff options
-rw-r--r-- | command.c | 4 | ||||
-rw-r--r-- | command.h | 5 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | ted.cfg | 2 |
4 files changed, 11 insertions, 4 deletions
@@ -245,6 +245,10 @@ void command_execute(Ted *ted, Command c, i64 argument) { } } break; + case CMD_VIEW_ONLY: + if (buffer) buffer->view_only = !buffer->view_only; + break; + case CMD_TAB_CLOSE: { if (ted->menu) { menu_close(ted); @@ -63,6 +63,8 @@ ENUM_U16 { CMD_TEXT_SIZE_INCREASE, CMD_TEXT_SIZE_DECREASE, + CMD_VIEW_ONLY, // toggle view-only mode + CMD_ESCAPE, // by default this is the escape key. closes menus, etc. CMD_COUNT @@ -125,6 +127,7 @@ static CommandName const command_names[CMD_COUNT] = { {"tab-prev", CMD_TAB_PREV}, {"increase-text-size", CMD_TEXT_SIZE_INCREASE}, {"decrease-text-size", CMD_TEXT_SIZE_DECREASE}, - {"escape", CMD_ESCAPE} + {"view-only", CMD_VIEW_ONLY}, + {"escape", CMD_ESCAPE}, }; @@ -1,7 +1,4 @@ // @TODO: -// - fix replace all (with regex) -// - menu for opening file in view-only mode - // - :build (F4) -- cargo build if editing .rs file or file called Cargo.toml, otherwise make. // - go to definition (with ctags) -- ctrl+click would be nice @@ -575,6 +572,7 @@ int main(int argc, char **argv) { if (ted->active_node) { float x1 = 25, y1 = 25, x2 = window_width-25, y2 = window_height-25; Node *node = ted->root; + if (ted->find) y2 -= find_menu_height(ted); node_frame(ted, node, rect4(x1, y1, x2, y2)); if (ted->find) { find_menu_frame(ted); @@ -109,6 +109,8 @@ Alt+0 = 9 :tab-switch Ctrl++ = 3 :increase-text-size Ctrl+- = 3 :decrease-text-size +Ctrl+Alt+Shift+v = :view-only + Escape = :escape [colors] |