Fix for TextEditorDialog in merge of 12.11.1-4 baseline

Change-Id: I5e5e39af2bd7f2bfc9dd10ab0ddf87ff80cb7b76

Former-commit-id: 6053b5fbc1 [formerly f4a2d13df1] [formerly 6053b5fbc1 [formerly f4a2d13df1] [formerly 8934186397 [formerly 1cf3c76428719ebc7f06612b8525057e9345a56e]]]
Former-commit-id: 8934186397
Former-commit-id: ab10bc88a8 [formerly 6199f7f516]
Former-commit-id: f891be22d1
This commit is contained in:
Roger Ferrel 2012-10-17 08:49:30 -05:00
parent 9dc3068ab8
commit d92ccc692c

View file

@ -1137,6 +1137,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
.getTimeZone(TimeTools.ZULU_TIMEZONE)); .getTimeZone(TimeTools.ZULU_TIMEZONE));
} }
private boolean isPreviousLineWrapped;
/** /**
* Constructor with additional cave style rules * Constructor with additional cave style rules
* *
@ -7126,7 +7128,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
wrapAtPositionOrLock(lineStartOffset + charWrapCol, padding); wrapAtPositionOrLock(lineStartOffset + charWrapCol, padding);
} }
} }
/* /*
* DR14889 - add call to checkAndWrapPreviousLine * DR14889 - add call to checkAndWrapPreviousLine
*/ */
@ -7225,32 +7227,35 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
// split at the column, no whitespace // split at the column, no whitespace
wrapAtPositionOrLock(lineStartOffset + charWrapCol, padding); wrapAtPositionOrLock(lineStartOffset + charWrapCol, padding);
} }
/* /*
* DR14889 - add call to checkAndWrapPreviousLine * DR14889 - add call to checkAndWrapPreviousLine
*/ */
checkAndWrapPreviousLine(lineNumber); checkAndWrapPreviousLine(lineNumber);
checkAndWrapNextLine(lineNumber); checkAndWrapNextLine(lineNumber);
} }
/** checks if the previous line is part of the same paragraph and continues /**
* checks if the previous line is part of the same paragraph and continues
* wrapping if it is * wrapping if it is
*
* @param line * @param line
*/ */
private void checkAndWrapPreviousLine(int line) { private void checkAndWrapPreviousLine(int line) {
// if there is a previous line // if there is a previous line
if ( isPreviousLineWrapped ){ if (isPreviousLineWrapped) {
return; return;
} }
if (line - 1 > 0) { if (line - 1 > 0) {
// if the previous line does not start a new paragraph // if the previous line does not start a new paragraph
if (!isParagraphStart(line - 1)) { if (!isParagraphStart(line - 1)) {
// if the previous line is not empty ( marks the end of a paragraph // if the previous line is not empty ( marks the end of a
// paragraph
// ) // )
if (!textEditor.getLine(line - 1).trim().isEmpty()) { if (!textEditor.getLine(line - 1).trim().isEmpty()) {
// rewrap the previous line // rewrap the previous line
isPreviousLineWrapped = true; isPreviousLineWrapped = true;
rewrapInternal(line - 1); rewrapInternal(line - 1);
} else if (line - 1 < endWrapLine) { } else if (line - 1 < endWrapLine) {
// See if another paragraph needs to be wrapped. // See if another paragraph needs to be wrapped.
@ -7260,19 +7265,19 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
--nextLine; --nextLine;
} }
if (nextLine <= endWrapLine) { if (nextLine <= endWrapLine) {
isPreviousLineWrapped = true; isPreviousLineWrapped = true;
rewrapInternal(nextLine); rewrapInternal(nextLine);
} }
} }
} else if (line - 1 <= endWrapLine) { } else if (line - 1 <= endWrapLine) {
isPreviousLineWrapped = true; isPreviousLineWrapped = true;
rewrapInternal(line - 1); rewrapInternal(line - 1);
} }
} }
}
/** }
/**
* checks if the paragraph starting at the line passed in uses two space * checks if the paragraph starting at the line passed in uses two space
* padding for subsequent lines * padding for subsequent lines
* *