* Fixed wrap_by_space not working correctly when given a word that is too long for the canvas

This commit is contained in:
Sync1211 2022-05-18 20:31:03 +02:00
parent 049aa74e40
commit 47d3d2ecea
No known key found for this signature in database
GPG Key ID: B8878699435E69EC

View File

@ -468,7 +468,7 @@ class CanvasController {
const wrap_by_space = (text, max_length) => { const wrap_by_space = (text, max_length) => {
let split_pos = text.lastIndexOf(" ", max_length); let split_pos = text.lastIndexOf(" ", max_length);
if (split_pos == 0) { split_pos = max_length; } if (split_pos <= 0) { split_pos = max_length; }
return [text.slice(0, split_pos).trim(), text.slice(split_pos, text.length).trim()]; return [text.slice(0, split_pos).trim(), text.slice(split_pos, text.length).trim()];
} }