Commit Graph

77 Commits (a797d7b1c7d883badd428498c1b29806b7bafc1c)

Author SHA1 Message Date
Arijit Basu a797d7b1c7 Format & lint code 3 years ago
Shunsuke Mie 1947d77a33 Change mods name for tests
There are two mod names for test, `test` and `tests`. This commit unites
the name to `tests`. It is commonly used.
3 years ago
Arijit Basu 0328eb63c7 Fix selection count
Fixes https://github.com/sayanarijit/xplr/issues/363
3 years ago
Arijit Basu 347b9625aa Add padding to custom content titles 3 years ago
Gilad Woloch 402715cdcd Remove trivial `ResolvedNode` methods 3 years ago
Gilad Woloch 95b580203f Introduce `xor` helper 3 years ago
Gilad Woloch 18b784f054 Correct typo 3 years ago
Gilad Woloch 2ef7523bb0 Derive `PartialEq` 3 years ago
Gilad Woloch 46287f6373 Use `Result::is_ok` 3 years ago
Gilad Woloch cc022e85ff Fix `cargo clippy` warnings and reformat 3 years ago
Gilad Woloch c399236fd3 Reformat 3 years ago
Gilad Woloch 3f0e479f56 Remove trivial methods 3 years ago
Arijit Basu ac1476bc08
Cleanup 3 years ago
Arijit Basu aee49dad78 Support terminal colors in custom layout
Example:

```lua
xplr.config.layouts.builtin.default = {
  CustomContent = {
    title = "custom title",
    body = {
      StaticParagraph = { render = "\x1b[31mcustom body\x1b[0m" },
    },
  },
}
```
3 years ago
Arijit Basu 5eab3c6033 Support defining custom layout for different modes
Closes: https://github.com/sayanarijit/xplr/issues/335
3 years ago
Arijit Basu 69d3b3af46 Add focus selection UI
Closes: https://github.com/sayanarijit/xplr/issues/322
3 years ago
Arijit Basu 7d0605479e Allow dynamic linking to load Lua modules using C
Also upgrade packages.

Closes: https://github.com/sayanarijit/xplr/issues/309
3 years ago
Arijit Basu 9070cd9e17 Add more docs 3 years ago
Arijit Basu f5aceb1e66 Make the number of visible logs dynamic
It helps to see all the logs when switching to a bigger InputAndLogs
layout.
3 years ago
Arijit Basu 7496f5bf8f Disable mouse by default and bind `:m` to toggle
- Make mouse disabled by default.
- Add key binding `:m` to toggle mouse.

Closes: https://github.com/sayanarijit/xplr/issues/206
3 years ago
Arijit Basu b284124022 Optimize rendering speed by serializing less
Serializing to and from Lua value is expensive. Hence, once serialized,
we should reuse the value.
3 years ago
Arijit Basu 695acf5c1e Inherit node types config
Inherit `node_types` config instead of overwriting it.

Closes: https://github.com/sayanarijit/xplr/issues/200
3 years ago
Arijit Basu 88aedddf53 Fix rustc 1.50 compatibility 3 years ago
Arijit Basu b4247a7d03 Improve CallLua, mime_essence, permissions
Refs:
- https://github.com/sayanarijit/xplr/issues/187
- https://github.com/sayanarijit/xplr/issues/194
- https://github.com/sayanarijit/xplr/issues/195
3 years ago
Arijit Basu aa7a441751 Make mode visible in input/logs panel
Also, map ":q" to "quit" action.

Ref: https://github.com/sayanarijit/xplr/issues/158
3 years ago
Arijit Basu db669cdcbf Remove "remaps:"
Remaps has been removed to simplify key bindings. With Lua, it's now
possible to remap using basic assignments.

For e.g.

```Lua
xplr.config.modes.builtin.default.key_bindings.on_key["v"] = xplr.config.modes.builtin.default.key_bindings.on_key.space
```

Help menu will auto detect remapped keys and display after removing the
redundant mappings.

Ref: https://github.com/sayanarijit/xplr/discussions/183#discussioncomment-774159
3 years ago
Arijit Basu cb695fcaa7 Add colorful permissions
Ref: https://github.com/sayanarijit/xplr/issues/187
3 years ago
Arijit Basu b86be16ee3 Make structs public
Public structs enable automatec documentation.
xplr is not (yet) a library. Even it want to become one, making fields
private is probably not the right way.
3 years ago
Arijit Basu a80bf2d683 Final touches for v0.10.0 3 years ago
Arijit Basu 4da481bf5c Cleanup all the YAML overwriting logics 3 years ago
Arijit Basu 25a9d03237 Finish porting config.yml to init.lua 3 years ago
Arijit Basu da1d7742f7 Fully migrate to init.lua
This PR aims to fully migrate `config.yml` to `init.lua`

Also, use `builtin.foo_func` instead of `xplr.fn.builtin.foo_func`.
Similarly, use `custom.foo_func` instead of `xplr.fn.custom.foo_func`.

Closes: https://github.com/sayanarijit/xplr/issues/160
3 years ago
Arijit Basu 074e0d1250 Replace handlebars with Lua
Replace handlebars with Lua functions by introduction Lua function API.
3 years ago
Arijit Basu 8e98da5004 Add support for un-mapping keys.
Use `remaps: {key: null}` to un-map a key.

Also,
- `gx` will now open only the file under focus.
- `:sx` will open the selected files.

And other minor improvements.

Discussion: https://github.com/sayanarijit/xplr/discussions/146
3 years ago
Arijit Basu 7588620c8f Hind logs when switching to input mode
Ref: https://github.com/sayanarijit/xplr/pull/143#issuecomment-840069000
3 years ago
Arijit Basu c68bd96253 Add reckless mode
Pressing an invalid key will take you to the "reckless" mode. All you
need to do is calm down, escape that mode, and try again.

Closes: https://github.com/sayanarijit/xplr/issues/142
3 years ago
Arijit Basu 7c5468cabe Fix exploring and escaping paths
This PR targets 2 pain points.

1. The `Explore` message was async, which caused some unexpected
   behavior. This was fixed by splitting `Explore` into `ExplorePwd`,
   `ExplorePwdAsync` and `ExploreParentsAsync`. `ExploreParentsAsync`
   is similar to the former `Explore`, which is mainly used when loading
   `xplr` for the first time. However, what we'll be using frequently
   are `ExplorePwd` and `ExplorePwdAsync` messages.

2. Files with spaces caused some unexpected behavior. This was fixed by
   escaping the paths properly. This also fixed focusing of a file after
   creating or renaming it.

Anothor breaking change is that `XPLR_PIPE_FOCUS_OUT` has been removed.
`XPLR_FOCUS_PATH` is all we need. So, the rule of thumb is if a variable
contains one liner value, it can be used directly from the env vars.
Variables that can contain multi-line values, will be exposed via the
pipes.

Minor changes are

- Add `switch_mode` mode to the global key binding help menu
- Moved some UI related code from config.rs to ui.rs.
- Fixed compilation issue on `rustc 1.50.0`.
3 years ago
Arijit Basu 38812e733b Improve config inheritance for layout UI
With this commit, users will be able to define the common configuration
as super config and inherit from them in each layout.
3 years ago
Arijit Basu fd92d8ee01 Make modifiers more intuitive
It's difficult to calculate the bits for adding and removing modifiers.
With this commit, we be will use words `Bold`, `Italic` instead of `bits: x`.
3 years ago
Arijit Basu 59b55ee192 Add more UI styling options
With this commit, the following can be done:

- Define layout constraints based on screen size and relative panel
  size.
- Define borders.
- Define panel style.
- Define panel title and title style.
3 years ago
Arijit Basu cfa82cf99f Fix margin overwriting logic 3 years ago
Arijit Basu b8df831248 Add `Nothing` layout config inheritance workaround
Any layouts will default to `Nothing` which resembles blank screen.
However, they will be overwritten when there is a more specific layout
available either in the super config or in the sub config.
3 years ago
Arijit Basu b3e6679b50 Add feature dynamic UI
Now, users can change the UI layout via the `SwitchLayout{Builtin|Custom}`
message, or by using key `ctrl-w`.

There are 3 default layout options -

- default
- no_help
- no_selection
- no_help_no_selection

Also, the initial mode and the initial layout can be specified in the
config.

Closes: https://github.com/sayanarijit/xplr/issues/107
3 years ago
Arijit Basu 8ddc000895 Make config private 3 years ago
Arijit Basu 2470827aac Organize tests 3 years ago
Arijit Basu f38398e900 Make internals private 3 years ago
Arijit Basu 871a4c79aa
Fix divide by zero error 3 years ago
Arijit Basu ca13ebb193 Added inode size
Also supports sorting by inode size.

Closes: https://github.com/sayanarijit/xplr/issues/84
3 years ago
Arijit Basu b53f0c21bb Improve read-only mode
Do not include non-read-only actions in the in read-only mode. i.e. do
not display non-read-only actions in help menu.

Ref: https://github.com/sayanarijit/xplr/issues/22
3 years ago
Arijit Basu e70fa57228 Fix selection
Fixes: https://github.com/sayanarijit/xplr/issues/81
3 years ago