Git Product home page Git Product logo

Comments (9)

oscbyspro avatar oscbyspro commented on June 2, 2024

Pattern where capacity == 0 (aka the useless pattern)

The hidden() method should hide all characters, rather than hiding none. It behaves like this because the reduction function looks for the first placeholder characters, does not find one, then stops at the end index (meaning that the effect is the same as the first placeholder being the end index, which is false). Solving this should also remove the need for special case selection on 100% formatting.


A solution has been introduced in 2be0c99

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

Apparently, I forgot to override Snapshot/distance(from:to:) so it’s still O(n).


Added in: d7dd5b5. If you look at Collection and BidirectionalCollection, you will find that a custom implementation of distance(from:to:) is enough to override both count and underestimatedCount, and that the isEmpty default is OK.

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

Lazy views improve readability

It’s easier to reason about the complexity of code when laziness is explicit. So I think it would be better if snapshot.nonvirtuals were instead snapshot.lazy.nonvirtuals(). With two extensions, you could write:

snapshot.nonvirtuals()
snapshot.lazy.nonvirtuals()

A follow up to this (and an actual improvement) would be adding a Proposal.Lazy:

proposal.merged().nonvirtuals()
proposal.lazy.merged().nonvirtuals() // this option does not yet exist

Added in: e4708c9. It removes an O(n) operation in both NumberTextStyle/resolve(_:) and PatternTextStyle/resolve(_:) because neither of them needed to actually merge the proposal for any other reason than to access Snapshot/nonvirtuals.

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

I think that PatternTextStyle/resolve can use the same reduce function as format and interpret. At least it looked like it before Xcode 14.0 beta 5 decided to piviot its career to that of a pyromaniac. Anyways, it would be more performant and less code to maintain.


PatternTextStyle/resolve(_:with:) now uses the reduce method directly, ba6f11c.

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

Fixed a bug in 5940f6b where localizable styles marked as equals(()) would not be localized on setup (input shadowed output). It’s not that note worthy, because the bug had not been introduced outside of beta.

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

Removed Lock in cfa97c6 because it was made obsolete by #161

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

Cleaned up debug messages in ac76804 as:

 [DiffableTextViews] [context]: [message]

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

Fixed #161 suggestion + autocorrection + reentrance selection flash in cb8eb65.

from diffabletextviews.

oscbyspro avatar oscbyspro commented on June 2, 2024

PatternTextStyle: made state public.
PatternTextStyle: added initializer parameters.
PatternTextPlaceholders: made ExpressibleByDictionaryLiteral.

c48c0b0, 657122b

from diffabletextviews.

Related Issues (20)

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.