Explorar o código

fix: count sequential linebreaks correctly

tophf %!s(int64=4) %!d(string=hai) anos
pai
achega
9ae02d6a67
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      src/common/ui/style/index.js

+ 5 - 1
src/common/ui/style/index.js

@@ -77,4 +77,8 @@ options.hook((changes) => {
 });
 
 Vue.prototype.i18n = i18n;
-Vue.prototype.CalcRows = val => val && (val.match(/\n.|$/g).length + 1);
+/** @returns {?number} Number of lines + 1 if the last line is not empty */
+Vue.prototype.CalcRows = val => val && (
+  val.match(/$/gm).length
+  + !val.endsWith('\n')
+);