1
0
Эх сурвалжийг харах

fix: count sequential linebreaks correctly

tophf 4 жил өмнө
parent
commit
9ae02d6a67

+ 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')
+);