Merge pull request #255 from DotJoshJohnson/release/2.4.1
Release v2.4.1
This commit is contained in:
commit
c743d032f9
1 changed files with 16 additions and 1 deletions
|
@ -107,11 +107,22 @@ export class XmlTraverser {
|
||||||
columnRange[0] = (columnRange[0] - contextNode.nodeName.length);
|
columnRange[0] = (columnRange[0] - contextNode.nodeName.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lineNumber === (position.line + 1) && ((position.character + 1) >= columnRange[0] && (position.character + 1) < columnRange[1])) {
|
if (this._checkRange(lineNumber, position, columnRange)) {
|
||||||
return contextNode;
|
return contextNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isElement(contextNode)) {
|
if (this.isElement(contextNode)) {
|
||||||
|
// if the element contains text, check to see if the cursor is present in the text
|
||||||
|
const textContent = (contextNode as Element).textContent;
|
||||||
|
|
||||||
|
if (textContent) {
|
||||||
|
columnRange[1] = (columnRange[1] + textContent.length);
|
||||||
|
|
||||||
|
if (this._checkRange(lineNumber, position, columnRange)) {
|
||||||
|
return contextNode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const children = [...this.getChildAttributeArray(<Element>contextNode), ...this.getChildElementArray(contextNode)];
|
const children = [...this.getChildAttributeArray(<Element>contextNode), ...this.getChildElementArray(contextNode)];
|
||||||
let result: Node;
|
let result: Node;
|
||||||
|
|
||||||
|
@ -129,6 +140,10 @@ export class XmlTraverser {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _checkRange(lineNumber: number, position: Position, columnRange: number[]): boolean {
|
||||||
|
return (lineNumber === (position.line + 1) && ((position.character + 1) >= columnRange[0] && (position.character + 1) < columnRange[1]));
|
||||||
|
}
|
||||||
|
|
||||||
private _getNodeWidthInCharacters(node: Node) {
|
private _getNodeWidthInCharacters(node: Node) {
|
||||||
if (this.isElement(node)) {
|
if (this.isElement(node)) {
|
||||||
return (node.nodeName.length + 2);
|
return (node.nodeName.length + 2);
|
||||||
|
|
Loading…
Add table
Reference in a new issue