change to v11, expose unicodeVersion, fix linkifier

This commit is contained in:
Jörg Breitbart
2019-11-15 18:08:17 +01:00
parent 25bbde2be2
commit aca6d24e96
10 changed files with 48 additions and 36 deletions
+2 -2
View File
@@ -9,12 +9,12 @@ import { IBufferLine } from 'common/Types';
import { Linkifier } from 'browser/Linkifier';
import { BufferLine } from 'common/buffer/BufferLine';
import { CellData } from 'common/buffer/CellData';
import { MockLogService, MockBufferService } from 'common/TestUtils.test';
import { MockLogService, MockBufferService, MockOptionsService } from 'common/TestUtils.test';
import { IBufferService } from 'common/services/Services';
class TestLinkifier extends Linkifier {
constructor(bufferService: IBufferService) {
super(bufferService, new MockLogService());
super(bufferService, new MockLogService(), new MockOptionsService());
Linkifier._timeBeforeLatency = 0;
}
+5 -5
View File
@@ -5,9 +5,9 @@
import { ILinkifierEvent, ILinkMatcher, LinkMatcherHandler, ILinkMatcherOptions, ILinkifier, IMouseZoneManager, IMouseZone, IRegisteredLinkMatcher } from 'browser/Types';
import { IBufferStringIteratorResult } from 'common/buffer/Types';
import { getStringCellWidthV6 } from 'common/CharWidth';
import { getStringCellWidthV6, getStringCellWidthV11 } from 'common/CharWidth';
import { EventEmitter, IEvent } from 'common/EventEmitter';
import { ILogService, IBufferService } from 'common/services/Services';
import { ILogService, IBufferService, IOptionsService } from 'common/services/Services';
/**
* Limit of the unwrapping line expansion (overscan) at the top and bottom
@@ -45,7 +45,8 @@ export class Linkifier implements ILinkifier {
constructor(
protected readonly _bufferService: IBufferService,
private readonly _logService: ILogService
private readonly _logService: ILogService,
private readonly _optionsService: IOptionsService
) {
this._rowsToLinkify = {
start: undefined,
@@ -277,8 +278,7 @@ export class Linkifier implements ILinkifier {
if (!this._mouseZoneManager || !this._element) {
return;
}
const width = getStringCellWidthV6(uri); // FIXME: apply options.unicodeVersion
const width = this._optionsService.options.unicodeVersion === '11' ? getStringCellWidthV11(uri) : getStringCellWidthV6(uri);
const x1 = x % this._bufferService.cols;
const y1 = y + Math.floor(x / this._bufferService.cols);
let x2 = (x1 + width) % this._bufferService.cols;