本文整理汇总了C#中IVimTextBuffer类的典型用法代码示例。如果您正苦于以下问题:C# IVimTextBuffer类的具体用法?C# IVimTextBuffer怎么用?C# IVimTextBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVimTextBuffer类属于命名空间,在下文中一共展示了IVimTextBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateVimBufferData
/// <summary>
/// This is not technically a Mock but often we want to create it with mocked
/// backing values
/// </summary>
/// <returns></returns>
public static VimBufferData CreateVimBufferData(
IVimTextBuffer vimTextBuffer,
ITextView textView,
IJumpList jumpList = null,
IStatusUtil statusUtil = null,
IUndoRedoOperations undoRedoOperations = null,
IVimWindowSettings windowSettings = null,
IWordUtil wordUtil = null,
MockRepository factory = null)
{
factory = factory ?? new MockRepository(MockBehavior.Strict);
statusUtil = statusUtil ?? factory.Create<IStatusUtil>().Object;
undoRedoOperations = undoRedoOperations ?? factory.Create<IUndoRedoOperations>().Object;
jumpList = jumpList ?? factory.Create<IJumpList>().Object;
wordUtil = wordUtil ?? factory.Create<IWordUtil>().Object;
windowSettings = windowSettings ?? factory.Create<IVimWindowSettings>().Object;
return new VimBufferData(
jumpList,
textView,
statusUtil,
undoRedoOperations,
vimTextBuffer,
windowSettings,
wordUtil);
}
示例2: CreateVimBufferData
/// <summary>
/// Create a new instance of VimBufferData. Centralized here to make it easier to
/// absorb API changes in the Unit Tests
/// </summary>
protected IVimBufferData CreateVimBufferData(
IVimTextBuffer vimTextBuffer,
ITextView textView,
IStatusUtil statusUtil = null,
IJumpList jumpList = null,
IUndoRedoOperations undoRedoOperations = null,
IVimWindowSettings windowSettings = null,
IWordUtil wordUtil = null)
{
jumpList = jumpList ?? new JumpList(textView, _bufferTrackingService);
statusUtil = statusUtil ?? new StatusUtil();
undoRedoOperations = undoRedoOperations ?? CreateUndoRedoOperations(statusUtil);
windowSettings = windowSettings ?? new WindowSettings(vimTextBuffer.GlobalSettings);
wordUtil = wordUtil ?? WordUtilFactory.GetWordUtil(vimTextBuffer.TextBuffer);
return new VimBufferData(
vimTextBuffer,
textView,
windowSettings,
jumpList,
statusUtil,
undoRedoOperations,
wordUtil);
}
示例3: CreateVimBufferData
/// <summary>
/// Create a new instance of VimBufferData. Centralized here to make it easier to
/// absorb API changes in the Unit Tests
/// </summary>
protected IVimBufferData CreateVimBufferData(
IVimTextBuffer vimTextBuffer,
ITextView textView,
IStatusUtil statusUtil = null,
IJumpList jumpList = null,
IVimWindowSettings windowSettings = null,
IWordUtil wordUtil = null)
{
jumpList = jumpList ?? new JumpList(textView, BufferTrackingService);
statusUtil = statusUtil ?? new StatusUtil();
windowSettings = windowSettings ?? new WindowSettings(vimTextBuffer.GlobalSettings);
wordUtil = wordUtil ?? WordUtil;
return new VimBufferData(
vimTextBuffer,
textView,
windowSettings,
jumpList,
statusUtil,
wordUtil);
}
示例4: BufferInfo
internal BufferInfo(IVimTextBuffer vimTextBuffer, string name = "<unnamed>")
{
_vimTextBuffer = vimTextBuffer;
_name = name;
}
示例5: Create
protected void Create(params string[] lines)
{
_vimHost = (MockVimHost)Vim.VimHost;
_textView = CreateTextView(lines);
_textBuffer = _textView.TextBuffer;
_vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
_localSettings = _vimTextBuffer.LocalSettings;
var foldManager = CreateFoldManager(_textView);
_factory = new MockRepository(MockBehavior.Loose);
_statusUtil = _factory.Create<IStatusUtil>();
_bulkOperations = new TestableBulkOperations();
var vimBufferData = CreateVimBufferData(
_vimTextBuffer,
_textView,
statusUtil: _statusUtil.Object);
_jumpList = vimBufferData.JumpList;
_windowSettings = vimBufferData.WindowSettings;
_vimData = Vim.VimData;
_macroRecorder = Vim.MacroRecorder;
_globalSettings = Vim.GlobalSettings;
var operations = CreateCommonOperations(vimBufferData);
_motionUtil = new MotionUtil(vimBufferData, operations);
_commandUtil = new CommandUtil(
vimBufferData,
_motionUtil,
operations,
foldManager,
new InsertUtil(vimBufferData, operations),
_bulkOperations);
}
示例6: Create
private void Create(KeyRemapMode countKeyRemapMode, params string[] lines)
{
_textView = CreateTextView(lines);
_vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer);
_registerMap = Vim.RegisterMap;
var vimBufferData = CreateVimBufferData(
_vimTextBuffer,
_textView);
_commandUtil = CreateCommandUtil(vimBufferData);
var incrementalSearch = new IncrementalSearch(
vimBufferData,
CommonOperationsFactory.GetCommonOperations(vimBufferData));
var motionCapture = new MotionCapture(vimBufferData, incrementalSearch);
_runnerRaw = new CommandRunner(
_textView,
_registerMap,
motionCapture,
vimBufferData.LocalSettings,
_commandUtil,
new StatusUtil(),
VisualKind.Character,
countKeyRemapMode);
_runner = _runnerRaw;
}
示例7: Create
public void Create(params string[] lines)
{
_context = new TestableSynchronizationContext();
SynchronizationContext.SetSynchronizationContext(_context);
_textView = CreateTextView(lines);
_textBuffer = _textView.TextBuffer;
_vimBuffer = Vim.CreateVimBuffer(_textView);
_vimBuffer.SwitchMode(ModeKind.Normal, ModeArgument.None);
_vimTextBuffer = _vimBuffer.VimTextBuffer;
_registerMap = _vimBuffer.RegisterMap;
_globalSettings = _vimBuffer.LocalSettings.GlobalSettings;
Assert.IsTrue(_context.IsEmpty);
// Need to make sure it's focused so macro recording will work
((MockVimHost)_vimBuffer.Vim.VimHost).FocusedTextView = _textView;
}
示例8: Create
protected void Create(ITextView textView)
{
_textView = textView;
_textBuffer = textView.TextBuffer;
_snapshot = _textBuffer.CurrentSnapshot;
_textBuffer.Changed += delegate { _snapshot = _textBuffer.CurrentSnapshot; };
_vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
_statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict);
var vimBufferData = CreateVimBufferData(_vimTextBuffer, _textView, statusUtil: _statusUtil.Object);
_globalSettings = vimBufferData.LocalSettings.GlobalSettings;
_localSettings = vimBufferData.LocalSettings;
_markMap = vimBufferData.Vim.MarkMap;
_vimData = vimBufferData.Vim.VimData;
_search = vimBufferData.Vim.SearchService;
var wordNavigator = CreateTextStructureNavigator(_textView.TextBuffer, WordKind.NormalWord);
_motionUtil = new MotionUtil(vimBufferData);
}
示例9: Create
protected virtual void Create(params string[] lines)
{
_textView = CreateTextView(lines);
_textBuffer = _textView.TextBuffer;
_vimBuffer = Vim.CreateVimBuffer(_textView);
_vimBuffer.ErrorMessage +=
(_, message) =>
{
if (_assertOnErrorMessage)
{
throw new Exception("Error Message: " + message.Message);
}
};
_vimBuffer.WarningMessage +=
(_, message) =>
{
if (_assertOnWarningMessage)
{
throw new Exception("Warning Message: " + message.Message);
}
};
_vimBufferData = _vimBuffer.VimBufferData;
_vimTextBuffer = _vimBuffer.VimTextBuffer;
_normalMode = _vimBuffer.NormalMode;
_keyMap = _vimBuffer.Vim.KeyMap;
_localSettings = _vimBuffer.LocalSettings;
_globalSettings = _localSettings.GlobalSettings;
_windowSettings = _vimBuffer.WindowSettings;
_jumpList = _vimBuffer.JumpList;
_vimHost = (MockVimHost)_vimBuffer.Vim.VimHost;
_vimHost.BeepCount = 0;
_vimData = Vim.VimData;
_foldManager = FoldManagerFactory.GetFoldManager(_textView);
_clipboardDevice = (TestableClipboardDevice)CompositionContainer.GetExportedValue<IClipboardDevice>();
// Many of the operations operate on both the visual and edit / text snapshot
// simultaneously. Ensure that our setup code is producing a proper IElisionSnapshot
// for the Visual portion so we can root out any bad mixing of instances between
// the two
Assert.True(_textView.VisualSnapshot is IElisionSnapshot);
Assert.True(_textView.VisualSnapshot != _textView.TextSnapshot);
}
示例10: Create
protected void Create(params string[] lines)
{
_statusUtil = new TestableStatusUtil();
_vimData = Vim.VimData;
_vimBufferData = CreateVimBufferData(
CreateTextView(lines),
statusUtil: _statusUtil);
_vimBuffer = CreateVimBuffer(_vimBufferData);
_vimTextBuffer = _vimBufferData.VimTextBuffer;
_localSettings = _vimBufferData.LocalSettings;
_globalSettings = _localSettings.GlobalSettings;
_textBuffer = _vimBufferData.TextBuffer;
_textView = _vimBufferData.TextView;
_interpreter = new global::Vim.Interpreter.Interpreter(
_vimBuffer,
CommonOperationsFactory.GetCommonOperations(_vimBufferData),
FoldManagerFactory.GetFoldManager(_vimBufferData.TextView),
new FileSystem(),
BufferTrackingService);
_keyMap = Vim.KeyMap;
}
示例11: Create
public void Create(params string[] lines)
{
var tuple = EditorUtil.CreateTextViewAndEditorOperations(lines);
_textView = tuple.Item1;
_textBuffer = _textView.TextBuffer;
var service = EditorUtil.FactoryService;
_vimBuffer = service.Vim.CreateVimBuffer(_textView);
_vimBuffer.ErrorMessage +=
(_, message) =>
{
if (_assertOnErrorMessage)
{
Assert.Fail("Error Message: " + message);
}
};
_vimBuffer.WarningMessage +=
(_, message) =>
{
if (_assertOnWarningMessage)
{
Assert.Fail("Warning Message: " + message);
}
};
_vimTextBuffer = _vimBuffer.VimTextBuffer;
_keyMap = _vimBuffer.Vim.KeyMap;
_globalSettings = _vimBuffer.LocalSettings.GlobalSettings;
_jumpList = _vimBuffer.JumpList;
_vimHost = (MockVimHost)_vimBuffer.Vim.VimHost;
_vimHost.BeepCount = 0;
_vimData = service.Vim.VimData;
_foldManager = EditorUtil.FactoryService.FoldManagerFactory.GetFoldManager(_textView);
// Many of the operations operate on both the visual and edit / text snapshot
// simultaneously. Ensure that our setup code is producing a proper IElisionSnapshot
// for the Visual portion so we can root out any bad mixing of instances between
// the two
Assert.IsTrue(_textView.VisualSnapshot is IElisionSnapshot);
Assert.IsTrue(_textView.VisualSnapshot != _textView.TextSnapshot);
}
示例12: Create
private void Create(params string[] lines)
{
_vimHost = (MockVimHost)Vim.VimHost;
_textView = CreateTextView(lines);
_textBuffer = _textView.TextBuffer;
_vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
_localSettings = _vimTextBuffer.LocalSettings;
_foldManager = FoldManagerFactory.GetFoldManager(_textView);
_factory = new MockRepository(MockBehavior.Loose);
_statusUtil = _factory.Create<IStatusUtil>();
_smartIdentationService = _factory.Create<ISmartIndentationService>();
var vimBufferData = CreateVimBufferData(
_vimTextBuffer,
_textView,
statusUtil: _statusUtil.Object);
_jumpList = vimBufferData.JumpList;
_windowSettings = vimBufferData.WindowSettings;
_vimData = Vim.VimData;
_macroRecorder = Vim.MacroRecorder;
_registerMap = Vim.RegisterMap;
_globalSettings = Vim.GlobalSettings;
var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData);
_motionUtil = new MotionUtil(vimBufferData);
_commandUtil = new CommandUtil(
vimBufferData,
_motionUtil,
operations,
_smartIdentationService.Object,
_foldManager,
new InsertUtil(vimBufferData, operations));
}
示例13: Create
public void Create(params string[] lines)
{
_context = new TestableSynchronizationContext();
SynchronizationContext.SetSynchronizationContext(_context);
var tuple = EditorUtil.CreateTextViewAndEditorOperations(lines);
_textView = tuple.Item1;
_textBuffer = _textView.TextBuffer;
var service = EditorUtil.FactoryService;
_buffer = service.Vim.CreateVimBuffer(_textView);
_buffer.SwitchMode(ModeKind.Normal, ModeArgument.None);
_vimTextBuffer = _buffer.VimTextBuffer;
_registerMap = _buffer.RegisterMap;
_globalSettings = _buffer.LocalSettings.GlobalSettings;
Assert.IsTrue(_context.IsEmpty);
// Need to make sure it's focused so macro recording will work
((MockVimHost)_buffer.Vim.VimHost).FocusedTextView = _textView;
}
示例14: Create
private void Create(params string[] lines)
{
_vimTextBuffer = CreateVimTextBuffer(lines);
_textBuffer = _vimTextBuffer.TextBuffer;
}
示例15: Create
private void Create(params string[] lines)
{
_textView = CreateTextView(lines);
_vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer);
_registerMap = Vim.RegisterMap;
var vimBufferData = CreateVimBufferData(
_vimTextBuffer,
_textView);
_commandUtil = VimUtil.CreateCommandUtil(vimBufferData);
var motionCapture = VimUtil.CreateMotionCapture(vimBufferData);
_runnerRaw = new CommandRunner(
_textView,
_registerMap,
motionCapture,
_commandUtil,
new StatusUtil(),
VisualKind.Character);
_runner = _runnerRaw;
}