hterm: switch from lib.f.getWhitespace to String.repeat

ES6 has a String.repeat function that we can use instead of our custom
lib.f.getWhitespace helper.  The semantics aren't exactly the same (a
negative repeat count will throw an error while our helper will just
return an empty string), but those don't seem to matter to our usage.
Plus, the code appears to be slightly faster in microbenchmarks, or at
the very least, the same.

Change-Id: I1498111d1299487ab1170c29a55623cb1e659ed8
Reviewed-on: https://chromium-review.googlesource.com/c/apps/libapps/+/1705988
Reviewed-by: Joel Hockey <joelhockey@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js
index c2d6505..41ca638 100644
--- a/hterm/js/hterm_terminal.js
+++ b/hterm/js/hterm_terminal.js
@@ -2052,7 +2052,7 @@
   var cursor = this.saveCursor();
   this.setCursorColumn(0);
   const count = cursor.column + 1;
-  this.screen_.overwriteString(lib.f.getWhitespace(count), count);
+  this.screen_.overwriteString(' '.repeat(count), count);
   this.restoreCursor(cursor);
 };
 
@@ -2092,7 +2092,7 @@
   }
 
   var cursor = this.saveCursor();
-  this.screen_.overwriteString(lib.f.getWhitespace(count), count);
+  this.screen_.overwriteString(' '.repeat(count), count);
   this.restoreCursor(cursor);
   this.clearCursorOverflow();
 };
@@ -2280,7 +2280,7 @@
 hterm.Terminal.prototype.insertSpace = function(count) {
   var cursor = this.saveCursor();
 
-  var ws = lib.f.getWhitespace(count || 1);
+  const ws = ' '.repeat(count || 1);
   this.screen_.insertString(ws, ws.length);
   this.screen_.maybeClipCurrentRow();
 
@@ -2299,7 +2299,7 @@
   if (deleted && !this.screen_.textAttributes.isDefault()) {
     var cursor = this.saveCursor();
     this.setCursorColumn(this.screenSize.width - deleted);
-    this.screen_.insertString(lib.f.getWhitespace(deleted));
+    this.screen_.insertString(' '.repeat(deleted));
     this.restoreCursor(cursor);
   }