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

Make typeahead play better with different terminals #2594

Merged
merged 3 commits into from
Jan 14, 2017

Conversation

rogeliog
Copy link
Contributor

There are a some issues when using typeahead in different terminals mainly (xterm vs screen)

Issues that this PR fixes

1) The cursor is in weird positions when using Terminal.app

See sindresorhus/ansi-escapes#1 for more info about why this happens

To fix this instead of clearing the whole screen every time we are only clearing it then the user goes into pattern mode.

  • For terminals that do not support ansiEscapes.cursorRestorePosition we use ansiEscapes.cursorTo as a fallback
  • For terminals that do support ansiEscapes.cursorRestorePosition we use that.
NOTE: This also fixes an issue where the cursor in iTerm2 jumps around

terminal-app-issue-before-and-after

2) Killing the process while the typeahead is active leaves some ghost characters.

Before
kill-typeahead-issue
After
kill-typeahead-issue-after

I've been testing typeahead mode in the following environments and it seems fine.

  • iTerm2
    • with zsh
    • with bash
  • Hyper
  • Terminal.app
    • with tmux
    • with a Docker container
    • with sh
    • with bash
    • with zsh

Here is a mega gif how it works in each and every env
NOTE: I had some weird issues with my terminal half way through the video, feel free to either ignore it or troll me.

mega-gif

Final Notes

@cpojer
Copy link
Member

cpojer commented Jan 14, 2017

super solid work. Thanks @rogeliog. I'm really impressed.

@cpojer cpojer merged commit 6db4e1e into jestjs:master Jan 14, 2017
skovhus pushed a commit to skovhus/jest that referenced this pull request Apr 29, 2017
* Make typeahead more cross terminal.

* Clear typeahead on exit and fix flow error

* Update watch-pattern-mode-test.js
tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
* Make typeahead more cross terminal.

* Clear typeahead on exit and fix flow error

* Update watch-pattern-mode-test.js
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants