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 Ctrl+U shortcut #1703

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nuckle
Copy link

@nuckle nuckle commented Dec 13, 2024

Description

Closes this issue - #1689

Screenshots

Before pressing Ctrl+U Before pressing Ctrl+U
After pressing Ctrl+U After pressing Ctrl+U

Additional information

This shortcut needs to be listed here - https://github.com/JustArchiNET/ASF-ui/wiki/Features#shortcuts

Checklist

  • My pull request is not a duplicate
  • I added a descriptive title to this pull request
  • I added a concise description or a self-explanatory screenshot to this pull request
  • My code follows the code style of this project
  • I have performed a self-review of my own code

@JustArchi JustArchi requested a review from MrBurrBurr December 13, 2024 11:56
Copy link
Member

@Aareksio Aareksio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If nextTick works here, I'd use it instead of setTimeout

@nuckle
Copy link
Author

nuckle commented Dec 13, 2024

Like so?

      jumpToStart() {
        const el = this.$refs['terminal-input'];
        if (el.setSelectionRange) el.setSelectionRange(0, 0);
      },

      deleteBeforeCursorAndJumpToStart() {
        this.removeBeforeCursor();
        this.$nextTick(() => {
          this.jumpToStart();
        })
      },

@Aareksio
Copy link
Member

Aareksio commented Dec 18, 2024

I'd just replace setTimeout with next tick:

if (el.setSelectionRange) {
  this.$nextTick(() => el.setSelectionRange(0, 0));
}

I do not know why you require setTimeout in the first place, but nextTick should achieve similar result

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.

2 participants