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

Fix CLI screen corruption #1704

Merged
merged 4 commits into from
Jul 30, 2018
Merged

Fix CLI screen corruption #1704

merged 4 commits into from
Jul 30, 2018

Conversation

penrods
Copy link
Contributor

@penrods penrods commented Jul 24, 2018

The CLI would often have temporary screen corruption. This reworks
several things to correct that issue, although it looks like the
ultimate cause was drawing to the screen while in the middle of
waiting on a VT100 ESC keycode sequence.

  • Rearchitected all screen drawing to run in a single thread. Now
    call set_screen_dirty() instead of draw_screen()
  • Added a lock on accessing the various Log buffers, preventing
    changes to the buffer in the middle of a redraw
  • Modified key reading logic when ESC character is received. Now
    uses a 1 second timeout if no subsequent keycodes are sent

How to test

Start the CLI and hold the PgUp / PgDown key with a full log. It would previously corrupt the screen.

Contributor license agreement signed?

CLA [ X ] (Whether you have signed a CLA - Contributor Licensing Agreement

The CLI would often have temporary screen corruption.  This reworks
several things to correct that issue, although it looks like the
ultimate cause was drawing to the screen while in the middle of
waiting on a VT100 ESC keycode sequence.

* Rearchitected all screen drawing to run in a single thread.  Now
  call set_screen_dirty() instead of draw_screen()
* Added a lock on accessing the various Log buffers, preventing
  changes to the buffer in the middle of a redraw
* Modified key reading logic when ESC character is received.  Now
  uses a 1 second timeout if no subsequent keycodes are sent
@pep8speaks
Copy link

pep8speaks commented Jul 24, 2018

Hello @penrods! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on July 28, 2018 at 06:25 Hours UTC

@penrods penrods added the CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) label Jul 24, 2018
Curses throws exceptions in some cases during get_wch(), such as
when you Ctrl+Z suspend the CLI the resume the process.

Also moved Ctrl+C processing into this exception handler.
@MycroftAI MycroftAI deleted a comment Jul 28, 2018
@MycroftAI MycroftAI deleted a comment Jul 28, 2018
@KathyReid KathyReid self-requested a review July 30, 2018 21:54
Copy link
Contributor

@KathyReid KathyReid left a comment

Choose a reason for hiding this comment

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

Test sequence

Pull the PR:

kathyreid@kathyreid-N76VZ:~/Dropbox/PHPworkspace/mycroft-core$ git status
On branch feature/fix-cli-corruption
Your branch is up-to-date with 'origin/feature/fix-cli-corruption'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	settings.json

nothing added to commit but untracked files present (use "git add" to track)
kathyreid@kathyreid-N76VZ:~/Dropbox/PHPworkspace/mycroft-core$ git log
commit 5641f578c0d9efe76ccfab5406fbbfc0f47559ba
Author: Steve Penrod <steve.penrod@mycroft.ai>
Date:   Sat Jul 28 01:25:46 2018 -0500

    Fix Codacy issues

launch ./start-mycroft debug

mycroft-cli-client launched successfully

  • Press Pg Up => correctly scrolls up the backscroll
  • Press Pg Down => correctly scrolls down the backscroll
  • Repeated pressing of Pg Up or Pg Down => scrolls multiple times correctly
  • Hold Pg Up or Pg Down => continuous scroll
  • Mashed keyboard like a toddler => printable characters displayed in Input prompt, then KeyboardInterrupt captured, dropped out of CLI

@penrods penrods merged commit 040b64d into dev Jul 30, 2018
@penrods penrods deleted the feature/fix-cli-corruption branch July 30, 2018 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants