### Eclipse Workspace Patch 1.0 #P org.eclipse.swt Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java,v retrieving revision 1.528 diff -u -r1.528 StyledText.java --- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java 31 May 2010 16:44:12 -0000 1.528 +++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java 9 Jun 2010 16:55:10 -0000 @@ -205,6 +205,7 @@ int pageWidth; // width of a printer page in pixels int startPage; // first page to print int endPage; // last page to print + int scope; // scope of print job int startLine; // first (wrapped) line to print int endLine; // last (wrapped) line to print boolean singleLine; // widget single line mode @@ -230,7 +231,8 @@ startPage = 1; endPage = Integer.MAX_VALUE; PrinterData data = printer.getPrinterData(); - if (data.scope == PrinterData.PAGE_RANGE) { + scope = data.scope; + if (scope == PrinterData.PAGE_RANGE) { startPage = data.startPage; endPage = data.endPage; if (endPage < startPage) { @@ -238,7 +240,7 @@ endPage = startPage; startPage = temp; } - } else if (data.scope == PrinterData.SELECTION) { + } else if (scope == PrinterData.SELECTION) { selection = styledText.getSelectionRange(); } printerRenderer = new StyledTextRenderer(printer, null); @@ -438,10 +440,10 @@ startLine = 0; endLine = singleLine ? 0 : content.getLineCount() - 1; PrinterData data = printer.getPrinterData(); - if (data.scope == PrinterData.PAGE_RANGE) { + if (scope == PrinterData.PAGE_RANGE) { int pageSize = clientArea.height / lineHeight;//WRONG startLine = (startPage - 1) * pageSize; - } else if (data.scope == PrinterData.SELECTION) { + } else if (scope == PrinterData.SELECTION) { startLine = content.getLineAtOffset(selection.x); if (selection.y > 0) { endLine = content.getLineAtOffset(selection.x + selection.y - 1);