aegirhall / console-menu

A simple Python menu system for building terminal user interfaces.
MIT License
370 stars 58 forks source link

Fix failure to clear screen under Windows 10 ssh #19

Closed davidthomaswood closed 5 years ago

davidthomaswood commented 5 years ago

Occasionally when connected to a Linux machine using Windows 10's native ssh client, the screen doesn't get cleared between two attempts to draw the screen. This seems to be due to the clear process writing the control codes to its own copy of standard out, which isn't doesn't seem to flushed to the screen at the same time as Python writes out the menu.

This patch causes Python to capture the control codes used by clear, and writes them to the script's own standard output.

On Windows, the same trick doesn't work (Python writes '\f'/'\x0c', which displays as ♀/'\u2640', see en.wikipedia.org/wiki/Code_page_437). Instead, this patch continues to just call cls, but uses 'subprocess' for consistency.

aegirhall commented 5 years ago

Manually merged, revision 96837b4f5bb98386bbf1179a82b86e06429dfe11

This will be in next release (v0.6.0)