提交 f5fdb8e0 编写于 作者: A Alex Dima

Fixes #43208: Add editor.scrollBeyondLastColumn

上级 9f5fd606
......@@ -254,6 +254,11 @@ const editorConfiguration: IConfigurationNode = {
'default': EDITOR_DEFAULTS.viewInfo.scrollBeyondLastLine,
'description': nls.localize('scrollBeyondLastLine', "Controls if the editor will scroll beyond the last line")
},
'editor.scrollBeyondLastColumn': {
'type': 'number',
'default': EDITOR_DEFAULTS.viewInfo.scrollBeyondLastColumn,
'description': nls.localize('scrollBeyondLastColumn', "Controls if the editor will scroll beyond the last column")
},
'editor.smoothScrolling': {
'type': 'boolean',
'default': EDITOR_DEFAULTS.viewInfo.smoothScrolling,
......
......@@ -300,6 +300,11 @@ export interface IEditorOptions {
* Defaults to true.
*/
scrollBeyondLastLine?: boolean;
/**
* Enable that scrolling can go beyond the last column by a number of columns.
* Defaults to 5.
*/
scrollBeyondLastColumn?: number;
/**
* Enable that the editor animates scrolling to a position.
* Defaults to false.
......@@ -825,6 +830,7 @@ export interface InternalEditorViewOptions {
readonly cursorWidth: number;
readonly hideCursorInOverviewRuler: boolean;
readonly scrollBeyondLastLine: boolean;
readonly scrollBeyondLastColumn: number;
readonly smoothScrolling: boolean;
readonly stopRenderingLineAfter: number;
readonly renderWhitespace: 'none' | 'boundary' | 'all';
......@@ -1105,6 +1111,7 @@ export class InternalEditorOptions {
&& a.cursorWidth === b.cursorWidth
&& a.hideCursorInOverviewRuler === b.hideCursorInOverviewRuler
&& a.scrollBeyondLastLine === b.scrollBeyondLastLine
&& a.scrollBeyondLastColumn === b.scrollBeyondLastColumn
&& a.smoothScrolling === b.smoothScrolling
&& a.stopRenderingLineAfter === b.stopRenderingLineAfter
&& a.renderWhitespace === b.renderWhitespace
......@@ -1718,6 +1725,7 @@ export class EditorOptionsValidator {
cursorWidth: _clampedInt(opts.cursorWidth, defaults.cursorWidth, 0, Number.MAX_VALUE),
hideCursorInOverviewRuler: _boolean(opts.hideCursorInOverviewRuler, defaults.hideCursorInOverviewRuler),
scrollBeyondLastLine: _boolean(opts.scrollBeyondLastLine, defaults.scrollBeyondLastLine),
scrollBeyondLastColumn: _clampedInt(opts.scrollBeyondLastColumn, defaults.scrollBeyondLastColumn, 0, Constants.MAX_SAFE_SMALL_INTEGER),
smoothScrolling: _boolean(opts.smoothScrolling, defaults.smoothScrolling),
stopRenderingLineAfter: _clampedInt(opts.stopRenderingLineAfter, defaults.stopRenderingLineAfter, -1, Constants.MAX_SAFE_SMALL_INTEGER),
renderWhitespace: renderWhitespace,
......@@ -1830,6 +1838,7 @@ export class InternalEditorOptionsFactory {
cursorWidth: opts.viewInfo.cursorWidth,
hideCursorInOverviewRuler: opts.viewInfo.hideCursorInOverviewRuler,
scrollBeyondLastLine: opts.viewInfo.scrollBeyondLastLine,
scrollBeyondLastColumn: opts.viewInfo.scrollBeyondLastColumn,
smoothScrolling: opts.viewInfo.smoothScrolling,
stopRenderingLineAfter: opts.viewInfo.stopRenderingLineAfter,
renderWhitespace: (accessibilityIsOn ? 'none' : opts.viewInfo.renderWhitespace), // DISABLED WHEN SCREEN READER IS ATTACHED
......@@ -2280,6 +2289,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
cursorWidth: 0,
hideCursorInOverviewRuler: false,
scrollBeyondLastLine: true,
scrollBeyondLastColumn: 5,
smoothScrolling: false,
stopRenderingLineAfter: 10000,
renderWhitespace: 'none',
......
......@@ -18,8 +18,6 @@ const SMOOTH_SCROLLING_TIME = 125;
export class ViewLayout extends Disposable implements IViewLayout {
static LINES_HORIZONTAL_EXTRA_PX = 30;
private readonly _configuration: editorCommon.IConfiguration;
private readonly _linesLayout: LinesLayout;
......@@ -143,7 +141,8 @@ export class ViewLayout extends Disposable implements IViewLayout {
private _computeScrollWidth(maxLineWidth: number, viewportWidth: number): number {
let isViewportWrapping = this._configuration.editor.wrappingInfo.isViewportWrapping;
if (!isViewportWrapping) {
return Math.max(maxLineWidth + ViewLayout.LINES_HORIZONTAL_EXTRA_PX, viewportWidth);
const extraHorizontalSpace = this._configuration.editor.viewInfo.scrollBeyondLastColumn * this._configuration.editor.fontInfo.typicalHalfwidthCharacterWidth;
return Math.max(maxLineWidth + extraHorizontalSpace, viewportWidth);
}
return Math.max(maxLineWidth, viewportWidth);
}
......
......@@ -2623,6 +2623,11 @@ declare namespace monaco.editor {
* Defaults to true.
*/
scrollBeyondLastLine?: boolean;
/**
* Enable that scrolling can go beyond the last column by a number of columns.
* Defaults to 5.
*/
scrollBeyondLastColumn?: number;
/**
* Enable that the editor animates scrolling to a position.
* Defaults to false.
......@@ -3088,6 +3093,7 @@ declare namespace monaco.editor {
readonly cursorWidth: number;
readonly hideCursorInOverviewRuler: boolean;
readonly scrollBeyondLastLine: boolean;
readonly scrollBeyondLastColumn: number;
readonly smoothScrolling: boolean;
readonly stopRenderingLineAfter: number;
readonly renderWhitespace: 'none' | 'boundary' | 'all';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册