Skip to content

Commit

Permalink
refactor: replace ISelectionPosition with IBufferRange
Browse files Browse the repository at this point in the history
  • Loading branch information
javier-godoy committed Dec 28, 2022
1 parent 7dc275c commit e921256
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class SelectionAddon extends TerminalAddon<ISelectionMixin> {
let buffer = (terminal.buffer.active as any)._buffer;
let range = buffer.getWrappedRangeForLine(buffer.ybase+buffer.y);

let pos = terminal.getSelectionPosition() || {startRow: buffer.ybase+buffer.y, startColumn: buffer.x};
let pos = terminal.getSelectionPosition() || {start: {y: buffer.ybase+buffer.y, x: buffer.x}};

resetSelection();
ensureSelection();
let dx = range.first * terminal.cols - this.__selectionAnchor!;
if (pos.startRow != range.first || pos.startColumn != promptLength()) {
if (pos.start.y != range.first || pos.start.x != promptLength()) {
dx+= promptLength();
}

Expand All @@ -126,8 +126,7 @@ class SelectionAddon extends TerminalAddon<ISelectionMixin> {
let buffer = (terminal.buffer.active as any)._buffer;
let range = buffer.getWrappedRangeForLine(buffer.ybase+buffer.y);
let pos = terminal.getSelectionPosition();
if (pos && pos.startRow>=range.first && pos.endRow<=range.last) {
//let selectionStart = pos.startRow * terminal.cols + pos.startColumn;
if (pos && pos.start.y>=range.first && pos.end.y<=range.last) {
if (!this.__selectionRight) {
//cursor backward wrapped
terminal.write("\x1b[<" + this.__selectionLength + "L");
Expand Down

0 comments on commit e921256

Please sign in to comment.