/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/EditorFeatures/VisualBasic/LineCommit/AfterCommitCaretMoveUndoPrimitive.vb
38 строк
2 KB
Cyrus Najmabadi
Organize VB imports
27 июн 2025, 21:53
27 июн 2025, 21:53
e9c47fd
Код
Авторство
О чём код?
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.VisualStudio.Text Imports Microsoft.VisualStudio.Text.Editor Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineCommit Friend Class AfterCommitCaretMoveUndoPrimitive Inherits AbstractCommitCaretMoveUndoPrimitive Private ReadOnly _newPosition As Integer Private ReadOnly _newVirtualSpaces As Integer Public Sub New(textBuffer As ITextBuffer, textBufferAssociatedViewService As ITextBufferAssociatedViewService, position As CaretPosition) MyBase.New(textBuffer, textBufferAssociatedViewService) ' Grab the old position and virtual spaces. This is cheaper than holding onto ' a VirtualSnapshotPoint as it won't hold old snapshots alive _newPosition = position.VirtualBufferPosition.Position _newVirtualSpaces = position.VirtualBufferPosition.VirtualSpaces End Sub Public Overrides Sub [Do]() Dim view = TryGetView() If view IsNot Nothing Then view.Caret.MoveTo(New VirtualSnapshotPoint(New SnapshotPoint(view.TextSnapshot, _newPosition), _newVirtualSpaces)) view.Caret.EnsureVisible() End If End Sub Public Overrides Sub Undo() ' When we are going forward, we do nothing here since the BeforeCommitCaretMoveUndoPrimitive ' will take care of it End Sub End Class End Namespace