Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paragraph.getSegments() duplicates. #65

Closed
ghost opened this issue Jul 4, 2014 · 2 comments
Closed

paragraph.getSegments() duplicates. #65

ghost opened this issue Jul 4, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 4, 2014

Hi Tomas, I think I may have found a bug.

I type in a text area, something: "TESTING".

Then I get list of paragraphs, in this case its only one paragraph.,

segmentList = textArea.getDocument().getParagraphs().get(0).getSegments();
then I iterate over segments from this one paragraph

for (StyledText segment : segmentList) {
        System.out.println("Start at " + styleStart + " and ending at: " + segment.length() + "for segment: " + segment.toString() + " with style" + segment.getStyle());
    }

I get 4 print statements..

Start at 0 and ending at: 7for segment: TESTING with style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
Start at 0 and ending at: 7for segment: TESTING with style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
Start at 0 and ending at: 7for segment: TESTING with style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
Start at 0 and ending at: 7for segment: TESTING with style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
@TomasMikula
Copy link
Member

Hi Maher, are you able to post the full code? Are you sure your whole
for-loop is not executed multiple times? You can try adding a print
statement before and after the for loop to determine this.
On Jul 4, 2014 2:39 AM, "melkhaldi" notifications@github.com wrote:

Hi Tomas, I think I may have found a bug.

I type in a text area, something: "TESTING".

Then I get list of paragraphs, in this case its only one paragraph.,

segmentList = textArea.getDocument().getParagraphs().get(0).getSegments();
then I iterate over segments from this one paragraph

for (StyledText segment : segmentList) {
System.out.println("Start at " + styleStart + " and ending at: " + segment.length() + "for segment: " + segment.toString() + " with style" + segment.getStyle());
}

I get 4 print statements..

Start at 0 and ending at: 7for segment: TESTING with style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
Start at 0 and ending at: 7for segment: TESTING with style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
Start at 0 and ending at: 7for segment: TESTING with style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
Start at 0 and ending at: 7for segment: TESTING with style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;


Reply to this email directly or view it on GitHub
#65.

@ghost
Copy link
Author

ghost commented Jul 5, 2014

Yes, that was it. I am really sorry for the false alarm :/
seems like the methods, of which the loop is a part, get called multiple
times (I got to fix that).

On 05/07/2014 1:19 PM, TomasMikula wrote:

Hi Maher, are you able to post the full code? Are you sure your whole
for-loop is not executed multiple times? You can try adding a print
statement before and after the for loop to determine this.
On Jul 4, 2014 2:39 AM, "melkhaldi" notifications@github.com wrote:

Hi Tomas, I think I may have found a bug.

I type in a text area, something: "TESTING".

Then I get list of paragraphs, in this case its only one paragraph.,

segmentList =
textArea.getDocument().getParagraphs().get(0).getSegments();
then I iterate over segments from this one paragraph

for (StyledText segment : segmentList) {
System.out.println("Start at " + styleStart + " and ending at: " +
segment.length() + "for segment: " + segment.toString() + " with
style" + segment.getStyle());
}

I get 4 print statements..

Start at 0 and ending at: 7for segment: TESTING with
style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
Start at 0 and ending at: 7for segment: TESTING with
style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
Start at 0 and ending at: 7for segment: TESTING with
style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;
Start at 0 and ending at: 7for segment: TESTING with
style-fx-font-family:Arial;-fx-font-size:16;-fx-font-weight:normal;-fx-fill:rgb(0,0,0);-fx-font-style:normal;-fx-underline:false;


Reply to this email directly or view it on GitHub
#65.


Reply to this email directly or view it on GitHub
#65 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant