summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--command.c4
-rw-r--r--command.h5
-rw-r--r--main.c4
-rw-r--r--ted.cfg2
4 files changed, 11 insertions, 4 deletions
diff --git a/command.c b/command.c
index 8db46f9..0153c64 100644
--- a/command.c
+++ b/command.c
@@ -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);
diff --git a/command.h b/command.h
index e366f17..965d568 100644
--- a/command.h
+++ b/command.h
@@ -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},
};
diff --git a/main.c b/main.c
index 9df3426..81a9d90 100644
--- a/main.c
+++ b/main.c
@@ -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);
diff --git a/ted.cfg b/ted.cfg
index f89e7aa..695bcdb 100644
--- a/ted.cfg
+++ b/ted.cfg
@@ -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]