Browse Source

Update the signature of TerminalBackend.resize()

xuty 4 năm trước cách đây
mục cha
commit
3428b9761d

+ 1 - 1
example/lib/isolate.dart

@@ -53,7 +53,7 @@ class FakeTerminalBackend extends TerminalBackend {
   Stream<String> get out => _outStream.stream;
 
   @override
-  void resize(int width, int height) {
+  void resize(int width, int height, int pixelWidth, int pixelHeight) {
     // NOOP
   }
 

+ 1 - 1
example/lib/main.dart

@@ -52,7 +52,7 @@ class FakeTerminalBackend extends TerminalBackend {
   Stream<String> get out => _outStream.stream;
 
   @override
-  void resize(int width, int height) {
+  void resize(int width, int height, int pixelWidth, int pixelHeight) {
     // NOOP
   }
 

+ 1 - 1
lib/terminal/terminal.dart

@@ -359,7 +359,7 @@ class Terminal with Observable implements TerminalUiInteraction {
   /// the future.
   void resize(
       int newWidth, int newHeight, int newPixelWidth, int newPixelHeight) {
-    backend?.resizeFull(newWidth, newHeight, newPixelWidth, newPixelHeight);
+    backend?.resize(newWidth, newHeight, newPixelWidth, newPixelHeight);
     newWidth = max(newWidth, 1);
     newHeight = max(newHeight, 1);
 

+ 1 - 11
lib/terminal/terminal_backend.dart

@@ -19,17 +19,7 @@ abstract class TerminalBackend {
   void write(String input);
 
   /// notifies the backend about a view port resize that happened
-  /// If resizeFull() is overrode, resize() will not be called, but still
-  /// requires an empty method as a stub for API compatibility reasons.
-  void resize(int width, int height);
-
-  /// notifies the backend about a view port resize that happened, with information
-  /// including both row/column and pixel width/height.
-  /// Not required to be overrode if the [TerminalBackend] does not require
-  /// pixel size information, just override resize() instead.
-  void resizeFull(int columns, int rows, int pixelWidth, int pixelHeight) {
-    resize(columns, rows);
-  }
+  void resize(int width, int height, int pixelWidth, int pixelHeight);
 
   /// terminates this backend
   void terminate();