Git Product home page Git Product logo

Comments (4)

TomasMikula avatar TomasMikula commented on May 18, 2024

IndexRange is just an encapsupation of two integer values. It does not have any live connection to the text area. Once you have an instance of IndexRange, its start and end indices never change. Does that answer your question? Maybe provide a code sample.

from richtextfx.

 avatar commented on May 18, 2024

Hi Tomas, yes it answers. The use case I am trying to solve is this:

-User writes a string, for example: "John is a student in the school"

-User applies color (Red) to a word, for example: "student".

-User (or code) replaces the work "student" with a "Researcher".

Since "Researcher" is a longer word, I am trying to make sure that the Red
style gets ported to "Researcher". I also want to make sure that the
string "in the school" does not get overwritten, I just want it to be
pushed.

So I am trying to design a TextRange class, which can handle these changes.
If you have any tips on what direction to take please let me know.
Thanks :)
maher

On Mon, Mar 3, 2014 at 8:12 AM, TomasMikula [email protected]:

Closed #18 #18.

Reply to this email directly or view it on GitHubhttps://github.com//issues/18
.

from richtextfx.

TomasMikula avatar TomasMikula commented on May 18, 2024

"in the school" does not get overwritten, no worries about that.

When you insert plain text, the style of the character immediately preceding the insertion position is used for the inserted text. In your example, the word "researcher" will have the same style as the white space before it.

I think this behavior makes sense when you are just inserting text without replacing anything. When replacing text, it would maybe make more sense to use the style of the first or last character of the replaced text, what do you think? What do rich-text editors do in this case?

For more control, there could be a settable property on code area that would override the style of inserted text. When set to null, the default behavior described above would be used.

from richtextfx.

 avatar commented on May 18, 2024

Thanks this is really helpful information.

From my understanding (just tried it on WordPad), the newly entered text
will inherit the style of the character preceding it. This makes sense.

I'l give this a shot as soon as I am done with the initial plumbing of the
code!

On Mon, Mar 3, 2014 at 9:28 AM, TomasMikula [email protected]:

"in the school" does not get overwritten, no worries about that.

When you insert plain text, the style of the character immediately
preceding the insertion position is used for the inserted text. In your
example, the word "researcher" will have the same style as the white space
before it.

I think this behavior makes sense when you are just inserting text without
replacing anything. When replacing text, it would maybe make more sense to
use the style of the first or last character of the replaced text, what do
you think? What do rich-text editors do in this case?

For more control, there could be a settable property on code area that
would override the style of inserted text. When set to null, the default
behavior described above would be used.

Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-36534649
.

from richtextfx.

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.