Giter VIP home page Giter VIP logo

undofx's People

Contributors

delvh avatar jordanmartinez avatar jugen avatar tomasmikula 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

undofx's Issues

mark(); isAtMarkedPosition(); issue

Hello,

I am experimenting with mark(); and isAtMarkedPosition();

I type in some text let's say word "hello" and set the mark(); position at that point.
When I type an extra character (it takes me to a different step) and do control+z to undo, the isAtMarkedPosition() returns false (it should be returning true). Also, when I type in a character and remove that character, then it also isAtMarkedPosition() returns false. The only time when isAtMarkedPosition(); returns false is when you type in "hello", mark();, and then do undo (control + z) and then do redo (control+shift+z). In all other cases, it returns false.

Document that an undone action should be passed back into the undo queue

Problem

I just started using UndoFX, and I consistently got an IllegalStateException without knowing why.
Through much debugging and by looking at #7, I finally figured out that the parameter of the apply function is supposed to be reinserted into the event stream inside the apply function. This is however nowhere documented.

Responsible Code (UndoManagerImpl)

            C change = changeToApply.get();
            this.expectedChange = change;
            performingAction.suspendWhile(() -> apply.accept(change));
            if(this.expectedChange != null) {
                throw new IllegalStateException("Expected change not received:\n"
                        + this.expectedChange);
            }

Possible remediation actions

Many minor things can be added to improve this situation:

  • a normal comment above the line performingAction.suspendWhile(() -> apply.accept(change));
  • Javadoc for the private method
  • a Javadoc entry to undo (I think it is not needed for redo)
  • a paragraph in the README, at best in the section for the apply function

any or all of which detailing that the change is expected to be reinserted in the event stream during the undo action.

Maven Central checksum error

When fetching org.fxmisc.undo/undofx from Maven central, I get the following checksum error:

Could not find metadata org.fxmisc.undo:undofx/maven-metadata.xml in local (/Users/mtnygard/.m2/repository)
Could not transfer metadata org.fxmisc.undo:undofx/maven-metadata.xml from/to central (https://repo1.maven.org/maven2/): Checksum validation failed, expected 5aa23ca89ce7f15b4e877d85d2dca9b554f44b18 but is 8805fc8f574b9614ac518a4c71bc17ae08a64007

We are reaching this dependency via RichTextFX version 0.6.4

Compile fails in Scala 2.11.7 project

I'm using Scala 2.11.7 with UndoFX in my project, and when I try to compile, the compile fails with assertion failed: TVar<?0=null>.

This only happens with UndoFX 1.2, and it was fine before on UndoFX 1.1.1, and the only changes I've made are to comply with 1.2's new interface. I've even changed from using SAM conversion to instantiate the undo manager to anonymous classes, and the failure still takes place. Even a stacktrace simply spits out internal Scala compiler errors, so I can't quite debug what's causing the error.

My build tool is Gradle 2.7, if it means anything.

I've also tried this on a fresh Gradle Scala project, and the same error results.

This is the sample code for the fresh project that fails to compile:

import java.util.function.{Consumer, Function}

import org.fxmisc.undo.UndoManagerFactory
import org.reactfx.EventSource

object Main {
  val changes = new EventSource[Change]

  val undoManager = UndoManagerFactory.unlimitedHistoryUndoManager(
  changes,
  new Function[Change, Change] {
    override def apply(t: Change): Change = t.invert
  },
  new Consumer[Change] {
    override def accept(t: Change): Unit = t.apply()
  }
  )

}

case class Change(oldVal: Boolean, newVal: Boolean) {
  def invert: Change = Change(newVal, oldVal)

  def apply(): Unit = println(newVal)
}

Add Feature: UndoManager can ignore a change if it is an identity / empty (data) change

Coming from FXMisc/RichTextFX#486 (more specifically, Tomas comment on how to solve an issue):

Another option is to give the UndoManager a way to know whether merge resulted in an empty change. This could be done for example by adding an extra parameter Predicate<C> isEmpty to the factory method create above. Undo manager would then test changes for emptiness and automatically discard empty changes without trying to apply them.

[Question] Unexpected change received?

This is probably me not understanding the changes in 1.2, but when I undo an action, then redo it, and then try to take a new action, the undo manager crashes with an Unexpected change received.

Am I supposed to send redone changes to the change stream as well?

Dynamic event stream for UndoManager

I was wondering if it is possible to add and remove event streams from the stream that is being used by the UndoManager. In my use case the user is creating a flow diagram and keeps adding nodes to it. Each node has an x and a y property. I want to "monitor" these coordinates via the help of two event streams and I want to add them to the event stream of the undo manager without loosing the current history. How can I do this?

Support for inspecting the change queue.

It would be nice if changes could be named so that an undo / redo UI could display the name of the last change that will be undone or redone, e.g. "Undo 'Move Object'".

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.