mirror of
https://github.com/NaitLee/Cat-Printer.git
synced 2025-05-16 23:30:15 -07:00
* Fixed wrap_by_space not working correctly when given a word that is too long for the canvas
This commit is contained in:
parent
049aa74e40
commit
47d3d2ecea
@ -468,7 +468,7 @@ class CanvasController {
|
||||
const wrap_by_space = (text, 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()];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user