From e294e63159e9596dd23bdb33e6ac3c574c32289f Mon Sep 17 00:00:00 2001 From: Pixel Date: Mon, 21 Dec 2009 21:22:38 +0100 Subject: Various fixes. --- dalos-hexview.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'dalos-hexview.lua') diff --git a/dalos-hexview.lua b/dalos-hexview.lua index a302d39..ee9412e 100644 --- a/dalos-hexview.lua +++ b/dalos-hexview.lua @@ -52,12 +52,16 @@ dalosp.hexview = { output_change = function (self, ind) self.watchees[ind] = self.outputs[ind] and true or false + self:set_houtput(nil, ind) + self.oldcursors[ind] = -1 + self:dalos_hv_cb(self.extra.hv) end, update_houtput = function (self, ind, cursor) local h = self:get_linked_input(1) - local maxsixe = h and h:getsize() or -1 - if h and self.watchees[ind] then + local maxsize = h and h:getsize() or -1 + cursor = cursor + 0 + if cursor >= 0 and h and self.watchees[ind] then if cursor < maxsize then self:set_houtput(nil, ind) end @@ -72,7 +76,7 @@ dalosp.hexview = { do_seek = function (self) self.h:seek(self.offset + self.origin) end, - do_read = function (self, userdata, count) + do_read = function (self, count, userdata) return self.h:read(count, userdata) end, } @@ -84,20 +88,20 @@ dalosp.hexview = { local m for i = 1, 10 do m = hv.markers[i] - if self.oldcursors[i] ~= m then + if m and self.oldcursors[i] ~= m then self:update_houtput(i, m) self.oldcursors[i] = m end end m = hv.kcursor - if self.oldcursors[11] ~= m then + if m and self.oldcursors[11] ~= m then self:update_houtput(11, m) self.oldcursors[11] = m end m = hv.mcursor - if self.oldcursors[12] ~= m then + if m and self.oldcursors[12] ~= m then self:update_houtput(12, m) self.oldcursors[12] = m end @@ -146,6 +150,7 @@ dalosp.hexview = { end hv:registercb(dalosp.hexview.dalos_hv_cb, obj) + obj.dalos_hv_cb = dalosp.hexview.dalos_hv_cb return obj end, -- cgit v1.2.3