Commit Diff


commit - 476d4d544fde4ec346704d111c864b8b72f63706
commit + 38ccfa3a99e9d28e992ad8ea81099698ef3a01a2
blob - 8ae87df766b14aa2df153bf8cd650c1e34a9e4a2
blob + c502d8e28b119ed4b2114e8f18a900a613327748
--- de/mud/terminal/SwingTerminal.java
+++ de/mud/terminal/SwingTerminal.java
@@ -855,16 +855,14 @@ public class SwingTerminal extends Component
       if (selectEnd.x > buffer.charArray[0].length)
         selectEnd.x = buffer.charArray[0].length;
 
-      // Initial buffer space for selectEnd - selectBegin + 1 lines
       // NOTE: Selection includes invisible text as spaces!
       // (also leaves invisible non-whitespace selection ending as spaces)
-      StringBuffer selectionBuf =
-        new StringBuffer(buffer.charArray[0].length * (selectEnd.y - selectBegin.y + 1));
 
       for (int l = selectBegin.y; l <= selectEnd.y; l++) {
-        int start, end;
-        start = (l == selectBegin.y ? start = selectBegin.x : 0);
-        end = (l == selectEnd.y ? end = selectEnd.x : buffer.charArray[l].length);
+	/* reinitialize buffer every loop */
+        StringBuffer selectionBuf = new StringBuffer(buffer.charArray[0].length);
+        int start = (l == selectBegin.y ? start = selectBegin.x : 0);
+        int end = (l == selectEnd.y ? end = selectEnd.x : buffer.charArray[l].length);
 
         boolean newlineFound = false;
         char ch = ' ';