revert row register marker changes

This commit is contained in:
meganrogge
2022-03-18 15:38:31 -04:00
parent 61c2ca71d8
commit fef30bdba4
5 changed files with 7 additions and 14 deletions
+2 -2
View File
@@ -547,7 +547,7 @@ export class SearchAddon implements ITerminalAddon {
} }
terminal.select(result.col, result.row, result.size); terminal.select(result.col, result.row, result.size);
if (color) { if (color) {
const marker = terminal.registerMarker(undefined, result.row); const marker = terminal.registerMarker(-terminal.buffer.active.baseY - terminal.buffer.active.cursorY + result.row);
if (marker) { if (marker) {
this._selectedDecoration = terminal.registerDecoration({ marker, overviewRulerOptions: { color } }); this._selectedDecoration = terminal.registerDecoration({ marker, overviewRulerOptions: { color } });
this._selectedDecoration?.onRender((e) => this._applyStyles(e, color, result)); this._selectedDecoration?.onRender((e) => this._applyStyles(e, color, result));
@@ -591,7 +591,7 @@ export class SearchAddon implements ITerminalAddon {
*/ */
private _createResultDecoration(result: ISearchResult, color: string): IDecoration | undefined { private _createResultDecoration(result: ISearchResult, color: string): IDecoration | undefined {
const terminal = this._terminal!; const terminal = this._terminal!;
const marker = terminal.registerMarker(undefined, result.row); const marker = terminal.registerMarker(-terminal.buffer.active.baseY - terminal.buffer.active.cursorY + result.row);
if (!marker) { if (!marker) {
return undefined; return undefined;
} }
+1 -4
View File
@@ -1012,14 +1012,11 @@ export class Terminal extends CoreTerminal implements ITerminal {
return this.buffer.markers; return this.buffer.markers;
} }
public addMarker(cursorYOffset: number, row?: number): IMarker | undefined { public addMarker(cursorYOffset: number): IMarker | undefined {
// Disallow markers on the alt buffer // Disallow markers on the alt buffer
if (this.buffer !== this.buffers.normal) { if (this.buffer !== this.buffers.normal) {
return; return;
} }
if (row) {
return this.buffer.addMarker(row);
}
return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset); return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset);
} }
+1 -1
View File
@@ -61,7 +61,7 @@ export interface IPublicTerminal extends IDisposable {
registerLinkProvider(linkProvider: ILinkProvider): IDisposable; registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
registerCharacterJoiner(handler: (text: string) => [number, number][]): number; registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
deregisterCharacterJoiner(joinerId: number): void; deregisterCharacterJoiner(joinerId: number): void;
addMarker(cursorYOffset: number, col?: number, row?: number): IMarker | undefined; addMarker(cursorYOffset: number): IMarker | undefined;
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined; registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
hasSelection(): boolean; hasSelection(): boolean;
getSelection(): string; getSelection(): string;
+2 -5
View File
@@ -166,13 +166,10 @@ export class Terminal implements ITerminalApi {
this._checkProposedApi(); this._checkProposedApi();
this._core.deregisterCharacterJoiner(joinerId); this._core.deregisterCharacterJoiner(joinerId);
} }
public registerMarker(cursorYOffset: number = 0, row?: number): IMarker | undefined { public registerMarker(cursorYOffset: number = 0): IMarker | undefined {
this._checkProposedApi(); this._checkProposedApi();
this._verifyIntegers(cursorYOffset); this._verifyIntegers(cursorYOffset);
if (row) { return this._core.addMarker(cursorYOffset);
this._verifyPositiveIntegers(row);
}
return this._core.addMarker(cursorYOffset, row);
} }
public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined { public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {
this._checkProposedApi(); this._checkProposedApi();
+1 -2
View File
@@ -954,10 +954,9 @@ declare module 'xterm' {
* (EXPERIMENTAL) Adds a marker to the normal buffer and returns it. If the * (EXPERIMENTAL) Adds a marker to the normal buffer and returns it. If the
* alt buffer is active, undefined is returned. * alt buffer is active, undefined is returned.
* @param cursorYOffset The y position offset of the marker from the cursor. * @param cursorYOffset The y position offset of the marker from the cursor.
* @param row The y position of the marker.
* @returns The new marker or undefined. * @returns The new marker or undefined.
*/ */
registerMarker(cursorYOffset?: number, row?: number): IMarker | undefined; registerMarker(cursorYOffset?: number): IMarker | undefined;
/** /**
* @deprecated use `registerMarker` instead. * @deprecated use `registerMarker` instead.