diff --git a/CHANGELOG.md b/CHANGELOG.md index 5336859..a36f4a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.2.1 +- The ask component disappeared after the validation stage +- Calling `createSpace` method in all rendering cases for `ask` component +- Remove missing `print` statement in `readKey` function + # 2.2.0 - Add `select` display handler - Fix bad FutureOr execution diff --git a/lib/src/application/components/ask.dart b/lib/src/application/components/ask.dart index 2477f2a..a39a604 100644 --- a/lib/src/application/components/ask.dart +++ b/lib/src/application/components/ask.dart @@ -45,8 +45,6 @@ final class Ask with TerminalTools implements Component> { Future handle() { saveCursorPosition(); - createSpace(_terminal, 1); - _defaultRendering(); _waitResponse(); @@ -87,6 +85,7 @@ final class Ask with TerminalTools implements Component> { SetStyles(Style.foreground(Color.brightBlack)), ]); + createSpace(_terminal, 1); stdout.write(buffer.toString()); } @@ -100,6 +99,8 @@ final class Ask with TerminalTools implements Component> { ]; buffer.writeAnsiAll([ + CursorPosition.restore, + Clear.afterCursor, ...errorSequence, Print(_message), if (_hasDefault) ..._baseDefaultSequence, @@ -111,21 +112,14 @@ final class Ask with TerminalTools implements Component> { SetStyles(Style.foreground(Color.brightRed)), Print(error), SetStyles.reset, - CursorPosition.restore, - Clear.afterCursor, - ]); - - buffer.writeAnsiAll([ - CursorPosition.restore, - Clear.afterCursor, - SetStyles(Style.foreground(Color.brightBlack)), ]); + createSpace(_terminal, 2); stdout.write(buffer.toString()); stdout.writeAnsiAll([ const CursorPosition.moveUp(1), - const CursorPosition.moveRight(2), + SetStyles(Style.foreground(Color.brightBlack)), ]); _waitResponse(); @@ -142,6 +136,8 @@ final class Ask with TerminalTools implements Component> { ]; buffer.writeAnsiAll([ + CursorPosition.restore, + Clear.afterCursor, ...successSequence, Print(_message), Print(' '), @@ -149,10 +145,8 @@ final class Ask with TerminalTools implements Component> { Print(_hidden ? '******' : response), SetStyles.reset, AsciiControl.lineFeed, - CursorPosition.restore, - Clear.afterCursor, ]); - + createSpace(_terminal, 1); stdout.write(buffer.toString()); _completer.complete(response as T); diff --git a/lib/src/application/utils/terminal_tools.dart b/lib/src/application/utils/terminal_tools.dart index 6b5f943..e972221 100644 --- a/lib/src/application/utils/terminal_tools.dart +++ b/lib/src/application/utils/terminal_tools.dart @@ -113,7 +113,6 @@ mixin TerminalTools { _ensureTerminalAttached(); terminal.enableRawMode(); final key = _readKey(); - print(key.controlChar); terminal.disableRawMode(); if (key.controlChar == ControlCharacter.ctrlC) { diff --git a/pubspec.yaml b/pubspec.yaml index c7ccd0b..7fc3f52 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: commander_ui description: Commander is a Dart library for creating user interfaces within the terminal. -version: 2.2.0 +version: 2.2.1 repository: https://github.com/LeadcodeDev/commander topics: