summaryrefslogtreecommitdiff
path: root/iupe-hexview.lua
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-12-24 19:24:55 +0100
committerPixel <pixel@nobis-crew.org>2009-12-24 19:24:55 +0100
commitdc22c96581d74e353b722edd903ee1c5eeb67414 (patch)
tree3ffb68391356bafc7557554ccd1fbcbde697ba42 /iupe-hexview.lua
parent00bd9d1299f954b6776429e6b91159649fa1ccf9 (diff)
Adding more hexview configuration items, and adding the ability of the hexviewer to display read limits, somehow.
Diffstat (limited to 'iupe-hexview.lua')
-rw-r--r--iupe-hexview.lua23
1 files changed, 18 insertions, 5 deletions
diff --git a/iupe-hexview.lua b/iupe-hexview.lua
index 1d5f9e3..fb02b68 100644
--- a/iupe-hexview.lua
+++ b/iupe-hexview.lua
@@ -34,6 +34,8 @@ markercolors = {
}
iupep.hexview = {
+ gridsize = { x = 8, y = 14 },
+
printgrid = function (self, msg, y, x)
local cvdb = self.cvdb
if not x then x = self.textcursor.x end
@@ -116,15 +118,24 @@ iupep.hexview = {
self:colorgrid(cursorcolors.GREEN, 2, kline, kcolumn * 3 + 10)
self:colorgrid(cursorcolors.GREEN, 1, kline, kcolumn + 12 + columns * 3)
- local marker
+ local marker, len, mlen
for i = 0, 10 do
marker = self.markers[i] or -1
marker = marker - filecursor
- if marker >= 0 and marker < nbbytes then
+ mlen = self.markerslengths[i]
+ if marker >= 0 and self.showmarkerslengths and mlen and mlen > 0 then
+ len = math.min(mlen, nbbytes - marker)
+ elseif marker >= 0 and marker < nbbytes then
+ len = 1
+ else
+ len = 0
+ end
+ for j = 1, len do
mline = math.floor(marker / columns)
mcolumn = marker % columns
self:colorgrid(markercolors[i], 2, mline, mcolumn * 3 + 10)
self:colorgrid(markercolors[i], 1, mline, mcolumn + 12 + columns * 3)
+ marker = marker + 1
end
end
@@ -522,7 +533,7 @@ iupep.hexview = {
end,
updategridsize = function (self, gridsize)
- self.gridsize = gridsize or { x = 8, y = 14 }
+ self.gridsize = gridsize or iupep.hexview.gridsize
self:resize_cb(self.width, self.height)
end,
@@ -575,9 +586,11 @@ iupep.hexview = {
r.filesize = handle and handle:getsize() or 0
r.mcursor = -1
r.markers = {}
- r.displaylines = -1
+ r.markerslengths = {}
+ r.showmarkerslengths = false
+ r.displaylines = 0
for i = 0, 10 do r.markers[i] = -1 end
- r.gridsize = gridsize or { x = 8, y = 14 }
+ r.gridsize = gridsize or iupep.hexview.gridsize
r.textcursor = { x = 0, y = 0 }
return r
end,