Skip to content

Commit

Permalink
Properly draw selection gap for a blank line below a widget
Browse files Browse the repository at this point in the history
FIX: Fix a bug in `drawSelection` that could lead to invisible or incorrect
selections for a blank line below a block widget.

Closes codemirror/dev#1163
  • Loading branch information
marijnh committed May 17, 2023
1 parent efda638 commit 6d32e34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function rectanglesForRange(view: EditorView, className: string, range: Selectio
let top = visualStart ? drawForLine(range.from, null, visualStart) : drawForWidget(startBlock, false)
let bottom = visualEnd ? drawForLine(null, range.to, visualEnd) : drawForWidget(endBlock, true)
let between = []
if ((visualStart || startBlock).to < (visualEnd || endBlock).from - 1)
if ((visualStart || startBlock).to < (visualEnd || endBlock).from - (visualStart && visualEnd ? 1 : 0))
between.push(piece(leftSide, top.bottom, rightSide, bottom.top))
else if (top.bottom < bottom.top && view.elementAtHeight((top.bottom + bottom.top) / 2).type == BlockType.Text)
top.bottom = bottom.top = (top.bottom + bottom.top) / 2
Expand Down

0 comments on commit 6d32e34

Please sign in to comment.