From 9a4cae695cc6eed480ae181b43522480d4151282 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 25 Mar 2018 15:23:40 -0700 Subject: [PATCH] Cleanup. --- ldt.lua | 12 ++++++------ ldt.moon | 11 +++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ldt.lua b/ldt.lua index e0c0d1b..7526833 100644 --- a/ldt.lua +++ b/ldt.lua @@ -1,9 +1,8 @@ local C = require("curses") local re = require('re') local repr = require('repr') -local ldb, stdscr +local ldb local AUTO = { } -local log = io.open("output.log", "w") local callstack_range callstack_range = function() local min, max = 0, -1 @@ -250,7 +249,6 @@ do table.insert(self.colors, color_fn) end self:configure_size(height, width) - log:write("New pad: " .. tostring(self.height) .. "," .. tostring(self.width) .. " " .. tostring(self._height) .. "," .. tostring(self._width) .. "\n") self._frame = C.newwin(self.height, self.width, self.y, self.x) self._frame:immedok(true) self._pad = C.newpad(self._height, self._width) @@ -376,8 +374,8 @@ err_hand = function(err) end ldb = { run_debugger = function(err_msg) - stdscr = C.initscr() - SCREEN_H, SCREEN_W = stdscr:getmaxyx() + local stdscr = C.initscr() + local SCREEN_H, SCREEN_W = stdscr:getmaxyx() C.cbreak() C.echo(false) C.nl(false) @@ -708,11 +706,13 @@ ldb = { pad:refresh() end elseif C.KEY_RESIZE == _exp_0 then + SCREEN_H, SCREEN_W = stdscr:getmaxyx() stdscr:clear() stdscr:refresh() for _, pad in pairs(pads) do - pad:refresh() + pad:refresh(true) end + C.doupdate() elseif ('q'):byte() == _exp_0 or ("Q"):byte() == _exp_0 then pads = { } C.endwin() diff --git a/ldt.moon b/ldt.moon index a13eb5e..6364976 100644 --- a/ldt.moon +++ b/ldt.moon @@ -1,9 +1,8 @@ C = require "curses" re = require 're' repr = require 'repr' -local ldb, stdscr -AUTO = {} -log = io.open("output.log", "w") +local ldb +AUTO = {} -- Singleton -- Return the callstack index of the code that actually caused an error and the max index callstack_range = -> @@ -88,7 +87,6 @@ class Pad table.insert(@colors, color_fn) @configure_size height, width - log\write("New pad: #{@height},#{@width} #{@_height},#{@_width}\n") @_frame = C.newwin(@height, @width, @y, @x) @_frame\immedok(true) @_pad = C.newpad(@_height, @_width) @@ -241,7 +239,6 @@ err_hand = (err)-> ldb = { run_debugger: (err_msg)-> - export stdscr, SCREEN_H, SCREEN_W stdscr = C.initscr! SCREEN_H, SCREEN_W = stdscr\getmaxyx! @@ -517,9 +514,11 @@ ldb = { for _,pad in pairs(pads) do pad\refresh! when C.KEY_RESIZE + SCREEN_H, SCREEN_W = stdscr\getmaxyx! stdscr\clear! stdscr\refresh! - for _,pad in pairs(pads) do pad\refresh! + for _,pad in pairs(pads) do pad\refresh(true) + C.doupdate! when ('q')\byte!, ("Q")\byte! pads = {}