DESCRIPTION

Hard wrap should insert line breaks after user finishes editing

In the old implementation, hard-wrapping interfered with the user's
typing. This fix uses a segment listener on the StyledText to give a
preview of the final wrapping, and it only inserts the additional line
delimiters when the user commits the message.

Bug: 387932
Change-Id: Ib240752de554fcb3d4baa0a551eeb903303d528e
Signed-off-by: Dashawn Dalton xxx@xxx.xxx


COMMENTS

author: Dashawn Dalton
date: 2012-10-01 16:13:54.000000000

Patch Set 1:

1. I authored 100% of this contribution 2. I have the rights to donate the content to Eclipse 3. I contribute the content under the EPL

-------------------------------------
author: Brenden Conley
date: 2012-10-01 16:17:22.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/sandbox/job/egit.gerrit/3434/ 

-------------------------------------
author: Brenden Conley
date: 2012-10-01 16:35:35.000000000

Patch Set 1: Verified

Build Successful 

https://hudson.eclipse.org/sandbox/job/egit.gerrit/3434/ : SUCCESS

-------------------------------------
author: Danika Greer
date: 2012-10-02 21:14:08.000000000

Patch Set 1: I would prefer that you didn't submit this

(5 inline comments)

Great change, a few inline comments. Also, the following (additional) test fails, I'm not sure what the expected behavior should be here. With this implementation, the spaces all disappear:

xxx@xxx.xxx
	public void dontWrapWordLongerThanOneLineAndKeepSpaceAtFront() {
		String input = "    1234567890123456789012345678901234567890123456789012345678901234567890123456789012";
		String expected = "    1234567890123456789012345678901234567890123456789012345678901234567890123456789012";
		assertWrappedEquals(expected, input);
	}

Line:353, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> Why is this necessary? So that the segment listener is applied? A comment would be good here (same below).

Line:760, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> Could you extract the whole hard wrap block into its own method? This way the SpellcheckableMessageAreaTest could still be run as a normal unit test and the getCommitMessage(String) method could be made private.

Line:764, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> Style nit: Use for (int cur : wrapOffsets)

Line:773, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> text.substring(prev)

Line:884, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> Style nit: `int i = 0` (missing space)

-------------------------------------
author: Juliet Cantu
date: 2012-10-03 22:31:16.000000000

Patch Set 1: I would prefer that you didn't submit this

The formatting should NOT change AFTER the user presses
the commit button.

-------------------------------------
author: Juliet Cantu
date: 2012-10-03 22:38:16.000000000

Patch Set 1: No score

I misresd the commit-action part. Sees good.

-------------------------------------
author: Juliet Cantu
date: 2012-10-06 20:28:28.000000000

Patch Set 1:

There's another bug too: https://bugs.eclipse.org/bugs/show_bug.cgi?id=356925 Perhaps this patch fixes it too.

Why is 387932 "fixed"?

-------------------------------------
author: Danika Greer
date: 2012-10-07 13:10:09.000000000

Patch Set 1:

Bug 387932 was marked as fixed because a partial solution was already merged with I197270a68700e7aacf12585c79418c7f8fc8a131. This change is the better solution. I reopened it now.

Yes, the other bug will also be fixed with this, marked as duplicate.

-------------------------------------
author: Dashawn Dalton
date: 2012-10-08 20:44:50.000000000

Patch Set 1: (5 inline comments)

Addressed the issues, xxx@xxx.xxx dontWrapWordLongerThanOneLineAndKeepSpaceAtFront() and made the test succeed.

Line:353, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> Yes, it's a workaround for bug 384886.

Line:760, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> Done

Line:764, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> Done

Line:773, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> Done

Line:884, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java -> Done

-------------------------------------
