Fix column selection issues
The following parts were not respecting the column selection edge case where the start column was greater than the end column while the start row was less than the end row: - Webgl renderer - DOM renderer - Selection service (ie. getSelection(), I don't think this was a regression) Fixes #3855
This commit is contained in:
@@ -304,8 +304,9 @@ export class DomRenderer extends Disposable implements IRenderer {
|
||||
const documentFragment = document.createDocumentFragment();
|
||||
|
||||
if (columnSelectMode) {
|
||||
const isXFlipped = start[0] > end[0];
|
||||
documentFragment.appendChild(
|
||||
this._createSelectionElement(viewportCappedStartRow, start[0], end[0], viewportCappedEndRow - viewportCappedStartRow + 1)
|
||||
this._createSelectionElement(viewportCappedStartRow, isXFlipped ? end[0] : start[0], isXFlipped ? start[0] : end[0], viewportCappedEndRow - viewportCappedStartRow + 1)
|
||||
);
|
||||
} else {
|
||||
// Draw first row
|
||||
|
||||
@@ -322,8 +322,12 @@ export class DomRendererRowFactory {
|
||||
return false;
|
||||
}
|
||||
if (this._columnSelectMode) {
|
||||
return x >= start[0] && y >= start[1] &&
|
||||
x < end[0] && y < end[1];
|
||||
if (start[0] <= end[0]) {
|
||||
return x >= start[0] && y >= start[1] &&
|
||||
x < end[0] && y <= end[1];
|
||||
}
|
||||
return x < start[0] && y >= start[1] &&
|
||||
x >= end[0] && y <= end[1];
|
||||
}
|
||||
return (y > start[1] && y < end[1]) ||
|
||||
(start[1] === end[1] && y === start[1] && x >= start[0] && x < end[0]) ||
|
||||
|
||||
Reference in New Issue
Block a user