Comments (4)
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.
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]:
Reply to this email directly or view it on GitHubhttps://github.com//issues/18
.
from richtextfx.
"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.
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)
- Cannot copy long text to clipboard HOT 3
- Q: Any missing APIs in JavaFX which are needed for this project? HOT 13
- wrapTextProperty() is temporarily ignored when inserting characters on a long line HOT 3
- Support entirely RTL documents HOT 22
- Execution failed for task ':richtextfx-demos:configJavafxRun'. HOT 2
- Update the Copyright Year in LICENSE file HOT 1
- 关于图文编辑jvm崩溃的问题 HOT 5
- Is this project even usable with a modern JDK and modular JavaFX? HOT 3
- Question: setStyle() is not reflected in paragraph.styledSegments until there is more than 1 paragraph. HOT 1
- Q: does styling without providing the index range work? HOT 2
- Any efficient way to setStyle for multiple positions? HOT 2
- Question regarding nodeFactory - custom Node implementation instead of TextExt HOT 5
- How to avoid setStyleSpans being an action for undo? HOT 2
- choose ColorPicker update codearea text color HOT 1
- \r and \r\n HOT 1
- codeArea.getVisibleParagraphs() find lost some line HOT 1
- Question: When I call the codeArea.replaceText() method, the styling is scrambled
- RichTextDemo Fonts Don't Display Correctly HOT 2
- how can I optimize the highlight performance HOT 1
- Getting No toolkit found in intellij HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from richtextfx.