Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ~reckless~ recover mode #143

Merged
merged 7 commits into from
May 13, 2021
Merged

Add ~reckless~ recover mode #143

merged 7 commits into from
May 13, 2021

Conversation

sayanarijit
Copy link
Owner

@sayanarijit sayanarijit commented May 12, 2021

Pressing an invalid key will take you to the recklessrecover mode. All you
need to do is calm down, escape that mode, and try again.

Closes: #142

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: #142
@maximbaz
Copy link
Contributor

  1. Pressing Esc in default mode should not get you into reckless mode (map Esc to noop?)
  2. What I'm thinking most is whether it's a good idea to make esc from reckless mode into default mode, as opposed to get you to the last mode where I was. I have a feeling that getting to the last mode would be much more user-friendly.

To expand on the second point, I think in general keeping a stack of modes could be useful. For example, when you enter sort menu, you can press e, then n, and you stay in sort menu all along, after pressing e you are not being thrown into default mode, you dont have to re-enter sort - NICE.

When entering filter menu, then pressing r and filtering on something, I'd intuitively expect to get back to filter mode, not to default mode. Maybe it's just me though, but I often filter using several words and it's quite annoying to re-enter the mode every time...

And now with reckless mode, whether you are in sort or filter mode, pressing a wrong key will drop you to default mode...

And final point: once I pressed wrong key at least once, I will see the log warning forever. Have you considered to clear that warning at some point?

Especially in this scenario:

  1. Get somehow into reckless mode - warning appears.
  2. Go to filter mode, press r - warning is replaced with text prompt.
  3. Once I finish entering my filter and press Enter - warning reappears, as if I just did something wrong. It shouldn't appear I think.

In addition to not re-showing the warning once text prompt was shown, I would also maybe consider hiding the log on such events:

  • Pressing Esc in default mode
  • After some time interval after showing the warning (10s?)
  • When entering some other mode (e.g. from default to filter)

If I want to see the logs, I can always do :l (although I never tried before, and right now this keypress is not doing anything for me, I'm not sure what did I break already or how it's supposed to work 😅 )

Sorry if I went too much offtopic here 😁

@sayanarijit
Copy link
Owner Author

sayanarijit commented May 12, 2021

1. Pressing Esc in default mode should not get you into reckless mode (map Esc to noop?)

2. What I'm thinking most is whether it's a good idea to make `esc` from reckless mode into _default_ mode, as opposed to get you to the _last_ mode where I was. I have a feeling that getting to the last mode would be much more user-friendly.

To expand on the second point, I think in general keeping a stack of modes could be useful. For example, when you enter sort menu, you can press e, then n, and you stay in sort menu all along, after pressing e you are not being thrown into default mode, you dont have to re-enter sort - NICE.

When entering filter menu, then pressing r and filtering on something, I'd intuitively expect to get back to filter mode, not to default mode. Maybe it's just me though, but I often filter using several words and it's quite annoying to re-enter the mode every time...

And now with reckless mode, whether you are in sort or filter mode, pressing a wrong key will drop you to default mode...

And final point: once I pressed wrong key at least once, I will see the log warning forever. Have you considered to clear that warning at some point?

Especially in this scenario:

1. Get somehow into reckless mode - warning appears.

2. Go to filter mode, press `r` - warning is replaced with text prompt.

3. Once I finish entering my filter and press Enter - warning reappears, as if I just did something wrong. It shouldn't appear I think.

In addition to not re-showing the warning once text prompt was shown, I would also maybe consider hiding the log on such events:

* Pressing Esc in default mode

* After some time interval after showing the warning (10s?)

* When entering some other mode (e.g. from default to filter)

If I want to see the logs, I can always do :l (although I never tried before, and right now this keypress is not doing anything for me, I'm not sure what did I break already or how it's supposed to work sweat_smile )

Sorry if I went too much offtopic here

Really appreciate for the detailed feedback. I agree with most of the points. As for the hiding logs, I also though it'd be a good idea, but I refrained from doing it expecting someone to complain about it, because it's a trade-off - do you want to see all the logs? Or you prefer a clean UI and only the most relevant info even at the cost of missing potential critical info like an error log.

But yes, I agree seeing the old log after the input field disappears is really confusing and should not be shown.

However, hiding the log by -

  • Pressing Esc in default mode - I wouldn't because I expect the users to keep pressing esc several times even in default mode after switching back from a deep nested mode. Expected behavior should be - "Nothing happens".
  • After some time interval after showing the warning (10s?) - Probably. Super easy to do.
  • When entering some other mode (e.g. from default to filter) - Could be fine when switching from default to some other mode, but not vice versa. Hence, the implementation won't be super pretty. But when switching from any other to input mode could be doable.

although I never tried before, and right now this keypress is not doing anything for me, I'm not sure what did I break already or how it's supposed to work

In 52fbaef I started showing logs in ${PAGER:-less} by piping the output to it via stdin. This is to support scrolling and searching, like the global key bindings with ?.

Also stay in create mode after creating files and directories.
@sayanarijit
Copy link
Owner Author

Another possibly useful feature:
Stay in create file/directory mode after creating files or directories.

@sayanarijit
Copy link
Owner Author

After some time interval after showing the warning (10s?) - Probably. Super easy to do.

I don't think this is necessary because we can use /<esc> to hide the logs, probably avoiding the negligible overhead of running Local::now() of every refresh.

@sayanarijit
Copy link
Owner Author

Updated the PR to with the hide logs logic and persistent filters.

@sayanarijit
Copy link
Owner Author

TODO transition from reckless to prev mode.

@sayanarijit
Copy link
Owner Author

Done with PopMode.

This change requires manual `Refresh` after mode switches.
Also, fix the rename operation.
Also, improve the warning message.
@sayanarijit sayanarijit changed the title [Proof of concept] Add reckless mode [Proof of concept] Add ~reckless~ recover mode May 13, 2021
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.
@sayanarijit sayanarijit changed the title [Proof of concept] Add ~reckless~ recover mode Add ~reckless~ recover mode May 13, 2021
@sayanarijit
Copy link
Owner Author

I think this is good enough. Let's try it out.

@sayanarijit sayanarijit merged commit c5b461f into main May 13, 2021
sayanarijit added a commit that referenced this pull request May 13, 2021
@maximbaz
Copy link
Contributor

Looking good 🙂

@sayanarijit sayanarijit deleted the add/reckless-mode branch May 13, 2021 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the key bindings further (add reckless mode)
2 participants