mirror of
https://github.com/salexdv/bsl_console.git
synced 2024-11-24 08:33:29 +02:00
Отступы для декораций #296
This commit is contained in:
parent
395a39e53c
commit
6ff2389be9
@ -1502,8 +1502,9 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit
|
|||||||
length = Math.max(length, value.length)
|
length = Math.max(length, value.length)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const max_length = lineNumbersDedocrations.length.toString().length + 3
|
||||||
editor.updateOptions({ lineNumbersMinChars: 0 });
|
editor.updateOptions({ lineNumbersMinChars: 0 });
|
||||||
editor.updateOptions({ lineNumbersMinChars: length + 3 });
|
editor.updateOptions({ lineNumbersMinChars: length + max_length });
|
||||||
editor.layout();
|
editor.layout();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1816,13 +1817,28 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit
|
|||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region non-public functions
|
// #region non-public functions
|
||||||
|
function getLineNumberMargin(originalLineNumber) {
|
||||||
|
|
||||||
|
let margin = '';
|
||||||
|
const max_length = lineNumbersDedocrations.length.toString().length;
|
||||||
|
const length = originalLineNumber.toString().length;
|
||||||
|
const nbsp = String.fromCharCode(160);
|
||||||
|
|
||||||
|
for (let x = length; x <= max_length; x++)
|
||||||
|
margin += nbsp;
|
||||||
|
|
||||||
|
return margin;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function getLineNumber(originalLineNumber) {
|
function getLineNumber(originalLineNumber) {
|
||||||
|
|
||||||
// Исправлена потеря первой декорации https://github.com/salexdv/bsl_console/issues/296#issuecomment-1303625104
|
if (originalLineNumber <= lineNumbersDedocrations.length) {
|
||||||
if (originalLineNumber <= lineNumbersDedocrations.length)
|
let str = lineNumbersDedocrations[originalLineNumber - 1].replace(/ /g, String.fromCharCode(160))
|
||||||
return lineNumbersDedocrations[originalLineNumber - 1] + ' ' + originalLineNumber;
|
return str + getLineNumberMargin(originalLineNumber) + originalLineNumber;
|
||||||
|
}
|
||||||
|
|
||||||
return originalLineNumber;
|
return originalLineNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user