pressHomeKey method
Moves the cursor to the beginning of the current line.
If isShiftPressed is true, extends the selection to the line start.
Implementation
void pressHomeKey({bool isShiftPressed = false}) {
final currentLine = getLineAtOffset(selection.extentOffset);
final lineStart = getLineStartOffset(currentLine);
if (isShiftPressed) {
setSelectionSilently(
TextSelection(
baseOffset: selection.baseOffset,
extentOffset: lineStart,
),
);
} else {
setSelectionSilently(TextSelection.collapsed(offset: lineStart));
}
}