Giter Site home page Giter Site logo

avaloneditsamples's People

Contributors

siegfriedpammer avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

avaloneditsamples's Issues

Compute background renderer content on demand?

Thanks for this sample its been very useful indeed. I was able to apply background coloring of a word in this project: https://github.com/Dirkster99/Aehnlich

to outline the delete and insert of characters per line which are necessary to transfer one line into the other.
The original approach from Bill Menees' WinForm app Diff.Net was to compute these insert/delete patterns on demand - whenever the user wants to view a new line since computing all lines at once would be the same as implementing an O(n^2) compared to what would otherwise be linear.

Even the on demand computation would make it O(n^2) but the user interface is more responsive that way and the work load is distributed over time as states here: at about line 137 in DiffLineViewModel.cs.

So, I've been trying to do this with AvalonEdit but am not sure if this is the right/best way to approach the issue. The current solution is to compute and cache the missing lines whenever the user scrolls the view at line 124 in Scrollviewer_ScrollChanged...

and this event is even raised when the document is loaded initially. So, it does not seem to be too bad - it invokes a command, which in turn, invokes the ViewPortChangedCommand in 207 via binding.

Overall, the code is working albeit beinig still oversimplified since the computation is on the UI thread. The current issue I am having is that the initial background coloring right after loading a new diff is only partially visible - that is I can see the first part of the first line being background colored but color items in the second or later line are only available if I scroll down and backup - probably because the first initial computation is too late or takes too long and a re-draw can only be enforced by scrolling up and down. Refer to these 2 screenshots to better understand what I mean:

The coloring after the initial load:
untitled

The coloring after scrolling down and back-up
untitled1

My question is whether you know a good on demand implementation for making sure the coloring can be computed on demand and is visible when done. Maybe you had to solve a similar problem in SharpDevelop?

I have played with the Redraw() method before as can be seen in this commit, where I removed it since I found odd corner cases where the UI appeared to be locked when trying to resize the Window with the resize handle :-(

Would you be able to tell me a more promising and stable solution towards solving this issue?

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.