terminal: show resize notification for xterm.js

Bug: b/236205389
Change-Id: I05076032bac3ea47b7723955046a39c6e2c9fd88
Reviewed-on: https://chromium-review.googlesource.com/c/apps/libapps/+/3947626
Reviewed-by: Joel Hockey <joelhockey@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/terminal/js/terminal_emulator.js b/terminal/js/terminal_emulator.js
index 9d51c53..d02f39b 100644
--- a/terminal/js/terminal_emulator.js
+++ b/terminal/js/terminal_emulator.js
@@ -354,7 +354,12 @@
     this.installUnimplementedStubs_();
     this.installEscapeSequenceHandlers_();
 
-    this.term.onResize(({cols, rows}) => this.io.onTerminalResize(cols, rows));
+    this.term.onResize(({cols, rows}) => {
+      this.io.onTerminalResize(cols, rows);
+      if (this.prefs_.get('enable-resize-status')) {
+        this.showOverlay(`${cols} × ${rows}`);
+      }
+    });
     // We could also use `this.io.sendString()` except for the nassh exit
     // prompt, which only listens to onVTKeystroke().
     this.term.onData((data) => this.io.onVTKeystroke(data));
@@ -602,16 +607,12 @@
 
   /** @override */
   showOverlay(msg, timeout = 1500) {
-    if (this.notificationCenter_) {
-      this.notificationCenter_.show(msg, {timeout});
-    }
+    this.notificationCenter_?.show(msg, {timeout});
   }
 
   /** @override */
   hideOverlay() {
-    if (this.notificationCenter_) {
-      this.notificationCenter_.hide();
-    }
+    this.notificationCenter_?.hide();
   }
 
   /** @override */