提交 cb1797f1 编写于 作者: M Matt Bierner

Revert "Don't scroll to factional line positions in the markdown preview when wordwrap is off"

This reverts commit 5055bb7b.
上级 5055bb7b
......@@ -211,7 +211,7 @@
} else {
const line = getEditorLineNumberForPageOffset(window.scrollY);
if (!isNaN(line)) {
const args = [settings.source, line, settings.wordWrap];
const args = [settings.source, line];
window.parent.postMessage({
command: 'did-click-link',
data: `command:_markdown.revealLine?${encodeURIComponent(JSON.stringify(args))}`
......
......@@ -102,7 +102,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand('markdown.showPreviewToSide', uri => showPreview(cspArbiter, uri, true)));
context.subscriptions.push(vscode.commands.registerCommand('markdown.showSource', showSource));
context.subscriptions.push(vscode.commands.registerCommand('_markdown.revealLine', (uri: string, line: number, wordWrap: boolean) => {
context.subscriptions.push(vscode.commands.registerCommand('_markdown.revealLine', (uri, line) => {
const sourceUri = vscode.Uri.parse(decodeURIComponent(uri));
logger.log('revealLine', { uri, sourceUri: sourceUri.toString(), line });
......@@ -112,7 +112,7 @@ export function activate(context: vscode.ExtensionContext) {
const sourceLine = Math.floor(line);
const fraction = line - sourceLine;
const text = editor.document.lineAt(sourceLine).text;
const start = wordWrap ? Math.floor(fraction * text.length) : 0;
const start = Math.floor(fraction * text.length);
editor.revealRange(
new vscode.Range(sourceLine, start, sourceLine + 1, 0),
vscode.TextEditorRevealType.AtTop);
......
......@@ -218,8 +218,7 @@ export class MDDocumentContentProvider implements vscode.TextDocumentContentProv
line: initialLine,
scrollPreviewWithEditorSelection: this.config.scrollPreviewWithEditorSelection,
scrollEditorWithPreview: this.config.scrollEditorWithPreview,
doubleClickToSwitchToEditor: this.config.doubleClickToSwitchToEditor,
wordWrap: this.config.wordWrap
doubleClickToSwitchToEditor: this.config.doubleClickToSwitchToEditor
};
this.logger.log('provideTextDocumentContent', initialData);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册