Commit Graph

424 Commits

Author SHA1 Message Date
Arijit Basu
003e90a7d1 Improve history further 2021-05-21 23:58:15 +05:30
Arijit Basu
97aa2ff8b4 Fix initial focus 2021-05-21 23:58:15 +05:30
Arijit Basu
5b2aee3479 Improve history navigation
Make path history behave like jump list and allow jumping back and
forth in the same directory.
2021-05-21 21:53:50 +05:30
Arijit Basu
5c179a9b70 Add optional mouse handler
Mouse actions will be enabled on devices that support it.
Because sometimes, scrolling with mouse is the laziest way to navigate.
2021-05-21 18:45:17 +05:30
Arijit Basu
d96e620120 Begin porting config.yml to init.lua
This commit begins porting of `config.yml` to `init.lua`.
As of now, it's not be possible to do the complete migration
because of how lua and yaml handles `null`/`nil` value.

So, we will need to completely deprecate `config.yml` in order to do the
complete migration.
2021-05-21 16:28:06 +05:30
Arijit Basu
074e0d1250 Replace handlebars with Lua
Replace handlebars with Lua functions by introduction Lua function API.
2021-05-21 16:28:06 +05:30
Arijit Basu
85696ded7a
Hide demo to speed to page load 2021-05-19 07:15:10 +05:30
Arijit Basu
79855dba15 Fix CallSilently
Closes: https://github.com/sayanarijit/xplr/issues/163
2021-05-18 22:27:18 +05:30
Arijit Basu
6cc863e6d4 Add send+anyhow support for mlua
Ref: https://github.com/khvzak/mlua/issues/48
2021-05-18 16:26:44 +05:30
Arijit Basu
f744553a0a Add support for native lua bindings
Ref: https://github.com/sayanarijit/xplr/discussions/146#discussioncomment-741580
2021-05-18 15:52:51 +05:30
Arijit Basu
98687515d7
Use editor to open the focus path 2021-05-17 09:06:54 +05:30
Arijit Basu
7eabd3fb7d Fix selecting broken symlink 2021-05-14 23:29:58 +05:30
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
2021-05-14 23:11:18 +05:30
Arijit Basu
57a0a49aae Hide logs also when calling subprocess 2021-05-13 13:52:43 +05:30
Arijit Basu
c5b461f795 Increase the input poll timeout
The input poll timeout needs to stay low, else xplr will panic when you
spawn a subshell and start typing immediately.

From the `top` command, it didn't show any noticeable overhead.
2021-05-13 13:33:23 +05:30
Arijit Basu
d944828d2f Minor improvements in some operations 2021-05-13 13:33:23 +05:30
Arijit Basu
96f3640fc0 Rename reckless to recover
Also, improve the warning message.
2021-05-13 13:33:23 +05:30
Arijit Basu
ae8a391064 Introduce PopMode
This change requires manual `Refresh` after mode switches.
Also, fix the rename operation.
2021-05-13 13:33:23 +05:30
Arijit Basu
7588620c8f Hind logs when switching to input mode
Ref: https://github.com/sayanarijit/xplr/pull/143#issuecomment-840069000
2021-05-13 13:33:23 +05:30
Arijit Basu
65fa408fea Stay in filter mode after applying filters
Also stay in create mode after creating files and directories.
2021-05-13 13:33:23 +05:30
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
2021-05-13 13:33:23 +05:30
Arijit Basu
efec86c616 Clear selection after copy 2021-05-12 23:15:47 +05:30
Arijit Basu
e0f8207900 Improve key bindings
Stay in the current mode when key input is not recognised. It's better
to do nothing than doing something wrong, at least when dealing with
important files and folders.
2021-05-12 23:15:47 +05:30
Arijit Basu
c8dba61d4b Further optimize performance and CPU usage
- Optimize by avoiding cloning the whole app in each iteration of the main
loop.
- Increase the input poll timeout from 1 to 200. This works because the
poll will not apply to key hold.
- Do not read input pipe if it hasn't been modified.
2021-05-12 23:03:00 +05:30
Arijit Basu
e7ec27e359
Add commtit activity badge
Pretty active!
2021-05-11 20:52:54 +05:30
Arijit Basu
11a5ca168f
Update CONTRIBUTING.md 2021-05-11 18:01:33 +05:30
Arijit Basu
161b5fb1fe
Update CONTRIBUTING.md 2021-05-11 17:42:38 +05:30
Arijit Basu
67df321cd9
Update CONTRIBUTING.md 2021-05-11 17:42:13 +05:30
Arijit Basu
7f1d29f558
Create CONTRIBUTING.md 2021-05-11 17:24:09 +05:30
Arijit Basu
82b975c5f0 Fix some sync issues
Handle out messages immediately instead or scheduling in messages.
2021-05-11 14:38:43 +05:30
Arijit Basu
cd5bf81646 Optimize performance
```
Benchmarking focus next item: Collecting 100 samples in estimated 5.1972 s (126k itera                                                                                      focus next item         time:   [41.216 us 41.346 us 41.494 us]
                        change: [-28.669% -28.110% -27.551%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe

Benchmarking focus previous item: Collecting 100 samples in estimated 5.0576 s (116k i                                                                                      focus previous item     time:   [43.589 us 43.754 us 43.927 us]
                        change: [-29.506% -28.748% -28.039%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe

Benchmarking focus first item: Collecting 100 samples in estimated 5.1765 s (116k iter                                                                                      focus first item        time:   [44.071 us 44.340 us 44.634 us]
                        change: [-26.739% -26.314% -25.885%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  8 (8.00%) high mild
  4 (4.00%) high severe

Benchmarking focus last item: Collecting 100 samples in estimated 5.1522 s (116k itera                                                                                      focus last item         time:   [43.950 us 44.214 us 44.541 us]
                        change: [-27.571% -26.953% -26.337%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  5 (5.00%) high mild
  6 (6.00%) high severe

Benchmarking leave and enter directory: Collecting 100 samples in estimated 5.4863 s (                                                                                      leave and enter directory
                        time:   [96.645 us 96.915 us 97.234 us]
                        change: [-28.720% -27.224% -25.666%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  6 (6.00%) high mild
  3 (3.00%) high severe
```
2021-05-11 12:10:57 +05:30
Arijit Basu
e9680d9abd Optimize release binary size
Also improve the $PWD watcher logic.
2021-05-11 02:16:34 +05:30
Arijit Basu
9597e78387 Remove unused dev dependencies
For now, we're only using criterion. I hope we bring them back soon with
real purpose.
2021-05-11 01:54:22 +05:30
Arijit Basu
b64d6b59a5 Remove dependency notify
Using a whole crate just to watch `$PWD` for the last modification time
was a overkill.
2021-05-11 01:54:22 +05:30
Arijit Basu
50d6edb168 Fix search 2021-05-10 00:51:39 +05:30
Arijit Basu
3e812045e6
Fix release 2021-05-10 00:25:34 +05:30
Arijit Basu
92545f6387 Fix rename breaking UI 2021-05-10 00:18:25 +05:30
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`.
2021-05-09 23:23:46 +05:30
Arijit Basu
52fbaef189 Fix displaying global help menu
Also support toggle selection in search mode.
And use a pager to display logs.
2021-05-08 22:58:33 +05:30
Arijit Basu
9e89c6503d Use key tab to select files in search mode
Select files fzf style in search mode, without losing the search input.

Also, make background tasks failsafe and measure ui rendering.
2021-05-08 19:57:38 +05:30
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.
2021-05-08 17:11:44 +05:30
Arijit Basu
0270fecec9 Read pipes in a safer way.
Do not close the input pipe file after reading. Instead, read it, empty
it, then close it.
2021-05-08 13:49:59 +05:30
Arijit Basu
3aa349f614 Don't refresh pipes on every iteration
From this commit, the app state will be written to the output pipes only
when invoking a command.

For auto refreshing pipes, we can brainstorm on `service`s concept.
2021-05-08 13:11:26 +05:30
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`.
2021-05-08 12:44:08 +05:30
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.
2021-05-08 12:44:08 +05:30
Arijit Basu
cfa82cf99f Fix margin overwriting logic 2021-05-08 12:44:08 +05:30
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.
2021-05-08 12:44:08 +05:30
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
2021-05-08 12:44:08 +05:30
Arijit Basu
474c17b493
Minor fix 2021-05-07 20:08:16 +05:30
Arijit Basu
0584a43c7c Add SwitchModeBuiltin and SwitchModeCustom
Also, use a better prompt symbol.

Ref: https://github.com/sayanarijit/xplr/issues/107
2021-05-07 20:08:52 +05:30