diff options
author | Kenny Root <kenny@the-b.org> | 2009-06-07 05:31:48 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2009-06-07 05:31:48 +0000 |
commit | 564bde5c42170592fdeed845e19fd102ae2865aa (patch) | |
tree | 3d8f144474c25cf962c746bd38dc29f26876febb /src/de/mud | |
parent | 8f5688cbd6c59bd642d67b3218b43a0de1cf6ee4 (diff) | |
download | connectbot-564bde5c42170592fdeed845e19fd102ae2865aa.tar.gz connectbot-564bde5c42170592fdeed845e19fd102ae2865aa.tar.bz2 connectbot-564bde5c42170592fdeed845e19fd102ae2865aa.zip |
Fix resizing bug caused by removing all the unnecessary allocations in mud.de code
git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@272 df292f66-193f-0410-a5fc-6d59da041ff2
Diffstat (limited to 'src/de/mud')
-rw-r--r-- | src/de/mud/terminal/VDUBuffer.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/de/mud/terminal/VDUBuffer.java b/src/de/mud/terminal/VDUBuffer.java index 60c73f4..f9940c3 100644 --- a/src/de/mud/terminal/VDUBuffer.java +++ b/src/de/mud/terminal/VDUBuffer.java @@ -733,7 +733,7 @@ public class VDUBuffer { public void setScreenSize(int w, int h, boolean broadcast) { char cbuf[][]; int abuf[][]; - int bsize = bufSize; + int maxSize = bufSize; if (w < 1 || h < 1) return; @@ -759,17 +759,22 @@ public class VDUBuffer { cbuf = new char[bufSize][w]; abuf = new int[bufSize][w]; - + for (int i = 0; i < bufSize; i++) { - Arrays.fill(cbuf[i], ' '); - } + Arrays.fill(cbuf[i], ' '); + } + + if (bufSize < maxSize) + maxSize = bufSize; + int rowLength; if (charArray != null && charAttributes != null) { - for (int i = 0; i < bsize && i < bufSize; i++) { + for (int i = 0; i < maxSize && charArray[i] != null; i++) { + rowLength = charArray[i].length; System.arraycopy(charArray[i], 0, cbuf[i], 0, - w < width ? w : width); + w < rowLength ? w : rowLength); System.arraycopy(charAttributes[i], 0, abuf[i], 0, - w < width ? w : width); + w < rowLength ? w : rowLength); } } |