Commit 2291a568 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove support for function keys. (#8840)

Function keys don't work great on any platform we support:
* Mac doesn't have first-class function keys.
* On Ubuntu: F1 opens the system help and F10 opens the file dialog.
* ... and Windows is a mess as well.
parent fac0fe35
...@@ -255,10 +255,6 @@ class AnsiTerminal { ...@@ -255,10 +255,6 @@ class AnsiTerminal {
supportsColor = (term != null && term != 'dumb') || flutterAnsiTerm; supportsColor = (term != null && term != 'dumb') || flutterAnsiTerm;
} }
static const String KEY_F1 = '\u001BOP';
static const String KEY_F5 = '\u001B[15~';
static const String KEY_F10 = '\u001B[21~';
static const String _bold = '\u001B[1m'; static const String _bold = '\u001B[1m';
static const String _reset = '\u001B[0m'; static const String _reset = '\u001B[0m';
static const String _clear = '\u001B[2J\u001B[H'; static const String _clear = '\u001B[2J\u001B[H';
......
...@@ -235,8 +235,8 @@ abstract class ResidentRunner { ...@@ -235,8 +235,8 @@ abstract class ResidentRunner {
printStatus(''); // the key the user tapped might be on this line printStatus(''); // the key the user tapped might be on this line
if (lower == 'h' || lower == '?' || character == AnsiTerminal.KEY_F1) { if (lower == 'h' || lower == '?') {
// F1, help // help
printHelp(details: true); printHelp(details: true);
return true; return true;
} else if (lower == 'w') { } else if (lower == 'w') {
...@@ -265,8 +265,8 @@ abstract class ResidentRunner { ...@@ -265,8 +265,8 @@ abstract class ResidentRunner {
print('Switched operating system to: $platform'); print('Switched operating system to: $platform');
return true; return true;
} }
} else if (lower == 'q' || character == AnsiTerminal.KEY_F10) { } else if (lower == 'q') {
// F10, exit // exit
await stop(); await stop();
return true; return true;
} else if (lower == 'd') { } else if (lower == 'd') {
......
...@@ -165,9 +165,9 @@ class ColdRunner extends ResidentRunner { ...@@ -165,9 +165,9 @@ class ColdRunner extends ResidentRunner {
printHelpDetails(); printHelpDetails();
} }
if (haveDetails && !details) { if (haveDetails && !details) {
printStatus('For a more detailed help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.'); printStatus('For a more detailed help message, press "h". To quit, press "q".');
} else { } else {
printStatus('To repeat this help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.'); printStatus('To repeat this help message, press "h". To quit, press "q".');
} }
} }
......
...@@ -230,7 +230,7 @@ class HotRunner extends ResidentRunner { ...@@ -230,7 +230,7 @@ class HotRunner extends ResidentRunner {
@override @override
Future<Null> handleTerminalCommand(String code) async { Future<Null> handleTerminalCommand(String code) async {
final String lower = code.toLowerCase(); final String lower = code.toLowerCase();
if ((lower == 'r') || (code == AnsiTerminal.KEY_F5)) { if (lower == 'r') {
final OperationResult result = await restart(fullRestart: code == 'R'); final OperationResult result = await restart(fullRestart: code == 'R');
if (!result.isOk) { if (!result.isOk) {
// TODO(johnmccutchan): Attempt to determine the number of errors that // TODO(johnmccutchan): Attempt to determine the number of errors that
...@@ -511,16 +511,16 @@ class HotRunner extends ResidentRunner { ...@@ -511,16 +511,16 @@ class HotRunner extends ResidentRunner {
const String bold = '\u001B[0;1m'; const String bold = '\u001B[0;1m';
const String reset = '\u001B[0m'; const String reset = '\u001B[0m';
printStatus( printStatus(
'$fire To hot reload your app on the fly, press "r" or F5. To restart the app entirely, press "R".', '$fire To hot reload your app on the fly, press "r". To restart the app entirely, press "R".',
ansiAlternative: '$red$fire$bold To hot reload your app on the fly, ' ansiAlternative: '$red$fire$bold To hot reload your app on the fly, '
'press "r" or F5. To restart the app entirely, press "R".$reset' 'press "r". To restart the app entirely, press "R".$reset'
); );
printStatus('The Observatory debugger and profiler is available at: $_observatoryUri'); printStatus('The Observatory debugger and profiler is available at: $_observatoryUri');
if (details) { if (details) {
printHelpDetails(); printHelpDetails();
printStatus('To repeat this help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.'); printStatus('To repeat this help message, press "h". To quit, press "q".');
} else { } else {
printStatus('For a more detailed help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.'); printStatus('For a more detailed help message, press "h". To quit, press "q".');
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment