Git Product home page Git Product logo

avaloniaui / avaloniaedit Goto Github PK

View Code? Open in Web Editor NEW
648.0 648.0 128.0 2.25 MB

Avalonia-based text editor (port of AvalonEdit)

License: MIT License

C# 98.50% Shell 0.05% C 0.12% CoffeeScript 0.02% C++ 0.10% CSS 0.03% Less 0.01% SCSS 0.03% Dart 0.08% Dockerfile 0.03% Go 0.06% Groovy 0.09% HLSL 0.34% Java 0.09% JavaScript 0.13% Julia 0.05% Lua 0.06% Makefile 0.12% Perl 0.05% Roff 0.04%
avalonia code-editor editor netstandard text-editor

avaloniaedit's People

Contributors

aelij avatar alphanecron avatar arhell avatar bandysc avatar danipen avatar deadpikle avatar garyhertel avatar gillibald avatar grokys avatar hendrikmennen avatar hez2010 avatar jameswalmsley avatar jeffreye avatar jl0pd avatar jp2masa avatar kekekeks avatar krzysztofdusko avatar luthfiampas avatar markushaslinger avatar maxkatz6 avatar mgarstenauer avatar numpsy avatar pazof avatar siegfriedpammer avatar takoooooo avatar unconverged avatar washi1337 avatar whistyun avatar wieslawsoltes avatar zenonet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avaloniaedit's Issues

AvaloniaEdit won't show up

AvaloniaEdit won't show up in simple demo application.
AvaloniaEditNotShown

Am I missing something or is this a bug in AvaloniaEdit?

My package references

<PackageReference Include="Avalonia" Version="0.10.0-preview6" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview6" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0-preview6" />    
<PackageReference Include="Avalonia.AvaloniaEdit" Version="0.10.0-preview6" />    

XAML of the window

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:AvaloniaEditTest.ViewModels;assembly=AvaloniaEditTest"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:ae="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="AvaloniaEditTest.Views.MainWindow"
        Icon="/Assets/avalonia-logo.ico"
        Title="AvaloniaEditTest">

    <Design.DataContext>
        <vm:MainWindowViewModel/>
    </Design.DataContext>

    <Grid ColumnDefinitions="*" RowDefinitions="Auto,*,Auto">     
        <TextBlock
            Grid.Row="0" Grid.Column="0"
            Text="---HEADER---"
            HorizontalAlignment="Center"/>   
        <ae:TextEditor 
            Grid.Row="1" Grid.Column="0"
            x:Name="textCode"
            Margin="0"
            Background="Red"
            Foreground="Black"
            SyntaxHighlighting="XML"
            HorizontalScrollBarVisibility="Auto"
            VerticalScrollBarVisibility="Auto"
            FontWeight="Normal"
            FontSize="14"
            WordWrap="False"/> 
        <TextBlock
            Grid.Row="2" Grid.Column="0"
            Text="---FOOTER---"
            HorizontalAlignment="Center"/>
    </Grid>
</Window>

Here is pubic repository with full code of my demo app
https://gitlab.com/fedorkotov/avalonia-edit-example-20201031

Tab behaviour buggy

Hello,
I started using AvaloniaEdit recently.
Everytime I try to use the tab key after writing a char it creates weird symbols.
It looks like this (AvaloniaEdit demo):
Unbenannt

I tabbed two times, than wrote t1 and than used tab another multiple times which creates this symbols

I tried both on Windows and Linux with same results.
Anything I can do about that?

NuGet package?

It would be useful. Not necessary nuget.org but maybe myget.

How to use TextEditor?

Can you write Readme, and push any examples, pls? With latest version of avalonia i have "exception | {"Method not found: 'System.Action Avalonia.Controls.Primitives.ILogicalScrollable.get_InvalidateScroll()'."} | System.MissingMethodException". With latest stable avalonia version i had invisible control but IsVisible was true.

MissingMethodException is thrown

I tried to add AvaloniaEdit nuget into a project. Using Avalonia.Desktop 0.9.2
Project template is created from the mvvm template provided by avalonia.

However, the project fails to run with the following exception:
Unhandled exception. System.TypeInitializationException: The type initializer for 'AvaloniaEdit.Editing.TextArea' threw an exception.

Here is the entire stack trace:

Unhandled exception. System.TypeInitializationException: The type initializer for 'AvaloniaEdit.Editing.TextArea' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'AvaloniaEdit.Rendering.TextView' threw an exception.
 ---> System.MissingMethodException: Method not found: 'Void Avalonia.Media.Pen..ctor(Avalonia.Media.IBrush, Double, Avalonia.Media.DashStyle, Avalonia.Media.PenLineCap, Avalonia.Media.PenLineCap, Avalonia.Media.PenLineCap, Avalonia.Media.PenLineJoin, Double)'.
   at AvaloniaEdit.Rendering.TextView.CreateFrozenPen(IBrush brush)
   at AvaloniaEdit.Rendering.TextView..cctor()
   --- End of inner exception stack trace ---
   at AvaloniaEdit.Editing.TextArea..cctor()
   --- End of inner exception stack trace ---
   at Builder_cc0eb0a092b34ebca0de3b4a0e5e8c03_resm:AvaloniaEdit.Editing.TextArea.xaml?assembly=AvaloniaEdit.__AvaloniaXamlIlPopulate(IServiceProvider , Styles )
   at lambda_method(Closure , IServiceProvider )
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadOrPopulate(Type created, Object rootInstance)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSreCore(String xaml, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSre(String xaml, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Uri uri, Uri baseUri)
   at Avalonia.Markup.Xaml.Styling.StyleInclude.get_Loaded()
   at Avalonia.Markup.Xaml.Styling.StyleInclude.Avalonia.Controls.ISetResourceParent.ParentResourcesChanged(ResourcesChangedEventArgs e)
   at Avalonia.Styling.Styles.<.ctor>b__4_0(IStyle x)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass0_0`1.<ForEachItem>b__0(Int32 _, T i)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass1_0`1.<ForEachItem>g__Add|0(Int32 index, IList items)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass1_0`1.<ForEachItem>b__2(Object _, NotifyCollectionChangedEventArgs e)
   at Avalonia.Collections.AvaloniaList`1.NotifyAdd(T item, Int32 index)
   at Avalonia.Collections.AvaloniaList`1.Add(T item)
   at Builder_f5ecc677d06342bca01968013cf8ba82_resm:AvaloniaEdit.AvaloniaEdit.xaml?assembly=AvaloniaEdit.__AvaloniaXamlIlPopulate(IServiceProvider , Styles )
   at lambda_method(Closure , IServiceProvider )
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadOrPopulate(Type created, Object rootInstance)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSreCore(String xaml, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSre(String xaml, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Uri uri, Uri baseUri)
   at Avalonia.Markup.Xaml.Styling.StyleInclude.get_Loaded()
   at Avalonia.Markup.Xaml.Styling.StyleInclude.Avalonia.Controls.ISetResourceParent.ParentResourcesChanged(ResourcesChangedEventArgs e)
   at Avalonia.Styling.Styles.<.ctor>b__4_0(IStyle x)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass0_0`1.<ForEachItem>b__0(Int32 _, T i)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass1_0`1.<ForEachItem>g__Add|0(Int32 index, IList items)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass1_0`1.<ForEachItem>b__2(Object _, NotifyCollectionChangedEventArgs e)
   at Avalonia.Collections.AvaloniaList`1.NotifyAdd(T item, Int32 index)
   at Avalonia.Collections.AvaloniaList`1.Add(T item)
   at Avalonia.Styling.Styles.Add(IStyle item)
   at SharpVisUI.App.!XamlIlPopulate(IServiceProvider , App ) in /Users/Marin/Rider/SharpVisUI/SharpVisUI/App.xaml:line 1
   at SharpVisUI.App.!XamlIlPopulateTrampoline(App )
   at SharpVisUI.App.Initialize() in /Users/Marin/Rider/SharpVisUI/SharpVisUI/App.xaml.cs:line 13
   at Avalonia.Controls.AppBuilderBase`1.Setup()
   at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime)
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
   at SharpVisUI.Program.Main(String[] args) in /Users/Marin/Rider/SharpVisUI/SharpVisUI/Program.cs:line 14

I know the demo in this repo is working, but I haven't the slightest clue of what I'm missing to make it work.

With further investigation, I noticed that the nuget version uses a constructor for Pen that doesn't exist anymore:

private static Pen CreateFrozenPen(IBrush brush)
    {
      return new Pen(brush, 1.0, (DashStyle) null, PenLineCap.Flat, PenLineCap.Flat, PenLineCap.Flat, PenLineJoin.Miter, 10.0);
    }

The github code of AvaloniaEdit:

private static Pen CreateFrozenPen(IBrush brush)
        {
            var pen = new Pen(brush);
            return pen;
        }

Update Avalonia to 0.8?

I updated Avalonia to 0.8 and now an app is crashing with the following exception :(

System.MissingMethodException: Method not found: 'Avalonia.Size Avalonia.Media.FormattedText.Measure()'.
  at at AvaloniaEdit.Text.TextLineRun.CreateRunForText(StringRange stringRange, TextRun textRun, Double widthLeft, Boolean emergencyWrap, Boolean breakOnTabs)

Leak in 0.10.0-preview1

There seems to be some sort of leak in AvaloniaEdit 0.10.0-preview1 with Avalonia 0.10.0-preview3 (or also with Avalonia 0.10.0-preview1).

While editing a moderately large document, the memory usage goes up very quickly at every redraw.

To reproduce, open the AvaloniaEdit demo, paste in it some text (e.g. 5 paragraphs of Lorem Ipsum from https://www.lipsum.com/) and then, using the mouse, quickly select and deselect large portions of text. On my machine, after about 10 seconds of this, the memory usage goes up from ~150MB just after starting the program, to over 500MB.

The leak does not seem to happen with AvaloniaEdit 0.9.0-preview1 and Avalonia 0.9.12.

Update auto builds

The latest nuget version is from October 15, 2019. The appveyor version is up to date but all demo artifacts are empty zip files. Sadly there is no way for developers to subscribe to appveyor builds.

There isn't too much activity on this repo. Can it be possible to auto update the nuget package on every commit? This is kind of useful when subscribed also to Avalonia releases (the current nuget package misses all the "Update avalonia" commits).

Implement word wrap

If I modify the demo app to enable word wrap, text still doesn't wrap to the next line:

    <AvalonEdit:TextEditor Name="Editor"
                           Margin="30"
                           HorizontalScrollBarVisibility="Auto"
                           VerticalScrollBarVisibility="Visible"
                           WordWrap="true"
                           TextBlock.FontSize="30" />

I also tried setting a Width on the control as well and it had no affect on word wrap. Is there something I'm missing here? This is a pretty critical feature for a text editor.

AppendText doesn't update scroll area; Select all -> Delete doesn't either

Issue

Something in the text area isn't updating properly when using AppendText (or otherwise manipulating the text). I chatted with @danwalmsley in Discord about this, but we didn't get to the bottom of it. Basically, my app uses AvaloniaEdit as a console and appends text a bunch; however, the user can never see all the text that gets added because the scrollbar breaks and it appears as though there is nothing more to see. If you highlight/select the text, though, the UI updates nicely and you can view everything as you'd expect.

avalonia-edit-bugs

The fact that this is visible with the scrollbar may just be a red herring and not the actual issue.

Repro

This uses Avalonia CI build 8974, but you should be able to repro with 0.10.0-preview1 too.

https://github.com/Deadpikle/AvaloniaEdit/tree/bug/scrollbar

  1. Start demo app
  2. Click 'Append text test' a bunch, slowly. Watch the scrollbar not update.
  3. Click in the text anywhere and select. The scroll area updates, as evidenced by the scrollbar.

or

  1. Start demo app
  2. Click 'Append text test' a bunch of times (fast or slow)
  3. Control + A -> Delete key to remove all text
  4. Scroll bar is still there and you can scroll with mouse wheel even though nothing is there

Notes

In Discord, I reported that moving TextView.SetScrollOffset's ScrollOffsetChanged call outside of its if statement fixed things. This was incorrect. It does not fix things.

Handle scrolling

Most of the scrolling code is currently commented out since Avalonia doesn't have IScrollInfo. Possibly ILogicalScrollable could be made to work here.

Most of the code is in TextView (I deleted much of the scroll code, may need to copy again from AvalonEdit).

Missing member exception

install package from nuget
and use demo, when app start has this ecxeption
MissingMethodException: Method not found: 'Avalonia.Size Avalonia.Media.FormattedText.Measure()'

AvalonEdit:TextEditor  Name="Editor"
                                    Margin="30"
                                    SyntaxHighlighting="XML"
                                    HorizontalScrollBarVisibility="Auto"
                                    VerticalScrollBarVisibility="Visible"
                                    TextBlock.FontSize="30"/>

here all my code (little demo)
https://gitlab.com/maindlab/complab2/tree/master/CompLab2/GuiNote

Overflowing editor area with text crashes application

image

System.NullReferenceException occurred
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at AvaloniaEdit.Rendering.TextView.BuildVisualLine(DocumentLine documentLine, TextRunProperties globalTextRunProperties, TextParagraphProperties paragraphProperties, VisualLineElementGenerator[] elementGeneratorsArray, IVisualLineTransformer[] lineTransformersArray, Size availableSize)
   at AvaloniaEdit.Rendering.TextView.CreateAndMeasureVisualLines(Size availableSize)
   at AvaloniaEdit.Rendering.TextView.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutManager.Measure(ILayoutable control)
   at Avalonia.Layout.LayoutManager.ExecuteMeasurePass()
   at Avalonia.Layout.LayoutManager.ExecuteLayoutPass()
   at Avalonia.Threading.JobRunner.RunJobs()
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Restofus.App.Main(String[] args)

Biding content

This is ask to help.
Try to create dependency property like this.
https://github.com/CreateLab/NeBrowser/blob/master/Controls/BindableTextEditor.cs#L29
And try to bind like this
https://github.com/CreateLab/NeBrowser/blob/master/Views/MainWindow.xaml#L199
But has an exception in runtime

MainWindow.xaml(199, 33): [XAMLIL] Unable to find suitable setter or adder for property BindingText of type NeBrowser:NeBrowser.Controls.BindableTextEditor for argument Avalonia.Markup:Avalonia.Data.Binding, available setter parameter lists are:
System.String Line 199, position 33.

I have no ideas how to fix it.

Performance Degradation on 0.10.0-preview2

After upgrading a project which uses AvaloniaEdit from 0.9.0 to 0.10.0-preview2 things are working, well, 10 times slower. Using Ubuntu 18.04 LTS KDE, the following markup is used to instantiate and draw the editor:

<avaloniaEdit:TextEditor
    FontFamily="Ubuntu Mono"
    x:Name="AvaloniaEdit"
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
    HorizontalScrollBarVisibility="Auto"
    VerticalScrollBarVisibility="Auto">
    <avaloniaEdit:TextEditor.Options>
        <avaloniaEdit:TextEditorOptions 
            ConvertTabsToSpaces="True"
            IndentationSize="4"
            ShowTabs="True" />
    </avaloniaEdit:TextEditor.Options>
</avaloniaEdit:TextEditor>

This is how it was working with 0.9.* (absolutely fast):

ezgif-7-0c2fbeea4d6e

This is how it works after the upgrade to 0.10.0-preview* (almost a slideshow):

ezgif-7-c95c19d00bb4

The following xml file represents the highlighting: https://gist.github.com/worldbeater/9f85062caddeceb8cf97719c306546e4

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.100
 Commit:    cd82f021f4

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.100/

Host (useful for support):
  Version: 3.1.0
  Commit:  157910edee

.NET Core SDKs installed:
  2.1.802 [/usr/share/dotnet/sdk]
  2.2.402 [/usr/share/dotnet/sdk]
  3.1.100 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Ping me if any further details are required.

100% cpu usage on linux

Hello, I'm experiencing 100% cpu usage when running the Demo on Linux. Also seeing the when I try to implement the editor in my application.

Using master branch @ 9c8b9fe

uname -a
Linux ben-nix 5.4.58-1-MANJARO #1 SMP PREEMPT Tue Aug 11 15:46:30 UTC 2020 x86_64 GNU/Linux

image

Selection with mouse does not work

I am using the AvaloniaEdit 0.6.0 package.

I am using Avalonia with MVVM, and my XAML is this simple:

<ae:TextEditor ShowLineNumbers="True" FontSize="14" FontFamily="Consolas" Document="{Binding SourceDocument}" SyntaxHighlighting="C#" />

When trying to select some text in the text view using the mouse, nothing happens. I cannot even place the caret using the mouse... Am I missing something? I would expect this to work out of the box.

Help - What is the best way to "add a breakpoint"?

Hello,
I would like to "add a visual breakpoint" in my file, but I don't know which classes to change. Is it possible to achieve this without changing the current code base? I want to be able to toggle a square/ball in the margins.
I saw a code that would do something similar in the past, but I can't find it again.

Hints?

Thanks!

Rendering problems on avalonia 0.6.1

AvalonEdit cannot render anything on 0.6.1 ver.

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="IO" Height="300" xmlns:ae="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
  Width="400">
      <ae:TextEditor Background="Red" TextBlock.FontSize="12"/>
</Window>

image

Fix copy/paste shortcuts on mac using ctrl instead of cmd

The keyboard shortcuts on mac appear to be using the ctrl key instead of the more common cmd. While the windows ones still work on the mac, it does cause a bit of confusion since the Avalonia controls use cmd and the AvaloniaEdit control uses ctrl.

I asked about this in the chat:

Nikita Tsukanov@kekekeks Apr 09 22:55
Hotkeys are probably still set to Ctrl+C instead of Cmd+C
AvaloniaEdit needs to use hotkey info from AvaloniaLocator.Current.GetService<PlatformHotkeyConfiguration>();

TextEditor throws an exception on startup

On startup I get the following exception:

MissingMethodException: Method not found: 'Void Avalonia.Media.Pen..ctor(Avalonia.Media.IBrush, Double, Avalonia.Media.DashStyle, Avalonia.Media.PenLineCap, Avalonia.Media.PenLineCap, Avalonia.Media.PenLineCap, Avalonia.Media.PenLineJoin, Double)'.

My xaml only contains <AvaloniaEdit:TextEditor/>. I'm running Avalonia 0.9.12. Any suggestions?

Fix copy/paste shortcuts on mac using ctrl instead of cmd (part 2)

The keyboard shortcuts on mac appear to be using the ctrl key instead of the more common cmd. While the windows ones still work on the mac, it does cause a lot of confusion since the Avalonia controls use cmd and the AvaloniaEdit control uses ctrl, so users are never sure which one to use.

There was a previous ticket about this that got closed. And it looks like a fix was attempted for this, but a lot of the changes got reverted since it possibly broke the shortcuts for Windows.

Original Fix: 3564740

Commited Fix: d578a90#diff-35eccecfbec07325f9b15cae129fce3f

Original Issue (I don't have permission to reopen it):
#78

CompletionWindow always uses the first item

Hide() call here https://github.com/AvaloniaUI/AvaloniaEdit/blob/master/src/AvaloniaEdit/CodeCompletion/CompletionWindow.cs#L124 causes DataContext change (?) which in turn triggers selected item reset.

Here is the stack trace

 	Editor.Avalonia.exe!Editor.Avalonia.MainWindow.CompletionList_SelectionChanged(object sender, Avalonia.Controls.SelectionChangedEventArgs e) (IL=0x0049, Native=0x0B471C68+0xD6)
 	[Native to Managed Transition]
 	mscorlib.dll!System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(object obj, object[] parameters, object[] arguments) (IL=~0x001E, Native=0x7931FD38+0xA3)
 	mscorlib.dll!System.Reflection.RuntimeMethodInfo.UnsafeInvoke(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture) (IL=~0x000E, Native=0x791E817C+0x5A)
 	mscorlib.dll!System.Delegate.DynamicInvokeImpl(object[] args) (IL=~0x001E, Native=0x791E9310+0xCF)
 	mscorlib.dll!System.Delegate.DynamicInvoke(object[] args) (IL=~0x0000, Native=0x79A466FC+0x2F)
 	Avalonia.Interactivity.dll!Avalonia.Interactivity.Interactive.RaiseEventImpl(Avalonia.Interactivity.RoutedEventArgs e) (IL=~0x0073, Native=0x075E7470+0x1D6)
 	Avalonia.Interactivity.dll!Avalonia.Interactivity.Interactive.BubbleEvent(Avalonia.Interactivity.RoutedEventArgs e) (IL=0x002F, Native=0x075E70C8+0xBB)
 	Avalonia.Interactivity.dll!Avalonia.Interactivity.Interactive.RaiseEvent(Avalonia.Interactivity.RoutedEventArgs e) (IL=0x007A, Native=0x075E6E68+0x158)
 	Avalonia.Controls.dll!Avalonia.Controls.Primitives.SelectingItemsControl.SelectedItemsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) (IL=0x02D5, Native=0x090DB520+0x924)
 	Avalonia.Base.dll!Avalonia.Collections.AvaloniaList<object>.NotifyReset(System.Collections.IList t) (IL=0x002E, Native=0x0B471F10+0xB4)
 	Avalonia.Base.dll!Avalonia.Collections.AvaloniaList<object>.Clear() (IL=0x0022, Native=0x051B08D8+0x9E)
 	Avalonia.Base.dll!Avalonia.Collections.AvaloniaList<object>.System.Collections.IList.Clear() (IL=0x0006, Native=0x0B39F188+0x1D)
 	Avalonia.Controls.dll!Avalonia.Controls.Primitives.SelectingItemsControl.set_SelectedItem(object value) (IL=0x0082, Native=0x0B39EDF8+0x14A)
 	Avalonia.Controls.dll!Avalonia.Controls.Primitives.SelectingItemsControl.set_SelectedIndex(int value) (IL=0x008B, Native=0x090DBF78+0x1C5)
 	Avalonia.Controls.dll!Avalonia.Controls.Primitives.SelectingItemsControl.UpdateFinished() (IL=0x0019, Native=0x090DC8D8+0x35)
 	Avalonia.Controls.dll!Avalonia.Controls.Primitives.SelectingItemsControl.OnDataContextChanged() (IL=0x001F, Native=0x090DC870+0x4C)
 	Avalonia.Controls.dll!Avalonia.Controls.Control.DataContextNotifying(Avalonia.IAvaloniaObject o, bool notifying) (IL=0x001A, Native=0x0932B220+0x57)
 	Avalonia.Base.dll!Avalonia.AvaloniaObject.RaisePropertyChanged(Avalonia.AvaloniaProperty property, object oldValue, object newValue, Avalonia.Data.BindingPriority priority) (IL=0x0089, Native=0x073AA548+0x187)
 	Avalonia.Base.dll!Avalonia.AvaloniaObject.ParentPropertyChanged(object sender, Avalonia.AvaloniaPropertyChangedEventArgs e) (IL=0x003D, Native=0x0755D790+0xC9)
 	Avalonia.Base.dll!Avalonia.AvaloniaObject.RaisePropertyChanged(Avalonia.AvaloniaProperty property, object oldValue, object newValue, Avalonia.Data.BindingPriority priority) (IL=0x0053, Native=0x073AA548+0xF5)
 	Avalonia.Base.dll!Avalonia.AvaloniaObject.ParentPropertyChanged(object sender, Avalonia.AvaloniaPropertyChangedEventArgs e) (IL=0x003D, Native=0x0755D790+0xC9)
 	Avalonia.Base.dll!Avalonia.AvaloniaObject.RaisePropertyChanged(Avalonia.AvaloniaProperty property, object oldValue, object newValue, Avalonia.Data.BindingPriority priority) (IL=0x0053, Native=0x073AA548+0xF5)
 	Avalonia.Base.dll!Avalonia.AvaloniaObject.ParentPropertyChanged(object sender, Avalonia.AvaloniaPropertyChangedEventArgs e) (IL=0x003D, Native=0x0755D790+0xC9)
 	Avalonia.Base.dll!Avalonia.AvaloniaObject.RaisePropertyChanged(Avalonia.AvaloniaProperty property, object oldValue, object newValue, Avalonia.Data.BindingPriority priority) (IL=0x0053, Native=0x073AA548+0xF5)
 	Avalonia.Base.dll!Avalonia.AvaloniaObject.set_InheritanceParent(Avalonia.IAvaloniaObject value) (IL=0x00B6, Native=0x0755CDE8+0x247)
 	Avalonia.Controls.dll!Avalonia.Controls.Control.Avalonia.Controls.ISetLogicalParent.SetParent(Avalonia.LogicalTree.ILogical parent) (IL=0x005F, Native=0x0755CB58+0x14C)
 	AvaloniaEdit.dll!AvaloniaEdit.CodeCompletion.CompletionWindowBase.DetachEvents() (IL=0x0007, Native=0x0B472A18+0x34)
 	AvaloniaEdit.dll!AvaloniaEdit.CodeCompletion.CompletionWindow.DetachEvents() (IL=0x007E, Native=0x0B472488+0x152)
 	AvaloniaEdit.dll!AvaloniaEdit.CodeCompletion.CompletionWindowBase.OnClosed() (IL=0x0006, Native=0x0B472450+0x23)
 	AvaloniaEdit.dll!AvaloniaEdit.CodeCompletion.CompletionWindow.OnClosed() (IL=0x0006, Native=0x0B4723E8+0x1E)
 	Editor.Avalonia.exe!Editor.Avalonia.MainWindow.CustomCompletionWindow.OnClosed() (IL=0x0007, Native=0x0B472380+0x29)
 	AvaloniaEdit.dll!AvaloniaEdit.CodeCompletion.CompletionWindowBase.Hide() (IL=0x001F, Native=0x0B4721F8+0x7E)
>	AvaloniaEdit.dll!AvaloniaEdit.CodeCompletion.CompletionWindow.CompletionList_InsertionRequested(object sender, System.EventArgs e) (IL=0x0006, Native=0x0B472100+0x35)
 	AvaloniaEdit.dll!AvaloniaEdit.CodeCompletion.CompletionList.RequestInsertion(System.EventArgs e) (IL=0x0012, Native=0x0B472098+0x50)
 	AvaloniaEdit.dll!AvaloniaEdit.CodeCompletion.CompletionList.HandleKey(Avalonia.Input.KeyEventArgs e) (IL=0x011E, Native=0x0B39E9F8+0x23B)
 	AvaloniaEdit.dll!AvaloniaEdit.CodeCompletion.CompletionWindow.OnKeyDown(Avalonia.Input.KeyEventArgs e) (IL=0x001B, Native=0x0B39E910+0x57)
 	Avalonia.Interactivity.dll!Avalonia.Interactivity.RoutedEvent.<>c__DisplayClass1_0`1<Avalonia.Input.KeyEventArgs, Avalonia.Input.InputElement>.<AddClassHandler>b__0(object sender, Avalonia.Interactivity.RoutedEventArgs e) (IL=0x003A, Native=0x09378DC8+0x11E)

Exception in the designer when I have AvalonEdit control

The following error can be avoid by setting IsVisible to false. (I set it to true in .cs).
Or be setting MaxWidth.

Designer process crashed
System.InvalidOperationException: Invalid size returned for Measure.
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Controls.Presenters.ScrollContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Decorator.MeasureOverride(Size availableSize)
   at Avalonia.Controls.Primitives.AdornerDecorator.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Controls.Window.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutManager.Measure(ILayoutable control)
   at Avalonia.Layout.LayoutManager.ExecuteInitialLayoutPass(ILayoutRoot root)
   at Avalonia.Controls.Window.Show()
   at Avalonia.DesignerSupport.DesignWindowLoader.LoadDesignerWindow(String xaml, String assemblyPath)
   at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.<>c__DisplayClass17_0.<OnTransportMessage>b__0()

Unhandled Exception: System.InvalidOperationException: Invalid size returned for Measure.
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Controls.Presenters.ScrollContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Decorator.MeasureOverride(Size availableSize)
   at Avalonia.Controls.Primitives.AdornerDecorator.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Border.MeasureOverrideImpl(Size availableSize, IControl child, Thickness padding, Double borderThickness)
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Controls.Window.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutManager.Measure(ILayoutable control)
   at Avalonia.Layout.LayoutManager.ExecuteMeasurePass()
   at Avalonia.Layout.LayoutManager.ExecuteLayoutPass()
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority)
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(String[] cmdline)
   at Avalonia.Designer.HostApp.Program.Main(String[] args)
<Window 
  xmlns="https://github.com/avaloniaui" 
  xmlns:AvalonEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit" 
  xmlns:local="clr-namespace:CouscousManager;assembly=CouscousManager" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" MinWidth="500" MinHeight="300" Title="Couscous Manager" Background="white">
    <Grid>
        <Grid Margin="3,3,3,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="2*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="2*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <Grid Grid.ColumnSpan="6" Margin="0,0,5,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <TextBox Name="TbKeyFilter" Text="" Margin="5,2" ToolTip.Tip="It's a regex filter" BorderThickness="0"/>
                <Rectangle Grid.Column="0" Margin="5,2" Fill="gray" Height="1" VerticalAlignment="Bottom"/>

                <Button Name="TbHelp" Grid.Column="1" FontFamily="Segoe UI Symbol" BorderThickness="0" Background="Transparent">
                    <Border Background="#FFEC5A5A" Padding="0" Margin="0" Height="25" Width="25" CornerRadius="25">
                        <TextBlock FontFamily="Segoe UI Symbol" Foreground="White" Text="&#xE11B;" FontSize="10" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    </Border>
                </Button>
            </Grid>
            <Border  Margin="5,5,5,5" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="4" CornerRadius="5" Padding="0" Background="white" BorderThickness="2" BorderBrush="#cacaca">
              <Grid Margin="5">
                <Grid.RowDefinitions>
                  <RowDefinition Height="auto"/>
                  <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition/>
                  <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <TextBox Grid.Row="0" Text="{Binding SelectedItem, ElementName=KeyListView}" IsReadOnly="True" Margin="0,0,10,2" ToolTip.Tip="Selected key" BorderThickness="0"/>
                <Rectangle Grid.Row="0" Margin="0,0,10,2" Fill="gray" Height="1" VerticalAlignment="Bottom"/>

                <Border Margin="0,0,0,2" Grid.Column="1" CornerRadius="3" Background="#FFA30A0A" Padding="3" ToolTip.Tip="Ctrl+S">
                  <Button Name="SaveBtn" Content="Save" Background="#FFA30A0A" Foreground="White" BorderBrush="#FFA30A0A"  BorderThickness="0" />
                </Border>
                <!-- IsEnabled="{Binding SelectedItem, Converter={DynamicResource ObjectToBooleanConverter}, ElementName=KeyListView}" -->
                <!--
                <TextBox
                -->
                <AvalonEdit:TextEditor Name="DocumentTextEditor" Grid.Row="1" Grid.ColumnSpan="2" IsReadOnly="False" Margin="0,2,0,0" Background="White" ShowLineNumbers="True" IsVisible="True" />
                <!-- ShowLineNumbers="True" IsEnabled="{Binding SelectedItem, Converter={StaticResource ObjectToBooleanConverter}, ElementName=KeyListView}"
                -->
              </Grid>
            </Border>
            <Grid Grid.Row="1" Grid.Column="0" Margin="5,5,2,5" VerticalAlignment="Stretch"  Grid.ColumnSpan="2">
              <Border CornerRadius="5" Padding="0" Background="white" BorderThickness="2" BorderBrush="#cacaca">
                <ListBox Name="KeyListView" SelectionMode="Multiple" AutoScrollToSelectedItem="True" BorderThickness="0" />
              </Border>
            </Grid>

            <CheckBox Grid.Row="2" Grid.Column="0" Name="CbAdminMode" Margin="5,0,5,2" ToolTip.Tip="Use admin access mode" />

            <TextBox Grid.Row="2" Grid.Column="1" Name="TbUrl" Text="http://localhost:8091" Margin="5,0,5,5" ToolTip.Tip="Url" BorderThickness="0" VerticalAlignment="Bottom"/>
            <Rectangle Grid.Row="2" Grid.Column="1" Fill="gray" Height="1" VerticalAlignment="Bottom" Margin="5,0,5,5" MinWidth="20"/>


            <TextBox Grid.Row="2" Grid.Column="2" Name="TbBucket" Text="beer-sample" ToolTip.Tip="Bucket" Margin="5,0,5,5" BorderThickness="0" VerticalAlignment="Bottom"/>
            <Rectangle Grid.Row="2" Grid.Column="2" Fill="gray" Height="1" VerticalAlignment="Bottom" Margin="5,0,5,5"/>
            <DropDown Grid.Row="2" Grid.Column="2" x:Name="DDBucket" Margin="5,0,5,5" ToolTip.Tip="Bucket" MinWidth="20" BorderThickness="0" VerticalAlignment="Bottom"/>

            <TextBox Grid.Row="2" Grid.Column="3" x:Name="TbLogin" Text="Administrator" Margin="5,0,5,5" ToolTip.Tip="Admin login" MinWidth="30"  BorderThickness="0" VerticalAlignment="Bottom"/>
            <Rectangle Grid.Row="2" Grid.Column="3" x:Name="TbLoginRect" Fill="gray" Height="1" VerticalAlignment="Bottom" Margin="5,0,5,5" MinWidth="30"/>

            <TextBox Grid.Row="2" Grid.Column="4" Name="TbPassword" Text="" Margin="5,0,5,5" ToolTip.Tip="Password" BorderThickness="0" VerticalAlignment="Bottom"/>
            <Rectangle Grid.Row="2" Grid.Column="4" Fill="gray" Height="1" Margin="5,0,5,5" VerticalAlignment="Bottom"/>
          
            <Border Margin="5,0,5,5" Grid.Row="2" Grid.Column="5" CornerRadius="3" Background="#FFA30A0A" Padding="3">
              <Button Name="BtnConnect" Content="Connect" Background="#FFA30A0A" Foreground="White" BorderBrush="#FFA30A0A" BorderThickness="0" />
            </Border>
        </Grid>
        <Grid Name="Spinner" IsVisible="False" Margin="-5" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="6" Grid.RowSpan="3">
            <Rectangle Fill="#B2000000" />
            <ProgressBar Height="20" Width="100" Minimum="0" Maximum="100" Value="50" IsIndeterminate="True" />
        </Grid>
    </Grid>
</Window>

Update Avalonia

Hi and thanks for all the hard work on this project!
It seems that this codebase is using Avalonia 0.9.0-preview1 ( https://github.com/AvaloniaUI/AvaloniaEdit/blob/master/build.cake#L158 )
This is missing several bugfixes in later versions of Avalonia. Notably a fix in 0.9.2 which causes a hard crash at startup for ILSpy on NixOS .
I'm not familiar with this codebase or even Avalonia, is this as easy as changing that version in the Cake file? Would the tests catch any breaking changes (hopefully there are none)?

BraceFoldingStrategy doesn't work like AvalonEdit

I try to use BraceFoldingStrategy.cs in my projet but the result is not usable as on AvalonEdit.

public static void AddBraceFolding(this TextEditor textEditor)
{
    var foldingManager = AvaloniaEdit.Folding.FoldingManager.Install(textEditor.TextArea);
    var foldingStrategy = new SharpDevelop.BraceFoldingStrategy();
    textEditor.TextChanged += (s, e) => foldingStrategy.UpdateFoldings(foldingManager, ((TextEditor)s).Document);
}

// And juste call it in InitializeComponent like 'myDocumentTextEditor.AddBraceFolding();'

AvaloniaEdit (windows+avalonia beta 2 + avaloniaedit 0.6.0)
image

AvalonEdit WPF
image

Scroll not synchronized

Scrolling from the editor syncs with the scroll bar, but not the other way around.

There's also an issue when hitting Enter to add a new line (scroll gets out of sync with text).

scroll

Could not load file or assembly 'Avalonia.Skia.Desktop

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Avalonia.Skia.Desktop, Version=0.5.1.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Avalonia.AppBuilder.UsePlatformDetect()
at AvaloniaEdit.Demo.Program.Main(String[] args) in Avalon\AvaloniaEdit-master\src\AvaloniaEdit.Demo\Program.cs:line 14

Is there a way to underline text like in AvalonEdit?

Is there a way to underline text like in AvalonEdit?

...TextRunProperties.SetTextDecorations(TextDecorations.Underline);

I see that TextDecorations.Underline exists, but I am not sure how to use it.
For context: I am writing a custom colorizer by implementing DocumentColorizingTransformer.
Thank you!

Cursor position for last line displays below last line when content requires scrolling

If the scrollbar is active due to the content being larger than the text area, the text cursor shows an extra 30 pixels below where it should. This only happens when editing the last line too. Editing any other line works correctly.

Here's what the AvaloniaEdit.Demo shows
image

The problem is even worse for regular sized fonts too (size 16 here). Even editing the 2nd to last item has problems at this size. Note the sidebar doesn't even line up anymore.
image

Poor performance with large files

If you open a file with a large number of lines performance is very slow.

  1. It builds the visual lines for the entire document twice.
  2. navigating up and down also seems to run a loop over all the lines in the document, needs to be limited to just those being displayed.

Can demo and repro when your back @aelij

Strange offset between text that has formatting applied and plain text

If I run a line transformer colorizing my text afterwards everything is slightly offset, and also selection and results from BackgroundGeometryBuilder.GetRectsForSegment are slightly out.

image
Above image demonstrates issue!

the text xxxx has no colorizing applied, and background renderer positions match,

the selection and warning line are offset to text that has had text colorized.

Control rendering glitch

Hello.

If I move applications window which contains AvaloniaEdit control to my second monitor with different resolution, control starts to expand (every second rendered control is start to get larger and larger, like if you use windows magnifier). You can reproduce it by using AvaloniaEdit.Demo application, or sample from attachments (it is the same demo actually).
At start:
At start it was
When I move it to another monitor:
But then
AvaloniaApplication2.zip

Checking Scrolled to End with WordWrap=true

I'm customizing the scroll function which can support as follow:

  1. If I scroll to the end, the function ScrollToEnd() will be executed repeatedly.
  2. If I scroll up (not at End position), the ScrollToEnd() will not be executed.

The following is what I added into TextEditor.cs:
AddHandler(ScrollViewer.ScrollChangedEvent, new ScrollChangedEventHandler(ScrollChanged));

private void ScrollChanged(object sender, ScrollChangedEventArgs e)
{
	TextView textView = TextArea.TextView;

       double lineHeight = textView.DefaultLineHeight + 1;

	bool isAtEnd = textView.VerticalOffset + textView.ActualHeight + lineHeight >= textView.DocumentHeight;
	if( isAtEnd )
	{
		ScrollToEnd();
	}
}

I got a problem with WordWrap=true. Are there any solutions I can address this problem?

Thanks.

Update Avalonia to 0.9.x

I know 0.9.x is not yet released but the changes seem to be more significant than the ones that could be fixed with the "find and replace version" approach. So I'll open this issue in advance.

Rendering problems on avalonia 0.8.0 / 0.8.1

Avalonia.AvaloniaEdit 0.8.0
Avalonia 0.8.0 / 0.8.1
Avalonia.Desktop 0.8.0 / 0.8.1

on .NetCoreApp 2.2 / .Net Framework 4.6.1
test environment: Windows 10 1903 and macOS 10.15

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:AvalonEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="Test.MainWindow"
        Title="MainWindow">
    <AvalonEdit:TextEditor
        Name="ScriptBox"
        Margin="10" Grid.RowSpan="2"
        ShowLineNumbers="True"
        HorizontalScrollBarVisibility="Auto"
        VerticalScrollBarVisibility="Visible"/>
</window>

Nothing shown on the window

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.