icsharpcode / avalonedit Goto Github PK
View Code? Open in Web Editor NEWThe WPF-based text editor component used in SharpDevelop
Home Page: http://avalonedit.net/
License: MIT License
The WPF-based text editor component used in SharpDevelop
Home Page: http://avalonedit.net/
License: MIT License
When Options.EnableTextDragDrop
is false
the mouse cursor over the "+" in folding area doesn't change to Cursor.Arrow
.
The selection box is not correctly aligned in y position with the line and caret, as shown by the following image:
See how the caret (between var
and buffer
) looks shifted up by 1 pixel respect to selection box. The bug is more evident on certain font sizes.
The above image was produced by having Options.SelectionBorder.Thickness
= 0 and using a Consolas
font family and having caret thickness of 2 (in control panel).
I fixed it by subtracting 0.5
in BackgroundGeometryBuilder.cs
, but don't know if it's correct:
double y = visualLine.GetTextLineVisualYPosition(line, VisualYPosition.LineTop)-0.5;
Word wrap works fine but could be enhanced to account for front matter in lists: Example:
- now is the time
for all good ...
Prefer
- now is the time
for all good ...
Perhaps an additional API? Something like InheritWordWrapWithFrontMatter
? The API could take a list of front matter items maybe.
AvalonEdit ScrollToEnd() is inefficient -- it sets ScrollOffset to infinity, and relies on the bounds check in arrange() to restore a sane ScrollOffset.
Unfortunately, this has the effect of destroying all cached visual lines. This makes ScrollToEnd() inefficient in log-viewer style applications that frequently append to the document and call ScrollToEnd().
When user tries to copy text from TextEditor while the selection is empty, the clipboard is cleared. This is not expected, since most text editors don't behave this way.
Clipboard should not be cleared, when user attempts to do this.
If virtual space is enabled, the copy operation of a rectangle selection should include the virtual spaces at the end of each line. This way when you later paste the content of the clipboard, the rectangle-shaped content is preserved.
Example:
Original, with rectangle selection moving letters before numbers:
123 a
123 ab
123 abc
Copy and paste with current behaviour:
a123
ab123
abc123
Should do instead:
a 123
ab 123
abc 123
See http://community.sharpdevelop.net/forums/t/22196.aspx
==> Crash:
SharpDevelop Version : 5.1.0.5096-Beta 2-27c8cac0
.NET Version : 4.5.51209
OS Version : Microsoft Windows NT 6.1.7601 Service Pack 1
Current culture : German (Germany) (de-DE)
Current UI language : en
Running under WOW6432, processor architecture: x86-64
Working Set Memory : 132560kb
GC Heap Memory : 18178kb
Unhandled WPF exception
Exception thrown:
System.NullReferenceException: Object reference not set to an instance of an object.
at ICSharpCode.AvalonEdit.Rendering.HeightTree.GetNodeByIndex(Int32 index)
at ICSharpCode.AvalonEdit.Rendering.TextView.GetVisualTopByDocumentLine(Int32 line)
at ICSharpCode.AvalonEdit.Editing.RectangleSelection.ReplaceSelectionWithText(String newText)
at ICSharpCode.AvalonEdit.Editing.TextArea.RemoveSelectedText()
at ICSharpCode.AvalonEdit.Editing.EditingCommandHandler.<>c__DisplayClass12_0.<OnDelete>b__0(Object target, ExecutedRoutedEventArgs args)
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
at System.Windows.Input.KeyEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
---- Recent log messages:
13:52:33.473 [1] INFO - Open file C:\Users\bramerd\Documents\SharpDevelop Projects\Crash\Crash\Program.cs
13:52:33.473 [1] DEBUG - Service startup: ICSharpCode.SharpDevelop.Workbench.IDisplayBindingService
13:52:33.538 [1] INFO - Loading addin Search & Replace
13:52:33.553 [1] DEBUG - Service startup: ICSharpCode.SharpDevelop.ILanguageService
13:52:33.644 [1] DEBUG - Update Foldings
13:52:33.648 [1] DEBUG - Service startup: ICSharpCode.SharpDevelop.Editor.Bookmarks.IBookmarkManager
13:52:33.661 [1] DEBUG - Trying to restore memento of '[AvalonEditViewContent C:\Users\bramerd\Documents\SharpDevelop Projects\Crash\Crash\Program.cs]' from key '1e13ec5:C:\USERS\BRAMERD\DOCUMENTS\SHARPDEVELOP PROJECTS\CRASH\CRASH\PROGRAM.CS'
13:52:33.757 [1] DEBUG - NavigationService -- resume logging
13:52:33.777 [1] DEBUG - ActiveContentChanged to [AvalonEditViewContent C:\Users\bramerd\Documents\SharpDevelop Projects\Crash\Crash\Program.cs]
13:52:33.777 [1] DEBUG - ActiveWorkbenchWindowChanged to [AvalonWorkbenchWindow: Program.cs]
13:52:33.777 [1] INFO - CurrentProject changed to Crash
13:52:33.778 [1] DEBUG - NavigationService
ActiveViewContent: Program.cs
Subview: ${res:FormsDesigner.DesignTabPages.SourceTabPage}
13:52:33.778 [1] DEBUG - ActiveViewContentChanged to [AvalonEditViewContent C:\Users\bramerd\Documents\SharpDevelop Projects\Crash\Crash\Program.cs]
13:52:33.815 [18] DEBUG - Git: OverlayIconManager Thread finished
13:52:33.845 [1] INFO - Loading addin ASP.NET MVC Binding
13:52:33.849 [1] DEBUG - Service startup: ICSharpCode.UnitTesting.ITestService
13:52:33.895 [LoadSolutionProjects] DEBUG - Crash: ParseFiles() finished. 0 files were re-used from CC cache; 2 files were parsed (2 of those are serializable)
13:52:33.944 [1] DEBUG - Update Foldings
13:52:34.123 [LoadSolutionProjects] DEBUG - LoadSolutionProjectsThread finished after 00:00:00.7448732
13:52:34.702 [5] DEBUG - Resolved (Line 16, Col 17) to
13:54:00.198 [1] DEBUG - Resolved (Line 27, Col 4) to
13:54:01.930 [19] DEBUG - Resolved (Line 15, Col 14) to
13:54:02.886 [1] DEBUG - Resolved (Line 19, Col 14) to
14:06:47.331 [1] DEBUG - Resolved (Line 16, Col 27) to
14:06:47.667 [1] ERROR - Unhandled WPF exception
--> Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at ICSharpCode.AvalonEdit.Rendering.HeightTree.GetNodeByIndex(Int32 index)
at ICSharpCode.AvalonEdit.Rendering.TextView.GetVisualTopByDocumentLine(Int32 line)
at ICSharpCode.AvalonEdit.Editing.RectangleSelection.ReplaceSelectionWithText(String newText)
at ICSharpCode.AvalonEdit.Editing.TextArea.RemoveSelectedText()
at ICSharpCode.AvalonEdit.Editing.EditingCommandHandler.<>c__DisplayClass12_0.<OnDelete>b__0(Object target, ExecutedRoutedEventArgs args)
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
at System.Windows.Input.KeyEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
---- Post-error application state information:
Installed 3rd party AddIns:
ProjectService.CurrentSolution: [Solution C:\Users\bramerd\Documents\SharpDevelop Projects\Crash\Crash.sln with 1 projects]
ProjectService.CurrentProject: [CSharpProject: Crash]
Workbench.ActiveContent: [AvalonEditViewContent C:\Users\bramerd\Documents\SharpDevelop Projects\Crash\Crash\Program.cs]
AvalonEdit is a great editor but is not keeping up with the times. AvalonEdit should provide better theme support for Light and Dark themes. If this is something that is not deemed necessary, could someone at least explain how I could go about skinning the editor in a dark theme (see VS 2013 Dark theme as an example).
Hi,
i have a program released with few hundred users. One of them is observing a strange exception.
The program is crashing with a strange Baml2006.TypeConverterMarkupExtension exception.
We've managed to track the exception down to the loading of the avalonedit (Exception log: at the end of the issue).
As a test, i've send him a simple wpf-prog. which does nothing else than loading a plain TextEditor
(nothing else, no highlighting folding or anything else).
It crashes with the same error (with a simple TextBox it works) so we can be sure the avlonedit is the "maker" of the exception.
(BTW: newest avalonedit version added via NuGet)
The strangest part is the inner exception. It seems, that something tries to "save?!" a temporary cursor file and load it afterwards but the file does not seem to exists.
I cannot reproduce it (as well as all other users). But I'am in close contact to the person which observes the error so I can send him everything you suggesting here.
I have also a (big) exception log for you:
Section: SPEDIT MAIN
.NET Version: 4.0.30319.34209
OS: Microsoft Windows NT 6.1.7601 Service Pack 1
64 bit OS: TRUE
64 bit mode: TRUE
Dir: C:\Users\*****\Desktop\errorversions_spedit_2
Working Set: 74864 kb
Installed UI Culture: en-US
Current UI Culture: en-US
Current Culture: en-US
Exception
Message:
Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.
Stacktrace:
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.ResourceDictionary.CreateObject(KeyRecord key)
at System.Windows.ResourceDictionary.OnGettingValue(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.OnGettingValuePrivate(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.SystemResources.LookupResourceInDictionary(ResourceDictionary dictionary, Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce)
at System.Windows.FrameworkElement.UpdateThemeStyleProperty()
at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
at System.Windows.FrameworkElement.OnVisualParentChanged(DependencyObject oldParent)
at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent)
at System.Windows.Media.VisualCollection.Add(Visual visual)
at System.Windows.Controls.Panel.GenerateChildren()
at System.Windows.Controls.Panel.get_InternalChildren()
at System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure measureElement, IStackMeasureScrollData scrollData, Size constraint)
at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Application.<RunInternal>b__f(Object obj)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunInternal(Window window)
at Spedit.Program.Main(String[] args)
Source: PresentationFramework
HResult Code: -2146233087
Helplink: null
Targetsite Name: Load
Inner exception:
{
Message:
The file exists.
Stacktrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Path.InternalGetTempFileName(Boolean checkHost)
at System.Windows.Input.Cursor.LoadFromStream(Stream cursorStream)
at System.Windows.Input.CursorConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
Source: mscorlib
HResult Code: -2147024816
Helplink: null
Targetsite Name: WinIOError
Inner Exception: null
}
I hope we can track the error down together.
I'm using CShell, which makes use of the AvalonEdit project for code completion. This was originally filed at lukebuehler/CShell#26 but since he's using your control it would need to be fixed here. I've cleaned up the description a bit to hopefully make it clearer what I'm requesting.
Below when I refer to "pascal case" or "camel case" I'm referring to the styles given, e.g., here: http://msdn.microsoft.com/en-us/library/x2dbyw72(v=vs.71).aspx.
For the purpose of code completion I would like the query tist
to match the text thisIsSomeText
because it matches the first letter of each word in the text.
This comes up most often when trying to use auto completion to complete a variable, which I typically name using camel case.
This request seems reasonable because tist
does in fact match the text ThisIsSomeText
(note pascal case instead of camel case this time).
You may also want to consider fixing what is probably a bug in the current implementation: ist
matches thisIsSomeText
because it matches all the upper case letters even though it doesn't match the first letter of the first word.
When the scroll bar visibility is set to Auto, the commands to scroll to the end (ScrollToEnd, ScrollToLine(document.LineCount)) do not always work correctly. The reason is that the ScrollViewer internally first hides the scroll bars and then shows them again in order to find out if the scroll bars are needed.
More details at http://community.sharpdevelop.net/forums/p/21689/54612.aspx
Open a code completion popup and select an item that has an XmlDoc description.
Then, scroll in the text editor; or move the SharpDevelop window.
Expected result: the completion popup and description tooltip move with the text.
Actual result: only the completion popup moves with the text, the description tooltip stays in place.
When in rectangle selection, you can type text and have it inserted on each row of the selection; but if you use backspace to edit, the selection cancels and the backspace is applied only the line where the caret is.
Ideally, backspace should be applied on each line of the selection (like in Visual Studio).
In my application, I use AvalonEdit as text editor, whilst also having a third-party Ribbon control. That Ribbon control shows keyboard shortcuts when the user presses the Alt-Key. In general this works.
However, when doing a rectangular selection using the mouse (i.e. press Alt, drag with mouse, release Alt), the Alt-KeyUp event is not marked as handled by AvalonEdit. This results in the Ribbon incorrectly showing the keyboard shortcuts (since it seems that user simply pressed and released the Alt-Key).
SD-1916, originally created on 10/16/2012 18:10:03 by Daniel Grunwald
Enable the "Show spaces" and "Show tabs" options
Create a new text file inside SharpDevelop
Copy this gist: https://gist.github.com/3899997 into the editor
Use operations like Ctrl+A or rectangular selection
Both step 3 and the operations in step 4 feel quite slow. With "Show
tabs" and "Show spaces" disabled, it feels significantly faster.
This seems to be related to EnableEmailHyperlinks/EnableHyperlinks;
turning these two features off increases performance noticably (though
it's still slower than without "Show spaces").
Comment from Daniel Grunwald on 10/16/2012 18:14:46:
AvalonEdit.Benchmark results from my notebook, "ModifyLongLine" with
longLineLength=500, default window dimensions.
With show spaces: 4 FPS
With show spaces but without EnableEmailHyperlinks/EnableHyperlinks: 11
FPS
Without show spaces: 20 FPS
Disabling EnableEmailHyperlinks/EnableHyperlinks has no effect without
show spaces.
Hello. We use auto-completion with your editor. It works fine. But when i start typing in text area while part of text already selected - CompletionSegment miss first character. So auto completion ignore first key typed in. Even your completion example works with this bug.
How to fix this?
AvalonEdit should support ctrl+ins, ctrl+del and shift+ins as alternate shortcuts for cut, copy and paste.
In Windows it's a common standard, see wikipedia. The old WinForm editor had it as well.
There is a possible incorrect behavior I've found I would like to discuss:
When you navigate with page down
, the caret is forced into view by TextView.MakeVisible()
, but that often makes the scroll Y offset to be unaligned respect to text lines, causing a partially covered top line (very noticeable with big fonts).
IMO, the correct behavior should be forcing newScrollOffset.Y
to be a perfect multiple of DefaultLineHeight
, so that the first line is always "in sync". This is what all other editors mostly do (e.g. VS).
I was thinking something like this:
newScrollOffset.Y = Math.Floor(newScrollOffset.Y / DefaultLineHeight) * DefaultLineHeight;
But I don't know if that fix is correct to, because of this DefaultLineHeight
comment:
/// Gets the default line height. This is the height of an empty line or a line containing regular text.
/// Lines that include formatted text or custom UI elements may have a different line height.
What do you think?
I can make AvalonEdit show text bound to a ViewModel`s simple string property.
I can make a TextBox show text bound to a ObservableCollection
I can NOT make AvalonEdit show text bound to a ObservableCollection
I get in no case any binding errors from here all is fine.
I use Visual Studio 2013
with a .NET 3.5 project.
I have referenced the System.Windows.Interactivity.dll because I use a custom Behavior to make the AvalonEdit.Text property fit more in the MVVM pattern.
I have attached a sample project where you can reproduce the behavior.
http://www.file-upload.net/download-9067428/ExpanderTest.7z.html
This is similar to a bug #18.
The text for pasting is acquired before the OnPaste event is raised. This does not allow event handlers to modify the pasted text. See SelectionMouseHandler.cs
line 225. The text needs to be reacquired after the paste event is raised in case the event handler has modified the data object.
With show spaces on, the 'end' key jumps to the end of the line, after any whitespace.
With show spaces off, it jumps to the end of the line, but before any trailing whitespace.
The behavior should be consistent between the two settings. Also, I think the first behavior is more useful -- trailing whitespace usually is unintentional, and one should be able to find it by pressing 'end'. Notepad++ also jumps to the end of line after trailing whitespace.
Hi I built an IronPython embedded tool and I am using your control to display the python snippets.
i recently through the use of the Python Abstract Parse tree and your Foldings engine built a PythonFoldingStratgy.
It works pretty good until I switch focus among tabs each window loses the collapsed/expanded state of its foldings.
Since I already derived from TextEditor to provide a string property for setting the source and to load the Python Syntax Highlighting Rules...I figured I could just cache the collapsed state of the foldings and restore them when I got focus.
But when I look at the AllFolding property of the foldingManager I found that it had no items so i could not cache them.
Is there some other property I should be looking at?
First of all, this is a very cool control. Great job! This is an obscure situation, but I notice that the control becomes disabled when I apply the following global style to ScrollViewers. My project is using Telerik and I'm trying to apply the theme to the project's ScrollViewers. Once I remove this the control works as expected
<Style TargetType="ScrollViewer">
<Setter Property="telerik:StyleManager.Theme" Value="{StaticResource Theme}"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="VerticalScrollBarVisibility" Value="Disabled"/>
</Style>
I was getting funky exception messages like
System.ArgumentOutOfRangeException: Value must be between 0 and 789, Parameter name: length, Actual value was 41.
Huh? O.o
I debugged the source and realized that the value really was out of range, it was just the message which was wrong!
The line
throw new ArgumentOutOfRangeException("length", length, "Value must be between 0 and " + (documentLength - length));
should be
throw new ArgumentOutOfRangeException("length", length, "Value must be between 0 and " + (documentLength - start));
Thanks!
Everything seems to work fine, as if the code completion text was there, it is just not displayed.
The same behaviour observed on a version of AvalonEdit from 2013 and on the last one.
The minimalistic F# code for using AvalonEdit follows. (Program.fs, Gui.fs, CompletionData.fs, Gui.xaml).
These References are sufficient for running the code:
Program.fs:
//Imported modules/namespaces:
// System:
open System
// Project:
open Gui
[<EntryPoint>]
[<STAThread>]
let main _ =
Osdeui().Run()
Gui.fs:
module Gui
open FSharp.Data
open System
open System.Net
open System.Runtime
open System.Windows
open System.Windows.Controls
open ICSharpCode.AvalonEdit
open ICSharpCode.AvalonEdit.CodeCompletion
open System.Windows.Input
open CompletionData
let appname = "codeCompletionTest"
// Load GUI from URI
// appname .. name of application
// xamlName .. name of XAML file
let createWindow appname xamlName =
let uriString = sprintf "/%s;component/%s" appname xamlName
let uri = System.Uri(uriString, System.UriKind.Relative)
Application.LoadComponent(uri) :?> Window
let (?) (window : Window) name =
window.FindName name
|> unbox
let inline (+=) (event : IEvent<_, _>) handler =
(event :> Microsoft.FSharp.Control.IDelegateEvent<_>).AddHandler(RoutedEventHandler(handler))
type Osdeui (xaml : Window) as this = class
let exit : Button = xaml?exit
let textEditor : TextEditor = xaml?txtEditor
// code completion
let completionWindow = new CompletionWindow(textEditor.TextArea)
do
exit.Click += this.exitClick
textEditor.TextArea.TextEntering.AddHandler(TextCompositionEventHandler this.textEditor_TextArea_TextEntering)
textEditor.TextArea.TextEntered.AddHandler(TextCompositionEventHandler this.textEditor_TextArea_TextEntered)
new () = Osdeui (createWindow appname "Gui.xaml")
member this.exitClick (_ : obj) (_ : RoutedEventArgs) =
Application.Current.Shutdown()
member this.textEditor_TextArea_TextEntering (sender : obj) (e : TextCompositionEventArgs) =
if (e.Text.Length > 0 && completionWindow <> null) then
(
if (not (Char.IsLetterOrDigit (e.Text.[0]))) then (
// Whenever a non-letter is typed while the completion window is open,
// insert the currently selected element.
completionWindow.CompletionList.RequestInsertion(e)
) else ()
) else ()
member this.textEditor_TextArea_TextEntered (sender : obj) (e : TextCompositionEventArgs) =
(
if (e.Text = " ") then (
// Open code completion after the user has pressed space:
let completionWindow = new CompletionWindow(textEditor.TextArea)
let data = completionWindow.CompletionList.CompletionData;
let items = ["Item1"; "Item2"; "Item3"]
List.iter (fun x -> data.Add(new MyCompletionData(x))) items
completionWindow.Show();
completionWindow.Closed.AddHandler(EventHandler (fun _ _ -> (completionWindow.Close())))
) else ()
)
member this.Run () =
(new Application()).Run xaml
end
CompletionData.fs:
module CompletionData
open ICSharpCode.AvalonEdit.CodeCompletion
open System
open System.Windows.Media.Imaging
/// Implements AvalonEdit ICompletionData interface to provide the entries in the
/// completion drop down.
type MyCompletionData (text:string) =
let _text = text
interface ICompletionData with
member this.Complete (textArea, completionSegment, insertionRequestEventArgs) =
textArea.Document.Replace(completionSegment, ((this :> ICSharpCode.AvalonEdit.CodeCompletion.ICompletionData).Text: string));
// Use this property if you want to show a fancy UIElement in the list.
member this.Content
with get () = (this :> ICSharpCode.AvalonEdit.CodeCompletion.ICompletionData).Text :> obj
member this.Description
with get () = ("Description for " + (this :> ICSharpCode.AvalonEdit.CodeCompletion.ICompletionData).Text ) :> obj
member this.Image
with get () = null
member this.Priority
with get () = 1.0
member this.Text = _text
Gui.xaml:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:avalonEdit="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit"
xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Width="1018.944" Height="360" Title="OSLC">
<StackPanel HorizontalAlignment="Left" Height="329" VerticalAlignment="Top" Width="1009">
<StackPanel Height="28" Orientation="Horizontal">
<Button x:Name="exit" Content="exit" Width="75" HorizontalAlignment="Right" HorizontalContentAlignment="Center"/>
</StackPanel>
<StackPanel Height="277">
<avalonEdit:TextEditor x:Name="txtEditor" Height="262" FontFamily="Consolas" FontSize="10pt"/>
</StackPanel>
</StackPanel>
</Window>
I'm a user of https://github.com/lukebuehler/CShell which uses AvalonEdit for code completion. I originally filed this at lukebuehler/CShell#25 but am refiling it here.
I'd like it if code completion allowed on matching within a word combined with the camel case completion. For example if I want DateTime
I could enter dt
, see that there are still a lot of types that match dt
via camel case completion and continue on to type dtime
, which will filter the list down to just a couple choices, one of which is DateTime
.
This idea is heavily based on my use of Resharper which allows this sort of query.
One approach to this would be:
This could alternately require the query to match starting at the beginning of the text by changing 1. to:
This is request from the message board on the CodeProject article:
Hey,
could you please make the "MinimumDistanceToViewBorder" in Caret.cs to a property or so.
Reason:
See http://community.sharpdevelop.net/forums/t/22188.aspx for full exception output.
SharpDevelop Version : 5.1.0.5084-Beta 2-c5791b46
.NET Version : 4.5.50938
OS Version : Microsoft Windows NT 6.1.7601 Service Pack 1
Current culture : English (United States) (en-US)
Running under WOW6432, processor architecture: x86-64
Working Set Memory : 512768kb
GC Heap Memory : 209302kb
Unhandled WPF exception
Exception thrown:
System.OverflowException: Arithmetic operation resulted in an overflow.
at ICSharpCode.AvalonEdit.Utils.CharRope.ToString(Rope`1 rope, Int32 startIndex, Int32 length)
at ICSharpCode.AvalonEdit.Document.TextDocument.GetText(Int32 offset, Int32 length)
at CSharpBinding.Parser.TParser.AddCommentTags(SyntaxTree cu, IList`1 tagComments, ITextSource fileContent, FileName fileName, IDocument& document)
at CSharpBinding.Parser.TParser.Parse(FileName fileName, ITextSource fileContent, Boolean fullParseInformationRequested, IProject parentProject, CancellationToken cancellationToken)
at ICSharpCode.SharpDevelop.Parser.ParserServiceEntry.ParseWithExceptionHandling(ITextSource fileContent, Boolean fullParseInformationRequested, IProject project, CancellationToken cancellationToken)
at ICSharpCode.SharpDevelop.Parser.ParserServiceEntry.DoParse(ITextSource fileContent, IProject parentProject, Boolean fullParseInformationRequested, CancellationToken cancellationToken)
at ICSharpCode.SharpDevelop.Parser.ParserServiceEntry.Parse(ITextSource fileContent, IProject parentProject, CancellationToken cancellationToken)
at ICSharpCode.SharpDevelop.Parser.ParserService.Resolve(FileName fileName, TextLocation location, ITextSource fileContent, ICompilation compilation, CancellationToken cancellationToken)
at ICSharpCode.SharpDevelop.Parser.ParserService.Resolve(ITextEditor editor, TextLocation location, ICompilation compilation, CancellationToken cancellationToken)
at ICSharpCode.SharpDevelop.Editor.ToolTipRequestEventArgs.get_ResolveResult()
at ICSharpCode.AvalonEdit.AddIn.XmlDoc.XmlDocTooltipProvider.HandleToolTipRequest(ToolTipRequestEventArgs e)
at ICSharpCode.SharpDevelop.Editor.ToolTipRequestService.RequestToolTip(ToolTipRequestEventArgs e)
at ICSharpCode.AvalonEdit.AddIn.CodeEditorView.TextEditorMouseHover(Object sender, MouseEventArgs e)
at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at ICSharpCode.AvalonEdit.Rendering.TextView.RaiseHoverEventPair(MouseEventArgs e, RoutedEvent tunnelingEvent, RoutedEvent bubblingEvent)
at ICSharpCode.AvalonEdit.Rendering.TextView.<.ctor>b__0(Object sender, MouseEventArgs e)
at ICSharpCode.AvalonEdit.Rendering.MouseHoverLogic.OnMouseHover(MouseEventArgs e)
at ICSharpCode.AvalonEdit.Rendering.MouseHoverLogic.OnMouseHoverTimerElapsed(Object sender, EventArgs e)
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
If you double click on a word to select it, selection is correct but caret isn't moved at the end of word/selection as in normal text editors.
I tried to fix it myself in SelectionMouseHandler.cs\textArea_MouseLeftButtonDown()
with
textArea.Caret.Offset = startWord.EndOffset;
but the caret keeps returning on the old position. Perhaps it's related to this comment:
// Set caret offset, but limit the caret to stay inside the selection.
// in whole-word selection, it's otherwise possible that we get the caret outside the
// selection - but the TextArea doesn't like that and will reset the selection, causing
// flickering.
but I don't know how to handle it.
Hi ,
I am trying to do an enum on the selected option from the completion window. selecteditem does not do it for me for some reason.
I would appreciate some help with this please
Thanks
On a file with about 1000 lines of text and syntax highlighting turned on, making a rectangle selection with more ~15 lines makes editing inside the selection very slow, dropping to something like 1 character per second.
When using a dark theme, the folding elements (markers and lines) does not show correctly as they have fixed colors (e.g. Brush.White
).
I think it should be given possibility to customize them, my suggestion is to add the following to the FoldingManager
object:
FoldingMarkerBrush
FoldingMarkerBackgroundBrush
SelectedFoldingMarkerBrush
SelectedFoldingMarkerBackgroundBrush
Would that be acceptable? In case I would write a pull request.
When "virtual space" is enabled and caret is in the first column, pressing cursor left should not move the caret to the end of the previous line (it should not move caret at all).
I think there is a small (and annoying) defect, I don't think it's a feature:
When you press Enter
to go to the new line, the automatic indentation fails if there are spaces right of the caret at the moment of pressing Enter
.
Example:
sometext I ¶
pressing enter at the "I" (symbolizing the caret) does not move under the "s" of "sometext", but goes instead to the start of line.
But if it's
sometextI¶
then it moves correctly.
I hope I have explained it well.
All this with DefaultIndentationStrategy
and TextEditor.Options.IndentationSize = 3;
Is it possible to implement a highlighter based on something other than Regex (an AST for instance)? The current IHighlightDefinition
appears to only work wth Regex.
If you try to delete symbols with multicarret (rectangle selection) while having 0 visual columns (by pressing backspace or del), you will have your selection flushed back to single line carret and only 1 symbol will be deleted.
Back in 4.3.1 everything was fine with it
I have a base set of highlighting rules I load at start, but continuously scan the document for new ones and add them on the fly and the text that matches, if displayed on the screen doesn't get the new highlight. If I re-size the window to not display the text that should match the new rule and then move it back so the text is displayed it is now highlighted,
Also for the same line of text (if its not highlighted) simply selecting ANY text on that line will apply the rule and the text is proper highlighted.
When click-dragging on the line number margin and dragging to the top/bottom, the document does not scroll. In contrast to this, when click-dragging inside the document text, the document does scroll.
Example code:
DataObject.AddPastingHandler(AvalonEditBox, OnPaste);
private void OnPaste(object sender, DataObjectPastingEventArgs e)
{
var isText = e.SourceDataObject.GetDataPresent(DataFormats.UnicodeText, true);
if (!isText) return;
var text = (string)e.SourceDataObject.GetData(DataFormats.UnicodeText);
var dataObject = new DataObject();
dataObject.SetData(DataFormats.UnicodeText, text.ReplaceSpecialChars());
e.DataObject = dataObject;
}
The OnPaste
method in ICSharpCode.AvalonEdit.Editing.EditingCommandHandler.cs
aquires the modified format (line 457) but not the modified text from the raised event.
The caret color should be set to be a contrasting color to the current background color
Hi, this project is just brilliant and I've been using it for a couple years for now.
The only one problem is UI freezes when working with huge documents >10Mb and active search running.
The root of the problem is that offsets calculation process is running in the main UI thread, matching big text using regexps takes a lot of time ( e.x. on my machine when 20 Mb file is opened and any type of search active any keypress leads to 2,2 secs delay, matching text with simple regex takes about 2,1 secs).
So the first thought - move matching phase to another thread, additionally add interception code in each iteration so that any running background process could be easily stopped by new one (typing -> search started, typing before search completed -> search process stopped and new one started).
I've worked a bit on this problem and have some implementation in my fork (worked out dispatcher issues + interception implementation), no more freezes during typing + simplified search dependencies, unfortunately I've abandoned some search functionality? but I'm sure that with your help we can implement match whole word without document dependency (so it could run in parallel thread).
If you are interested in this type of functionality I can upload performance reports and send pull request.
Again, thanks for your work.
I have a simple xshd for syntax highlighting liquid templates.
<?xml version="1.0"?>
<!-- See https://github.com/icsharpcode/SharpDevelop/wiki/Syntax-highlighting -->
<SyntaxDefinition name = "dotliquid" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<RuleSet >
<Span background="Black" foreground="LightGreen" >
<Begin >{%</Begin>
<End>%}</End>
<RuleSet >
<Span background="Black" foreground="LightBlue" >
<Begin >{{</Begin>
<End >}}</End>
</Span>
</RuleSet>
</Span>
<Span background="Black" foreground="LightBlue" >
<Begin >{{</Begin>
<End >}}</End>
</Span>
</RuleSet>
</SyntaxDefinition>
But the result is
So {{}} type tags can be embedded in {%%} type tags but the background color is reset to white after the closing }}
Tabs can still be pasted into a document when the ConvertTabsToSpaces option is set to true. This feels inconsistent, and I believe most editors will convert pasted tabs when their corresponding setting is enabled (Visual Studio does at least).
With auto-indentation active, AnchorSegment and TextSegment start offsets are moved to the end of the line that contains them when an inserted line break causes new indentation.
The explanation seems to be that auto-indentation works by removing the whole of the new line before reinserting it with a tab at the beginning. However, automatic updating of AnchorSegment offsets is implemented such that removals spanning the start offset cause the start offset to be moved to the end of the line.
Steps to reproduce:
Step 1. Programatically create an AnchorSegment spanning some portion of a line, e.g. at the end of the Window1 constructor in Window1.xaml.cs in the sample:
textEditor.Text = "Blah blah blah *this is an anchor segment* blah blah";
AnchorSegment a = new AnchorSegment(textEditor.TextArea.Document, 15, 25);
This creates the following text:
Blah blah blah *this is an anchor segment* blah blah
where * indicates the start and end offsets of the AnchorSegment.
Step 2. Run the sample, with C# selected in the dropdown, and use the UI to insert a carriage return before the start of the AnchorSegment.
Actual behaviour: AnchorSegment moves to the end of the line.
Blah bl
ah blah this is an anchor segment blah blah**
Expected behaviour:
Blah bl
ah blah *this is an anchor segment* blah blah
Currently users can just scroll to the bottom of the file, but I want to scoll further, so the last line of the document can be shown at the top of the editor?
Is this possible?
Scenario: I am working on a linux machine, with an iceweasel instance running on one monitor; and rdesktop running on the other. The rdesktop instance is logged in to a Windows instance running SharpDevelop/AvalonEdit.
When copying text in iceweasel and trying to paste it in AvalonEdit, the following exception occurs:
System.ArgumentException: 'UnicodeText' data format is not present on DataObject.
at System.Windows.DataObjectPastingEventArgs..ctor(IDataObject dataObject, Boolean isDragDrop, String formatToApply)
at ICSharpCode.AvalonEdit.Editing.EditingCommandHandler.OnPaste(Object target, ExecutedRoutedEventArgs args)
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
As a workaround, I first paste the text into a notepad instance on the Windows machine, and copy it from there to paste into AvalonEdit.
I use AvalonEdit to display XML data, and sometimes that data include really long lines without spaces (at most it's 25MB byte[] data encoded as base64).
When I enable WordWrap performance drops really bad.
And even with WordWrap disabled lines are still wrapping after 9600 symbols, so performance drops to unacceptable levels in worst case. Workaround is checking string and splitting lines by 8000 symbols - then performance is OK
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.