diff --git a/assets/opencomputers/lua/rom/lib/term.lua b/assets/opencomputers/lua/rom/lib/term.lua index 6782edeb6..f16e3c55c 100644 --- a/assets/opencomputers/lua/rom/lib/term.lua +++ b/assets/opencomputers/lua/rom/lib/term.lua @@ -284,11 +284,17 @@ function term.read(history) term.setCursorBlink(true) while term.isAvailable() do + local ocx, ocy = getCursor() local ok, name, address, charOrValue, code = pcall(event.pull) if not ok then cleanup() error("interrupted", 0) end + local ncx, ncy = getCursor() + if ocx ~= ncx or ocy ~= ncy then + cleanup() + return "" -- soft fail the read if someone messes with the term + end if term.isAvailable() and -- may have changed since pull type(address) == "string" and component.isPrimary(address) diff --git a/li/cil/oc/client/renderer/MonospaceFontRenderer.scala b/li/cil/oc/client/renderer/MonospaceFontRenderer.scala index 32ad3448e..d4cce67b1 100644 --- a/li/cil/oc/client/renderer/MonospaceFontRenderer.scala +++ b/li/cil/oc/client/renderer/MonospaceFontRenderer.scala @@ -23,10 +23,10 @@ object MonospaceFontRenderer { val fontWidth = 5 val fontHeight = 9 - def drawString(x: Int, y: Int, value: Array[Char], color: Array[Short], depth: PackedColor.Depth.Value) = instance match { + def drawString(x: Int, y: Int, value: Array[Char], color: Array[Short], depth: PackedColor.Depth.Value) = this.synchronized(instance match { case None => OpenComputers.log.warning("Trying to render string with uninitialized MonospaceFontRenderer.") case Some(renderer) => renderer.drawString(x, y, value, color, depth) - } + }) private class Renderer(private val textureManager: TextureManager) { /** Display lists, one per char (renders quad with char's uv coords). */ diff --git a/li/cil/oc/client/renderer/tileentity/ScreenRenderer.scala b/li/cil/oc/client/renderer/tileentity/ScreenRenderer.scala index 5c05e46c3..929260841 100644 --- a/li/cil/oc/client/renderer/tileentity/ScreenRenderer.scala +++ b/li/cil/oc/client/renderer/tileentity/ScreenRenderer.scala @@ -132,14 +132,17 @@ object ScreenRenderer extends TileEntitySpecialRenderer with Callable[Int] with } } - private def compileOrDraw(list: Int) = if (screen.bufferIsDirty && !RenderState.compilingDisplayList) { - screen.bufferIsDirty = false + private def compileOrDraw(list: Int) = if (screen.bufferIsDirty) { val sx = screen.width val sy = screen.height val tw = sx * 16f val th = sy * 16f - GL11.glNewList(list, GL11.GL_COMPILE_AND_EXECUTE) + val doCompile = !RenderState.compilingDisplayList + if (doCompile) { + screen.bufferIsDirty = false + GL11.glNewList(list, GL11.GL_COMPILE_AND_EXECUTE) + } transform() @@ -178,7 +181,9 @@ object ScreenRenderer extends TileEntitySpecialRenderer with Callable[Int] with MonospaceFontRenderer.drawString(0, i * MonospaceFontRenderer.fontHeight, line, color, screen.buffer.depth) } - GL11.glEndList() + if (doCompile) { + GL11.glEndList() + } true }