setContent method
Sets the content of the viewport.
Implementation
ViewportModel setContent(String content) {
final normalized = content.replaceAll('\r\n', '\n');
final newLines = normalized.split('\n');
final newModel = copyWith(lines: newLines);
newModel._longestLineWidth = _findLongestLineWidth(newLines);
// Adjust offset if content is shorter
if (newModel.yOffset > newModel._maxYOffset) {
return newModel.gotoBottom();
}
return newModel;
}