C# Class Vim.UI.Wpf.Implementation.BlockCaret.BlockCaret

Inheritance: IBlockCaret
显示文件 Open project: jaredpar/VsVim

Private Properties

Property Type Description
BlockCaret System
BlockCaret System
CalculateCaretRectAndDisplayOffset double>.Tuple
CalculateCaretSize System.Windows.Size
CreateBlinkTimer System.Windows.Threading.DispatcherTimer
CreateCaretData CaretData
CreateFormattedText System.Windows.Media.FormattedText
DestroyCore void
EnsureAdornmentRemoved void
EnsureCaretDisplayed void
GetCaretBlinkTime int?
GetRealCaretVisualPoint Point
IsAdornmentStale bool
MaybeDestroy void
MoveCaretImageToCaret void
OnBlockCaretAdornmentRemoved void
OnCaretBlinkTimer void
OnCaretEvent void
OnCaretPositionChanged void
OnTextViewClosed void
TryCalculateCaretColor Color?
UpdateCaret void
UpdateCaretCore void

Public Methods

Method Description
Destroy ( ) : void

Private Methods

Method Description
BlockCaret ( ITextView textView, IClassificationFormatMap classificationFormatMap, IEditorFormatMap formatMap, IAdornmentLayer layer, IControlCharUtil controlCharUtil, IProtectedOperations protectedOperations ) : System
BlockCaret ( IWpfTextView textView, string adornmentLayerName, IClassificationFormatMap classificationFormatMap, IEditorFormatMap formatMap, IControlCharUtil controlCharUtil, IProtectedOperations protectedOperations ) : System
CalculateCaretRectAndDisplayOffset ( ) : double>.Tuple
CalculateCaretSize ( ) : Size

Calculate the dimensions of the caret

CreateBlinkTimer ( IProtectedOperations protectedOperations, EventHandler onCaretBlinkTimer ) : DispatcherTimer

This helper is used to work around a reported, but unreproducable, bug. The constructor of DispatcherTimer is throwing an exception claiming a millisecond time greater than int.MaxValue is being passed to the constructor. This is clearly not possible given the input is an int value. However after multiple user reports it's clear the exception is getting triggered. The only semi-plausible idea I can come up with is a floating point conversion issue. Given that the input to Timespan is int and the compared value is double it's possible that a conversion / rounding issue is causing int.MaxValue to become int.MaxValue + 1. Either way though need to guard against this case to unblock users. https://github.com/jaredpar/VsVim/issues/631 https://github.com/jaredpar/VsVim/issues/1860

CreateCaretData ( ) : CaretData
CreateFormattedText ( ) : System.Windows.Media.FormattedText
DestroyCore ( ) : void

Destroy all of the caret related data such that the caret is free for collection. In particular make sure to disable the DispatchTimer as keeping it alive will prevent collection

EnsureAdornmentRemoved ( ) : void
EnsureCaretDisplayed ( ) : void
GetCaretBlinkTime ( ) : int?

Get the number of milliseconds for the caret blink time. Null is returned if the caret should not blink

GetRealCaretVisualPoint ( ) : Point
IsAdornmentStale ( CaretData caretData ) : bool

This determines if the image which is used to represent the caret is stale and needs to be recreated.

MaybeDestroy ( ) : void
MoveCaretImageToCaret ( CaretData caretData ) : void
OnBlockCaretAdornmentRemoved ( object sender, UIElement element ) : void
OnCaretBlinkTimer ( object sender, EventArgs e ) : void
OnCaretEvent ( object sender, EventArgs e ) : void
OnCaretPositionChanged ( object sender, EventArgs e ) : void

Whenever the caret moves it should become both visible and reset the blink timer. This is the behavior of gVim. It can be demonstrated by simply moving the caret horizontally along a line of text. If the interval between the movement commands is shorter than the blink timer the caret will always be visible

OnTextViewClosed ( object sender, EventArgs e ) : void
TryCalculateCaretColor ( ) : Color?

Attempt to copy the real caret color

UpdateCaret ( ) : void
UpdateCaretCore ( ) : void

Method Details

Destroy() public method

public Destroy ( ) : void
return void