insertNewline function
Replace the selection with a newline.
Implementation
bool insertNewline(StateCommandTarget target) {
final state = target.state;
final result = state.replaceSelection(state.lineBreak);
target.dispatch(state.update([
TransactionSpec(
changes: result.changes,
selection: result.selection,
scrollIntoView: true,
userEvent: 'input',
),
]));
return true;
}