Commit Graph

297 Commits

Author SHA1 Message Date
Arijit Basu
84a50a8fde Add CallLua and CallLuaSilently
This works:

```lua
xplr.fn.custom.ping = function(app)
  print("What's your name?")
  local name = io.read()
  os.execute('read -p "Hello ' .. name .. ', you are in ' .. app.pwd .. '"')
  return {
    { LogSuccess = "pong" },
  }
end
```

Then it can be called via `CallLua: custom.ping`.
2021-05-22 21:08:21 +05:30
Arijit Basu
cdb3560e12 Read input pipe only once when commands execute
The initial idea was to enable other tools to control `xplr` via the
input pipe. However, so far I didn't feel the need to use this feature.
And even if there is any need, it's much better to implement ad-hoc
services instead of wasting cpu resources.
2021-05-22 19:04:52 +05:30
Arijit Basu
10e874afe7 Fall back to default config when custom config fails
When the custom `init.lua` is corrupt, xplr will fall back to default
configuration, logging the encountered error after load.
2021-05-22 16:17:03 +05:30
Arijit Basu
f9d13e5e4c Fix initial directory sync issue 2021-05-22 14:46:16 +05:30
Arijit Basu
4da481bf5c Cleanup all the YAML overwriting logics 2021-05-22 14:25:27 +05:30
Arijit Basu
25a9d03237 Finish porting config.yml to init.lua 2021-05-22 14:25:27 +05:30
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
2021-05-22 14:25:27 +05:30
Arijit Basu
0a2f2aeda8 Fix version 2021-05-22 01:15:16 +05:30
Arijit Basu
eb06342523 Update version 2021-05-22 01:07:36 +05:30
Arijit Basu
e977aeb7d3 Fix MacOS error directory not empty
With this change, xplr will delete the pipe files when command execution
is over.
2021-05-22 00:54:18 +05:30
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
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
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
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
Arijit Basu
c0c4f27ef8 Update version 2021-05-01 20:53:00 +05:30
Arijit Basu
2c7ec47253 Fix cd on first focus
Fix issue where running `xplr /path/to/file` doesn't `cd` into the
parent directory.
2021-05-01 20:31:46 +05:30
Arijit Basu
1c967cfef6 Update version 2021-04-30 17:40:51 +05:30
aflying pumpkin
c9d62d6061 Fixed indentation
Fixed indentation
2021-04-30 10:13:44 +05:30
aflying pumpkin
d0fd1c6bce added ctrl-n and ctrl-p as rebinds for down and up inside of search mode, to improve usability 2021-04-30 10:13:44 +05:30
Arijit Basu
36af3e8ced Fix pipes not updating properly
Let's not optimize things until we have tests.
2021-04-29 08:27:56 +05:30
Arijit Basu
4dad10815a Fix support for filenames starting with - (hiphen)
Make it possible to create, delete, copy, move, rename filenames starting
with a - (hiphen).
2021-04-28 08:09:40 +05:30
Arijit Basu
2437fd67cf Fix distorted screen when opening files in GUI
Fixes: https://github.com/sayanarijit/xplr/issues/111
2021-04-27 23:58:00 +05:30
Arijit Basu
8ddc000895 Make config private 2021-04-26 12:45:07 +05:30
Arijit Basu
2470827aac Organize tests 2021-04-26 12:45:07 +05:30
Arijit Basu
f38398e900 Make internals private 2021-04-26 12:45:07 +05:30
Arijit Basu
33e500a16d Move pipe writing logic from runner to app
Ref: https://github.com/sayanarijit/xplr/issues/103
2021-04-26 12:45:07 +05:30
Arijit Basu
eca35c73a2 Update version 2021-04-24 22:22:32 +05:30
Arijit Basu
d0c5801474 Fix terminal output redirection when piping stdout
Now, when you do `xplr > out.txt` and invoke the terminal, the stdout
won't be redirected.
2021-04-24 08:57:26 +05:30
Arijit Basu
d81111c134 Reduce col_spacing to 1 2021-04-23 14:53:20 +05:30
Arijit Basu
014043d330 Fix formatting the global help menu 2021-04-23 12:58:07 +05:30
Arijit Basu
e9b5dfe478 Fix incompatible config version
Fixes: https://github.com/sayanarijit/xplr/issues/97
2021-04-23 11:04:58 +05:30
Arijit Basu
36c2c9cc2b
Update version 2021-04-23 00:17:43 +05:30
Arijit Basu
1a08318593 Improve CPU usage attempt 2
Fixes: https://github.com/sayanarijit/xplr/issues/10
2021-04-22 22:53:31 +05:30
Arijit Basu
871a4c79aa
Fix divide by zero error 2021-04-22 11:50:43 +05:30
Arijit Basu
1ffa85f30f Do not exit on permission denial
While trying to enter restricted directories, log error instead or
exiting.
2021-04-21 08:28:02 +05:30
Arijit Basu
2e541fbf04
Minor UI improvement 2021-04-20 21:35:06 +05:30
Arijit Basu
ad3dd8eec2
Update version 2021-04-20 21:20:28 +05:30
Arijit Basu
785c20de13 Sync pwd
Sync session's $PWD with `xplr`'s current directory.
If you use alacritty, every window will open in `xplr`'s current
directory.
2021-04-20 20:56:16 +05:30
Arijit Basu
c11099f651 Fix follow symlink behavior.
Use `gf` to follow symlinks instead of `enter`/`l`.

Or use the message `FollowSymlink`.
2021-04-19 23:23:28 +05:30
Arijit Basu
87cd6ff015 Fix global help menu not displaying sort & filter 2021-04-19 21:01:20 +05:30
Arijit Basu
1f99e8ba99 Follow file symlinks
Follow symlink to files to it's parent directory.

Also, hide file size for directories.

Ref: https://github.com/sayanarijit/xplr/issues/84
2021-04-19 18:32:00 +05:30
Arijit Basu
1783834a2e Fix ctrl-l breaking UI
Also improve the filter mode key bindings

Fixes: https://github.com/sayanarijit/xplr/issues/88
2021-04-19 17:23:42 +05:30
Arijit Basu
ca13ebb193 Added inode size
Also supports sorting by inode size.

Closes: https://github.com/sayanarijit/xplr/issues/84
2021-04-19 14:48:45 +05:30
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
2021-04-19 14:33:42 +05:30
Arijit Basu
21f87d6a08 Add read-only mode
Ref: https://github.com/sayanarijit/xplr/issues/22
2021-04-19 10:27:27 +05:30
Arijit Basu
4d21a89050 Use ctrl-r to refresh, ctrl-l to clear selection 2021-04-19 00:58:04 +05:30
Arijit Basu
e70fa57228 Fix selection
Fixes: https://github.com/sayanarijit/xplr/issues/81
2021-04-19 00:58:04 +05:30
Arijit Basu
9fce3b1d14 Fix space input 2021-04-19 00:45:41 +05:30
Arijit Basu
1bb2622f24 Improve key inputs
Add support proper implementations of -

- backspace
- ctrl-w
- ctrl-u

Also, improved sort and filter behavior.

Fixes: https://github.com/sayanarijit/xplr/issues/77
2021-04-19 00:00:43 +05:30
Maxim Baz
468cf7f3df Allow empty icons 2021-04-18 20:24:13 +05:30
Arijit Basu
f582f49ad8 Make search and filter case insensitive 2021-04-18 16:57:33 +05:30
Arijit Basu
1546ba0a75 Add filter key binding 2021-04-18 16:57:33 +05:30
Arijit Basu
a8896740c8 Add sorting support
Also improve filtering.

Closes: https://github.com/sayanarijit/xplr/issues/58
2021-04-18 16:14:17 +05:30
Arijit Basu
bbd5c1ba8b
Map V to ctrl-a 2021-04-15 15:58:39 +05:30
Arijit Basu
3ab9bcb4c9 Fix UI style priority
Fixes: https://github.com/sayanarijit/xplr/issues/68
2021-04-15 15:55:06 +05:30
Arijit Basu
54bad4aa09 Add mode selection commands
- SelectAll
- SelectPath
- UnSelectAll
- UnSelectPath
- ToggleSelectAll
- ToggleSelectionByPath
2021-04-15 14:36:52 +05:30
Arijit Basu
1dba3d5e8e Fix overwriting of default config.
This fixes the overwriting of default configuration.

Also, add tests to validate the new logic.

Fixes: https://github.com/sayanarijit/xplr/issues/68
2021-04-15 13:55:42 +05:30
Arijit Basu
0c82a645d9 Add history pipe 2021-04-14 21:16:16 +05:30
Arijit Basu
d0342260fe Add support for NO_COLOR
Also, add `general.logs` to the config.

Ref: https://no-color.org/
2021-04-14 08:38:00 +05:30
Arijit Basu
af1cda5762 Better symlink support
Closes: https://github.com/sayanarijit/xplr/issues/37
2021-04-13 08:48:50 +05:30
Arijit Basu
0d4cd29a08 Fix panic on permission denied
Issue:
$PWD watch service panics when visiting restricted directories.

Fix:
Log error instead of panic.
2021-04-13 08:01:20 +05:30
Arijit Basu
ea42b1969a Improve scrolling behaviour
Closes: https://github.com/sayanarijit/xplr/issues/54
2021-04-12 21:51:59 +05:30
Arijit Basu
c640edc4d9
Improve number mode clear behaviour 2021-04-12 12:16:59 +05:30
Arijit Basu
49ffd8e1f1 Fix exit error codes
Also remove cucumber-rust (will try https://github.com/rust-rspec/rspec)

Fixes: https://github.com/sayanarijit/xplr/issues/33
2021-04-12 11:13:31 +05:30
Arijit Basu
55e1a6a0fa Add basic history navigation
Use `ctrl-i` (tab) and `ctrl-o` to navigate history.

Closes: https://github.com/sayanarijit/xplr/issues/49
2021-04-12 11:03:57 +05:30
Arijit Basu
f247acf626 Fix remap behaviour and help menu
Remapping a key should overwrite default. Also, remapped keys shouldn't
be redundantly visible in help menu.

Also, display log time.
2021-04-11 22:22:36 +05:30
Arijit Basu
055c1083d6 Support easier key remaps
Also,

- Add key binding `~` to go to homedir.
- Add customizable cursor and prompts.
- Improve the help menus.
2021-04-11 21:15:01 +05:30
Arijit Basu
080e1686f3 Improve version compatibility
From this version, xplr won't annoy the users to visit the upgrade guide
when there is no need.

Also, users will only get upgrade related notification when it is
there is one.
2021-04-11 21:15:01 +05:30
Arijit Basu
3598be0f19 Improve config defaults
- Rename `custom` field for node metadata to `meta`.
- Move `icon` to `meta.icon`.
- Rename `normal_ui` to `default_ui`.
- Rename `filetypes` to `node_types`.
- Split `modes` into `modes.builtin` and `modes.custom`.
- Add the missing `create file` mode.
- Rename `focused_ui` to `focus_ui`.
- Make `general.table.header` non-nullable.
- Add support for incremental configuration updates.

Ref: https://github.com/sayanarijit/xplr/issues/45
2021-04-11 21:15:01 +05:30
Arijit Basu
6aa3df301e Separate config.yml file from rust files
Also be less aggressive for version compatibility.

Use the following logic:

Knowing that we use `{major}.{minor}.{patch}` versioning,

- Major version mismatch are incompatible. Fail with error, suggesting to
  visit the Upgrade Guide.
- Minor version updates and patch fixes are compatible. Suggest user to
  update the config file version manually. Or visit the Upgrade Guide.

- However, if the config file has greater value for minor version
  than the app, also fail with error. Suggesting the user to visit Upgrade
  Guide. Though in this case, the user will be downgrading.

Ref: https://github.com/sayanarijit/xplr/issues/45
2021-04-09 23:57:39 +05:30
Arijit Basu
233f6d44a5
Update version 2021-04-09 16:26:45 +05:30
Arijit Basu
2af1b4c70a
Fix exit screen 2021-04-09 15:50:09 +05:30
Arijit Basu
2596c0c4c3 Remove task priority
Since we are now blocking on task inputs, the priority is no longer
required.
2021-04-09 15:29:05 +05:30
Arijit Basu
5030749ab1
Use cp -vr instead of cp -v 2021-04-09 14:32:53 +05:30
Arijit Basu
9f78a1fcff Ability to call commands silently
Some commands doesn't require to capture stdout and stderr.
They can be called without needing to reset the screen.

Add `CallSilently` and `BashExecSilently` to execute those commands
faster.

Also, some optimization.
2021-04-09 14:28:32 +05:30
deadjakk
be2911e073 Fixed error preventing compilation
Removed comma.

Error was as follows:
error: no rules expected the token `,`
   --> src/input.rs:373:29
    |
373 |                 | Self::Num9,
    |                             ^ no rules expected this token in macro call

error: aborting due to previous error
2021-04-09 12:07:19 +05:30
Arijit Basu
588a50af7e Add support for custom metadata for table row UI
Example:

```yaml
filetypes:
  directory:
    custom:
      foo: bar
     ...
```

Where `foo` and `bar` can be anything string.

It can be accessed with the `{{{custom.foo}}}` variable.
2021-04-09 11:57:24 +05:30
Arijit Basu
a68fec0c11
No need to clone selection 2021-04-09 10:56:39 +05:30
Arijit Basu
b50ce48264
Revert "Optimize the main thread"
This reverts commit 097c9dd8c5.

Queued tasks might create unexpected issues. We need a test suit first.
2021-04-09 10:54:20 +05:30
Arijit Basu
097c9dd8c5 Optimize the main thread 2021-04-09 10:51:48 +05:30
Arijit Basu
b9e9601a71
Fix failed build and update version 2021-04-09 08:21:30 +05:30
Arijit Basu
b5986c59d6 Fix logs for being written in the pipe
Don't depend on `Refresh`, always write to the pipes.
2021-04-09 08:06:32 +05:30
Arijit Basu
2b0572228d
Draw once
Draw on the terminal only once i.e. when `Refresh`ing.
2021-04-09 07:18:47 +05:30
Arijit Basu
ededb49bd4
Fix the help menu
`esc` no longer exits from the `default` mode.
2021-04-09 07:00:56 +05:30
Maxim Baz
70a3794857 Fix symlink support
canonicalize() and metadata() both resolve symlinks, thus showing symlinks as regular files
2021-04-09 06:43:58 +05:30
Arijit Basu
c06a3cb51e
Update version 2021-04-09 04:19:26 +05:30
Arijit Basu
6d0ea06d7b Add pwd watcher
Also optimize the main thread.
2021-04-09 04:19:44 +05:30
Arijit Basu
0a3cf7b5c1
Update version 2021-04-09 01:29:38 +05:30
Arijit Basu
832016bb18 Stay in search mode when entering or leaving a directory
This might be a little counter intuitive to the `nnn` users, but I think
this will add to the productivity and should be the default.

Since we have a real-time mode indicator, users shouldn't face much of
an issue switching to the alternate default.
2021-04-09 01:12:26 +05:30
Arijit Basu
1e7e2ecc2f Add :e for "open in editor" 2021-04-08 18:48:29 +05:30
Arijit Basu
fa4d4168cd Don't quit on esc
Issue:
`esc` is generally used to get back to the `default` mode and mistakenly
pressing `esc` while in `default` mode will annoyingly terminate the
session.

Fix:
Remove `esc` from the `default` mode's key bindings. Use `q` or `crtl-c`
instead.
2021-04-08 14:44:10 +05:30
Arijit Basu
fa37cd1c10 Improve search and filter
Concern:
Using `ResetNodeFilters` to clear the filters while searching or exiting
from search unexpectedly resets the `show hidden` mode because the
action not only removes the target filter, it resets all the other
filters as well.

Solution:
Implement `RemoveNodeFilterFromInput` to be able to clear or remove
target filters without having to reset it.
2021-04-08 08:01:10 +05:30
Arijit Basu
e2b49ab4fd Display help menu using $PAGER
Also, use `open` to open files when `xdg-open` is missing.
2021-04-08 08:00:44 +05:30
Arijit Basu
45a95a792d Clear screen before exit 2021-04-08 07:42:31 +05:30
Arijit Basu
91a319fc80
Update version 2021-04-07 19:57:25 +05:30
Arijit Basu
57494f8ebf Do not print command outputs to the main screen.
Print all the outputs of xplr commands on the alternate screen. Not on
the real stdout.
2021-04-07 19:22:33 +05:30
Arijit Basu
7661019fd9 Make dir colors cyan
Fixes: https://github.com/sayanarijit/xplr/issues/11
2021-04-07 18:43:22 +05:30
Arijit Basu
23b51cf8fe
Fix failed build and re-publish 2021-04-07 03:06:47 +05:30
Arijit Basu
2bd2b743fb
Fix renaming 2021-04-07 02:42:20 +05:30
Arijit Basu
a484c2fd39
Update default.nix 2021-04-07 02:14:43 +05:30
Arijit Basu
e34755b11b Update version
Also fix nix hash
2021-04-07 01:59:02 +05:30
Arijit Basu
09abda29a3 Several optimizations
- Write to pipes only when the value changes.
- Sleep when not reading key event or messages.

Fixes: https://github.com/sayanarijit/xplr/issues/10
2021-04-07 01:59:02 +05:30
Arijit Basu
65ddb0ee4b
Release 0.3.2 2021-04-06 18:55:57 +05:30
Arijit Basu
53fd92b680 Fix debug formatting 2021-04-06 18:33:59 +05:30
Arijit Basu
65b7412579 Add XPLR_APP_VERSION and XPLR_CONFIG_VERSION
Since users don't need to update config file version for minor app
releases, we have to differentiate between app and config version.

Also, expose them via `$XPLR_CONFIG_VERSION` and `$XPLR_APP_VERSION`.
2021-04-06 18:23:19 +05:30
Arijit Basu
0272284f40
Fix print formatting 2021-04-06 17:40:16 +05:30
Quentin Guilloteau
a9309a52c0 add comment to remind to update the version in the default.nix file 2021-04-06 16:59:58 +05:30
Arijit Basu
175699ac63
Expose $XPLR_PIPE_MODE_OUT
Also, add new line character to `$XPLR_PIPE_MODE_OUT` and
`$XPLR_FOCUS_PATH` for consistency.
2021-04-06 07:52:37 +05:30
Arijit Basu
eeee3394bc Improve version incompatibility error
With this change, `xplr` will only raise version incompatibility error
if the major version changes. Minor version updates are assumed to be
backwards compatible.

If the major version is `v0`, the minor version will be considered as
the major version and the security/patch version will be considered as
minor version and the same logic will apply.
2021-04-06 06:43:51 +05:30
Arijit Basu
981ead8c36 Fix large env vars breaking the subprocess
Bug:
When you call some command in a directory with a large number of hosts,
xplr will fail setting the environment vars as the command will become
too large to handle.

Fix:
Port the value of multi-line variables from env vars to pipes and set
the name of the pipe as env var instead. And deprecate the variables
that doesn't make much sense.

In other words,

- `$XPLR_APP_YAML` has been removed.
- `$XPLR_RESULT` has been ported to `$XPLR_PIPE_RESULT_OUT`.
- `$XPLR_GLOBAL_HELP_MENU` has been ported to
  `$XPLR_PIPE_GLOBAL_HELP_MENU_OUT`.
- `$XPLR_DIRECTORY_NODES` has been ported to
  `$XPLR_PIPE_DIRECTORY_NODES_OUT`.
- `$XPLR_LOGS` has been ported to `$XPLR_PIPE_LOGS_OUT`.
- `$XPLR_PIPE_RESULT` has been ported to `$XPLR_PIPE_RESULT_OUT`.

Hence, instead of `<<< $VAR`, `< $VAR_PIPE_OUT` should be used.
2021-04-05 20:28:35 +05:30
Arijit Basu
9747c8667b Autocomplete the relative path while renaming
By default, while renaming a file, autocomplete the relative path i.e.
the filename instead of the absolute path in the input buffer.
2021-04-05 13:50:53 +05:30