Skip to content

Commit

Permalink
Adjust posFromMouse to handle arbitrary xRel field values
Browse files Browse the repository at this point in the history
Closes #6067
  • Loading branch information
marijnh committed Nov 19, 2019
1 parent 0f191d5 commit 18a8ae2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/measurement/position_measurement.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ export function posFromMouse(cm, e, liberal, forRect) {
try { x = e.clientX - space.left; y = e.clientY - space.top }
catch (e) { return null }
let coords = coordsChar(cm, x, y), line
if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
let colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length
coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff))
}
Expand Down

0 comments on commit 18a8ae2

Please sign in to comment.