From: <ox-...@us...> - 2002-07-15 20:44:22
|
Update of /cvsroot/sheets/sheets In directory usw-pr-cvs1:/tmp/cvs-serv31154 Modified Files: Sheets.sheets Log Message: Minor change to code folding, and removal of a virus in bootstrap-sheets.jar. Index: Sheets.sheets =================================================================== RCS file: /cvsroot/sheets/sheets/Sheets.sheets,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Sheets.sheets 9 Jul 2002 19:03:47 -0000 1.12 --- Sheets.sheets 15 Jul 2002 20:44:16 -0000 1.13 *************** *** 80710,80713 **** --- 80710,80722 ---- // collapses the lines referred to by index public void RichTextViewer.collapseLines(int start, int end) { + LineSelection range = null; + if (formattedLines != null) { + // Get the current selection, if we can. + ViewPanel pane = getViewPanel(); + ViewerSelection selection = pane == null ? null : pane.getSelection(); + if (selection != null && this == selection.getViewer()) { + range = selectionRange(selection); + } + } for (int i=start; i<=end; i++) { dispLineVisibility[i] = false; *************** *** 80718,80721 **** --- 80727,80755 ---- if (formattedLines != null) { invalidFormatting(start, end + 1); + checkFormatting(); + // Adjust the cursor and selection so that it is outside the collapsed region + if (range != null) { + while (formattedLines[range.end.line] == null) { + // the end cursor is in the region, so push it to the bottom + range.end.line--; + range.end.position = Integer.MAX_VALUE; + while (formattedLines[range.start.line] == null) { + // both cursors are in the region, so push them both to the top + range.start.line--; + range.start.position = Integer.MAX_VALUE; + } + } + while (formattedLines[range.start.line] == null) { + // only the start cursor is in the region, so push it to the bottom + range.start.line++; + range.start.position = 0; + } + } + // Modify the selection to represent the proper region after expansion + if (range != null) { + // First set a point cursor, then extend it. + setCursor(range.start.position, range.start.line, false); + setCursor(range.end.position, range.end.line, true); + } } } *************** *** 80761,80764 **** --- 80795,80807 ---- // collapses the lines referred to by index public void RichTextViewer.expandLines(int start) { + LineSelection range = null; + if (formattedLines != null) { + // Get the current selection, if we can. + ViewPanel pane = getViewPanel(); + ViewerSelection selection = pane == null ? null : pane.getSelection(); + if (selection != null && this == selection.getViewer()) { + range = selectionRange(selection); + } + } int end = start; for (; end<=dispLines.length; end++) { *************** *** 80769,80772 **** --- 80812,80822 ---- if (formattedLines != null) { invalidFormatting(start, end); + checkFormatting(); + // Modify the selection to represent the proper region after expansion + if (range != null) { + // First set a point cursor, then extend it. + setCursor(range.start.position, range.start.line, false); + setCursor(range.end.position, range.end.line, true); + } } } |