minor modification

This commit is contained in:
Xen 2020-05-24 20:49:49 +08:00
parent dbaeb42a12
commit 7fe1c137e3
1 changed files with 6 additions and 15 deletions

View File

@ -472,7 +472,8 @@ amdRequire(["vs/editor/editor.main"], function () {
return undefined; // in span part return undefined; // in span part
} else if (startColumn < hmSpanPartOffset) { } else if (startColumn < hmSpanPartOffset) {
// in hex part // in hex part
range.startColumn = parseInt(startColumn / hmUnitLength) * hmUnitLength + 1; range.startColumn =
parseInt(startColumn / hmUnitLength) * hmUnitLength + 1;
startColumn = parseInt(startColumn / hmUnitLength) + hmStrPartOffset; startColumn = parseInt(startColumn / hmUnitLength) + hmStrPartOffset;
if (endColumn > hmHexPartLength) endColumn = hmHexPartLength; if (endColumn > hmHexPartLength) endColumn = hmHexPartLength;
range.endColumn = parseInt(endColumn / hmUnitLength) * hmUnitLength + 1; range.endColumn = parseInt(endColumn / hmUnitLength) * hmUnitLength + 1;
@ -496,12 +497,10 @@ amdRequire(["vs/editor/editor.main"], function () {
editor.onMouseUp((e) => { editor.onMouseUp((e) => {
let model = editor.getModel(); let model = editor.getModel();
let range = editor.getSelection(); let range = editor.getSelection();
let cordRange = getCordinateRangeOneLine(range);
if (undefined === cordRange) return;
console.log("In: " + range); console.log("In: " + range);
console.log("Out: " + cordRange);
let cordRange = getCordinateRangeOneLine(range);
if (undefined === cordRange) return;
// first remove old decos // first remove old decos
let decos = model.getLineDecorations(range.startLineNumber); let decos = model.getLineDecorations(range.startLineNumber);
@ -516,20 +515,12 @@ amdRequire(["vs/editor/editor.main"], function () {
[ [
{ {
range: range, range: range,
id: "hm",
options: { options: {
className: "hex-select", className: "hex-select",
}, },
}, },
]
);
model.deltaDecorations(
[],
[
{ {
range: cordRange, range: cordRange,
id: "hm",
options: { options: {
className: "hex-select", className: "hex-select",
}, },