Skip to content

Commit 4ad3277

Browse files
committed
Migrated every text input to edtui, added emacs keybindings
1 parent 60c85e3 commit 4ad3277

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3458
-3380
lines changed

Cargo.lock

Lines changed: 1442 additions & 962 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name = "atac"
33
description = "Arguably a Terminal API Client. Feature-full, free, open-source, offline and account-less."
44
version = "0.22.1"
55
authors = ["julien-cpsn"]
6-
edition = "2021"
7-
rust-version = "1.82"
6+
edition = "2024"
7+
rust-version = "1.85"
88
license = "MIT"
99
readme = "README.md"
1010
documentation = "https://atac.julien-cpsn.com/"
@@ -37,21 +37,21 @@ cookie_store = "=0.22.0"
3737

3838
# TUI
3939
## Terminal UI framework
40-
ratatui = { version = "=0.29.0", features = ["serde"] }
40+
ratatui = { version = "=0.30.0", features = ["serde"] }
4141
## Used to parse, use key bindings files and some utilities
42-
crokey = "=1.1.2"
42+
crokey = "=1.3.0"
4343
## Display big texts. Only used for displaying ATAC in the homepage.
44-
tui-big-text = "=0.7.3"
44+
tui-big-text = "=0.8.1"
4545
## Display tree-like lists. Used for displaying the collections.
46-
tui-tree-widget = "=0.23.1"
46+
tui-tree-widget = { version = "=0.24.0" }
4747
## Display scrollable panels
48-
tui-scrollview = "0.5.3"
49-
## Text area that handle a lot of features. Used for editing request body.
50-
tui-textarea = { version = "=0.7.0", features = ["ratatui"] }
48+
tui-scrollview = "0.6.2"
49+
## Text area that handle a lot of features. Used for editing request URL, body, messages, payloads, scripts.
50+
edtui = { version = "0.11.1", default-features = false, features = ["syntax-highlighting", "mouse-support", "system-editor"] }
5151
## Display loading UI elements. Used when request is pending.
52-
throbber-widgets-tui = "=0.9.0"
52+
throbber-widgets-tui = "=0.10.0"
5353
## Display response images.
54-
ratatui-image = { version = "=9.0.0", default-features = false, features = ["crossterm", "image-defaults"] }
54+
ratatui-image = { version = "=10.0.2", default-features = false, features = ["crossterm", "image-defaults"] }
5555
## Decode images.
5656
image = "=0.25.9"
5757

example_resources/key_bindings/default_key_bindings.toml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,35 @@ move_request_up = "Ctrl-Up"
1010
move_request_down = "Ctrl-Down"
1111

1212
next_environment = "e"
13-
display_env_editor = "ctrl-e"
13+
display_env_editor = "Ctrl-e"
1414
display_cookies = "c"
1515
display_logs = "l"
1616

1717
[keybindings.generic]
1818
display_help = "Ctrl-h" # Take care to not overlap other inputs, the help can be triggered from anywhere
1919

20-
# Collection name, request name, URL, Header, Query param, Basic Auth, Bearer Token
21-
[keybindings.generic.text_inputs.text_input]
22-
confirm = "Enter"
23-
cancel = "Esc"
24-
25-
delete_backward = "Delete"
26-
delete_forward = "Backspace"
27-
28-
move_cursor_left = "Left"
29-
move_cursor_right = "Right"
30-
move_cursor_line_start = "Home"
31-
move_cursor_line_end = "End"
32-
33-
# Request body
34-
[keybindings.generic.text_inputs.text_area_mode.Custom]
20+
# E.g. Collection name, request name, URL, Header, Query param, Basic Auth, Bearer Token, Request body
21+
[keybindings.generic.text_input]
3522
quit_without_saving = "Esc"
36-
save_and_quit = "Ctrl-s"
23+
save_and_quit_single_line = "Enter"
24+
save_and_quit_area = "Ctrl-s"
3725

26+
# The following line is a shortcut of the next section (modes: vim, emacs, default, custom)
27+
#mode = "default"
28+
29+
[keybindings.generic.text_input.mode.custom]
3830
copy = "Ctrl-c"
3931
paste = "Ctrl-v"
32+
33+
search = "Ctrl-f"
34+
system_editor = "Ctrl-e"
35+
4036
undo = "Ctrl-z"
4137
redo = "Ctrl-y"
4238

4339
new_line = "Enter"
4440
indent = "Tab"
41+
4542
delete_backward = "Delete"
4643
delete_forward = "Backspace"
4744

@@ -52,6 +49,7 @@ move_cursor_up = "Up"
5249
move_cursor_down = "Down"
5350
move_cursor_left = "Left"
5451
move_cursor_right = "Right"
52+
5553
move_cursor_line_start = "Home"
5654
move_cursor_line_end = "End"
5755

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Please avoid using Ctrl-v, it will paste your clipboard and trigger many unwanted event
2+
3+
[keybindings.main_menu]
4+
exit = "Ctrl-x" # ctrl-c is implemented by default
5+
6+
unselect_request = "Left"
7+
expand_collection = "Right"
8+
9+
move_request_up = "Ctrl-Up"
10+
move_request_down = "Ctrl-Down"
11+
12+
next_environment = "Ctrl-e"
13+
display_env_editor = "Shift-e"
14+
display_cookies = "Ctrl-c"
15+
display_logs = "Ctrl-l"
16+
17+
[keybindings.generic]
18+
display_help = "Ctrl-h" # Take care to not overlap other inputs, the help can be triggered from anywhere
19+
20+
# E.g. Collection name, request name, URL, Header, Query param, Basic Auth, Bearer Token, Request body
21+
[keybindings.generic.text_input]
22+
quit_without_saving = "Esc"
23+
save_and_quit_single_line = "Enter"
24+
save_and_quit_area = "Ctrl-x"
25+
26+
# Will simulate most of the emcas key bindings in the text areas (e.g. Request body)
27+
mode = "emacs"
28+
29+
# Navigation in tables, popups, up and down in the collections list
30+
[keybindings.generic.navigation]
31+
move_cursor_up = "Up"
32+
move_cursor_down = "Down"
33+
move_cursor_left = "Left"
34+
move_cursor_right = "Right"
35+
36+
# Avoids overlapping when in text input (e.g. selecting a collection while creating a new request)
37+
# Might not happen when using the default config
38+
alt_move_cursor_up = "Up"
39+
alt_move_cursor_down = "Down"
40+
alt_move_cursor_left = "Left"
41+
alt_move_cursor_right = "Right"
42+
43+
go_back = "Esc"
44+
select = "Enter"
45+
46+
# Collections list, query params, headers, cookies
47+
[keybindings.generic.list_and_table_actions]
48+
create_element = "Ctrl-n"
49+
delete_element = "Ctrl-d"
50+
edit_element = "Enter" # Edit query param, header, basic auth, bearer token
51+
rename_element = "Ctrl-r" # Only used in the collections list (main menu)
52+
toggle_element = "Ctrl-t" # Only used in tables (Query params, headers, cookies)
53+
duplicate_element = "Shift-d"
54+
55+
[keybindings.request_selected]
56+
param_next_tab = "Tab"
57+
58+
change_url = "Ctrl-u"
59+
change_method = "Ctrl-m"
60+
request_settings = "Ctrl-s"
61+
62+
next_view = "Ctrl-v"
63+
64+
send_request = "Space"
65+
alt_send_request = "Ctrl-Enter"
66+
67+
export_request = "Shift-E"
68+
69+
[keybindings.request_selected.param_tabs]
70+
change_auth_method = "Ctrl-a"
71+
change_body_content_type = "Ctrl-b"
72+
change_message_type = "Ctrl-m"
73+
74+
[keybindings.request_selected.result_tabs]
75+
scroll_up = "Ctrl-Up"
76+
scroll_down = "Ctrl-Down"
77+
scroll_left = "Ctrl-Left"
78+
scroll_right = "Ctrl-Right"
79+
80+
yank_response_part = "Ctrl-y" # Used to yank the current result tab (e.g. body, headers, cookies)
81+
82+
result_next_tab = "Shift-BackTab" # Will use param_next_tab depending on the selected view

example_resources/key_bindings/mac_key_bindings.toml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,25 @@ display_logs = "l"
1717
[keybindings.generic]
1818
display_help = "Ctrl-h" # Take care to not overlap other inputs, the help can be triggered from anywhere
1919

20-
# Collection name, request name, URL, Header, Query param, Basic Auth, Bearer Token
21-
[keybindings.generic.text_inputs.text_input]
22-
confirm = "Enter"
23-
cancel = "Esc"
24-
25-
delete_backward = "Delete"
26-
delete_forward = "Backspace"
27-
28-
move_cursor_left = "Left"
29-
move_cursor_right = "Right"
30-
move_cursor_line_start = "Home"
31-
move_cursor_line_end = "End"
32-
33-
# Request body
34-
[keybindings.generic.text_inputs.text_area_mode.Custom]
20+
# E.g. Collection name, request name, URL, Header, Query param, Basic Auth, Bearer Token, Request body
21+
[keybindings.generic.text_input]
3522
quit_without_saving = "Esc"
36-
save_and_quit = "Ctrl-s"
23+
save_and_quit_single_line = "Enter"
24+
save_and_quit_area = "Ctrl-s"
3725

26+
[keybindings.generic.text_input.mode.custom]
3827
copy = "Ctrl-c"
3928
paste = "Ctrl-v"
29+
4030
undo = "Ctrl-z"
4131
redo = "Ctrl-y"
4232

33+
search = "Ctrl-f"
34+
system_editor = "Ctrl-e"
35+
4336
new_line = "Enter"
4437
indent = "Tab"
38+
4539
delete_backward = "Delete"
4640
delete_forward = "Backspace"
4741

@@ -52,6 +46,7 @@ move_cursor_up = "Up"
5246
move_cursor_down = "Down"
5347
move_cursor_left = "Left"
5448
move_cursor_right = "Right"
49+
5550
move_cursor_line_start = "Home"
5651
move_cursor_line_end = "End"
5752

example_resources/key_bindings/vim_key_bindings.toml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,14 @@ display_logs = "Shift-L"
1717
[keybindings.generic]
1818
display_help = "Shift-h" # Take care to not overlap other inputs, the help can be triggered from anywhere
1919

20-
# Collection name, request name, URL, Header, Query param, Basic Auth, Bearer Token
21-
[keybindings.generic.text_inputs.text_input]
22-
confirm = "Enter"
23-
cancel = "Esc"
24-
25-
delete_backward = "Delete"
26-
delete_forward = "Backspace"
27-
28-
move_cursor_left = "Ctrl-h"
29-
move_cursor_right = "Ctrl-l"
30-
move_cursor_line_start = "Home"
31-
move_cursor_line_end = "End"
32-
33-
# Request body
34-
[keybindings.generic.text_inputs]
35-
36-
# Will simulate most of the Vim key bindings in the text areas (Request body)
37-
text_area_mode = "VimEmulation"
20+
# E.g. Collection name, request name, URL, Header, Query param, Basic Auth, Bearer Token, Request body
21+
[keybindings.generic.text_input]
22+
quit_without_saving = "Esc"
23+
save_and_quit_single_line = "Enter"
24+
save_and_quit_area = "Ctrl-s"
25+
26+
# Will simulate most of the Vim key bindings in the text areas (e.g. Request body)
27+
mode = "vim"
3828

3929
# Navigation in tables, popups, up and down in the collections list
4030
[keybindings.generic.navigation]

0 commit comments

Comments
 (0)