forked from trinitrix/core
1
0
Fork 0
Commit Graph

131 Commits

Author SHA1 Message Date
antifallobst a538877b5b
refactor: restructured event sources 2023-10-19 18:14:59 +02:00
Benedikt Peetz 4e839d4e2c
fix(config/lua): Add the 'jj' mapping the insert mode
This is just here to prove that the fixes for the KeyInputPending mode
actually work
2023-10-18 23:10:44 +02:00
Benedikt Peetz c024b73625
fix(ui): Display pending keys in KeyInputPending 2023-10-18 23:10:12 +02:00
Benedikt Peetz 18152bdded
fix(key_input): Also input pending keys, when leaving KeyInputPending 2023-10-18 23:09:09 +02:00
Benedikt Peetz 0ed99b6244
fix(config/lua): Generate the 'keymappings' table under 'std' 2023-10-18 23:03:16 +02:00
Benedikt Peetz b54f8e59e8
fix(key_input): Handle shifted characters correctly
This commit fixes multiple bugs introduced in the new keymapping system:

    When we can't find a keymapping for a string, we simply pass it
along, by calling the 'send_input_unprocessed' function with the
inputted key turned into it's string representation. Turning a shifted
key into it's repr. returned a doubly shifted string:
   'A' turned into '<S-A>', which then fails to parse as a valid key
input. Thus, we simply unshifted the value.
    The next bug, becoming apparent now, is caused by this: We never
reshifted the value, when we converted it into a crossterm key input
event.
2023-10-18 22:52:07 +02:00
Benedikt Peetz 66bf5e3b6f
build(update.sh): Include the language_macros dir in the update 2023-10-18 21:14:23 +02:00
Benedikt Peetz 97c7327d54
build(treewide): Update 2023-10-18 21:14:03 +02:00
Benedikt Peetz 9139fa2776
feat(command_interface): Support user specified keymappings 2023-10-16 14:04:03 +02:00
Benedikt Peetz 602eba6a60
build(treewide): Update 2023-10-16 13:56:18 +02:00
Benedikt Peetz 1dd9a0e4de
feat(command_interface): Add support for functions (and thus callbacks) 2023-10-14 18:46:25 +02:00
Benedikt Peetz d7b93178e8
build(treewide): Move back to rust stable 2023-10-14 12:42:36 +02:00
Benedikt Peetz 181af51c08
build(treewide): Update 2023-10-14 12:41:05 +02:00
Benedikt Peetz 6745da4c71
style(treewide): Apply consistent formatting
I just ran `cargo fmt -- --config reorder_imports=true,imports_granularity=Crate,group_imp
orts=StdExternalCrate`
2023-09-20 19:22:56 +02:00
Benedikt Peetz 27d00c564c
feat(command_interface): Add support for namespaces 2023-09-20 19:21:44 +02:00
Benedikt Peetz 29aa6c1d33
build(treewide): Update 2023-09-17 16:41:55 +02:00
Benedikt Peetz 9a9cda535a
fix(commands/print): Add basic support for printing non-string types 2023-09-09 22:51:28 +02:00
Benedikt Peetz 357c42332f
feat(app): Add support for a Lua based configuration file 2023-09-09 21:29:46 +02:00
Benedikt Peetz 7aea23f3b6
fix(handlers/main)!: Change exit key to `q`
`Esc` is bound to exit a deeper mode (like `insert` or `command`) and
return to `normal` mode. This however is rather inconvenient,
when `Esc` also exits Trinitrix in general, as spamming `Esc` then
becomes impossible.
This changes also puts Trinitrix more in line with vim (although vim
does not allow exiting with `q`).

BREAKING CHANGE: To exit press `q` instead of `Esc`.
2023-09-09 19:57:49 +02:00
Benedikt Peetz 74f3b25827
feat(states): Add `command` state for command only keymappings 2023-09-09 19:57:20 +02:00
Benedikt Peetz bc1fc0cc02
refactor(LuaCommandManager): Express the semantics of Lua code explicitly 2023-09-09 19:55:16 +02:00
Benedikt Peetz ed37d1239f
feat(CommandTransferValue): Generalize the API to facilitate multiple languages
The code for the `CommandTransferValue` was deeply entrenched in the
whole Lua execution code, which is obviously not ideal. In trying to
alleviate that, I decided to generalize the API in a way, that makes
adding new languages a lot easier.
2023-09-09 19:49:56 +02:00
Benedikt Peetz 42b8793dd0
Fix(lua): Upgrade to mlua 9.1, which introduced braking changes 2023-09-09 19:44:00 +02:00
Benedikt Peetz eb63cb6247
build(flake): Wrap mold so that it works with the nix supplied libraries 2023-09-03 22:11:41 +02:00
Benedikt Peetz a8112d554e
build(treewide): Update 2023-09-03 22:08:35 +02:00
Benedikt Peetz d93b00484e
Docs(architecture): Add lua code execution to diagram 2023-08-04 12:36:46 +02:00
antifallobst ecaa98e771
Docs(architecture): added the backend interface to the architecture diagram 2023-07-26 23:56:32 +02:00
Benedikt Peetz bd0ffe9edc
Merge: Branch 'commands'
Multiple things are still missing:
- [ ] Table type support
- [ ] Error messages and Status messages in ci input field (not in the status panel)
- [ ] Better ux in the ci input field (scrollback more than one line, syntax highlighting, &c)
- For further checkboxes take a look at the `FIXME`s and `TODO`s in the code.

The base ci although is already usable and in some way useful
2023-07-26 22:36:59 +02:00
Benedikt Peetz 84c13fd6f8
Fix(treewide): Resolve merge conflicts 2023-07-26 22:25:08 +02:00
Benedikt Peetz 855d487693
Refactor(treewide): Remove the useless `tui_app` directory 2023-07-26 22:15:54 +02:00
Benedikt Peetz 258f784098
Fix(handlers::main): Don't close the cli after an entered command 2023-07-26 22:15:49 +02:00
Benedikt Peetz a80245c523
Fix(handlers::command): Only send success on real success
The `room_message_send()` function told the user about a successful sent
room message, even if that was not the case.
2023-07-26 22:15:18 +02:00
Benedikt Peetz f7b161fb55
Fix(handlers::command): Add the missing displayOutput handler
This handler is called by the lua executor, to show the final output of
a lua execution.
2023-07-26 22:15:17 +02:00
Benedikt Peetz 909fc01a48
Fix(app::command_interface): Add a `greet_multiple()` func to test tables
This is, like the `greet` function only here to debug the lua api. It
outputs a table.
2023-07-26 22:15:15 +02:00
Benedikt Peetz c0a1fc0a02
Fix(app::command_interface): Add a (workaround) print function
The default print function prints to stdout, which obviously
doesn't work with a tui application. This wrapper however is a
rather poor workaround, as it only works with strings (lua `print`
calls `tostring` to turn non string values in something printable).
2023-07-26 22:15:14 +02:00
Benedikt Peetz 1a35bb152c
Feat(treewide): Add a way for Commands to return more than just strings 2023-07-26 22:15:07 +02:00
Benedikt Peetz 7489f06a7c
Fix(app::command_interface): Use new language_macro api 2023-07-26 22:10:19 +02:00
Benedikt Peetz 3ca01912b9
Build(flake): Switch back to stable 2023-07-26 22:08:11 +02:00
Benedikt Peetz fbcf572f47
Build(flake+Cargo): Update lockfiles 2023-07-26 22:08:10 +02:00
Benedikt Peetz 27ad48c5e9
Refactor(language_macros): Complete rewrite
This **should** have everything the other implementation had, but the
api is implemented in a way, which is more in line with the expectation
raised at the lua functions (being that they are only wrappers over the
command api, and nothing more).

Aside of that, this version is actually documented!
2023-07-26 22:08:09 +02:00
Benedikt Peetz a3b49b17f4
Fix(handlers::main): Close ci after a command input 2023-07-26 22:08:07 +02:00
Benedikt Peetz 0288bdb0ad
Feat(ui): Add status panel, which shows command statuses and errors 2023-07-26 22:08:00 +02:00
Benedikt Peetz 1fe04ca5c6
Fix(lua_command::handle): Move lua_command handler to separate thread
This makes it possible to have lua code execute commands and receive
their output value, without risking a deadlock.
2023-07-26 22:06:42 +02:00
Benedikt Peetz c7a4d5a8ab
Refactor(treewide): Remove the repl, reuse of e. handling is hard
The event handling is deeply ingrained in the ui code, the commands are
focused around the ui code, in short splitting of the event handling and
command system from the ui is intentionally hard and in my opinion not
really worth it right now.
2023-07-26 22:06:40 +02:00
Benedikt Peetz 189ae509f8
Fix(app::command_interface): Provide pre-generated file, to check syntax 2023-07-26 22:06:33 +02:00
Benedikt Peetz ebb16a20de
Feat(treewide): Add a feature based layout and repl subcommand
Compiling the whole tui stack, just to debug the lua command line seems
counterproductive to me. This allows to just compile the needed parts
for a basic lua repl.

As of yet the repl is just a mock-up, as the event handling can, as of
right now, not easily be separated from the tui.

To activate specific features add specify the on the cargo command line
like this:
```
cargo run --features "cli tui"
```
or add them to the `default` feature set in the `Cargo.toml`.
2023-07-26 22:04:42 +02:00
Benedikt Peetz 3d417d7e15
Build(flake): Remove dead code from cranelift build process 2023-07-26 21:53:44 +02:00
Benedikt Peetz 5e7ed3d084
Build: Lock file maintenance 2023-07-26 21:52:26 +02:00
Benedikt Peetz a3a26df65f
Build(flake): Add rustc cranelift codegen to development shell
This is executed by running `cargo clif` instead of `cargo`.
It _should_ result in decreased compile times (around 30%).
2023-07-26 21:42:16 +02:00
Benedikt Peetz 111d46ef2e
Build(Cargo): Instruct rustc to perform fat lto in release mode 2023-07-26 21:40:15 +02:00