Skip to content

Commit

Permalink
Highlight the beginning selected, empty lines. (singerdmx#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blquinn committed Mar 31, 2023
1 parent b389792 commit 4e11298
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/src/widgets/text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,19 @@ class RenderEditableTextLine extends RenderEditableBox {
_selectedRects ??= _body!.getBoxesForSelection(
local,
);

// Paint a small rect at the start of empty lines that
// are contained by the selection.
if (line.isEmpty &&
textSelection.baseOffset <= line.offset &&
textSelection.extentOffset > line.offset
) {
final lineHeight =
preferredLineHeight(TextPosition(offset: line.offset));
_selectedRects?.add(
TextBox.fromLTRBD(0, 0, 3, lineHeight, textDirection));
}

_paintSelection(context, effectiveOffset);
}
}
Expand Down

0 comments on commit 4e11298

Please sign in to comment.