From ba942700d86f7c494860049f05bb8905abb07108 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 13 Mar 2018 23:53:06 -0700 Subject: [PATCH] Improvements. --- cursed.lua | 190 +++++++++++++++++++++++++++++++++++----------------- cursed.moon | 150 +++++++++++++++++++++++++++++------------ 2 files changed, 239 insertions(+), 101 deletions(-) diff --git a/cursed.lua b/cursed.lua index 1aaba50..541fe20 100644 --- a/cursed.lua +++ b/cursed.lua @@ -1,6 +1,6 @@ local C = require("curses") local repr = require('repr') -local REGULAR, INVERTED, HIGHLIGHTED, RED, BLUE, SCREEN_H, SCREEN_W +local COLORS = { } local run_debugger, guard, stdscr, main_loop local AUTO = -1 local log = io.open("output.log", "w") @@ -41,19 +41,15 @@ wrap_text = function(text, width) end return lines end -local alternating_colors = setmetatable({ }, { - __index = function(self, i) - if i % 2 == 0 then - return INVERTED - else - return REGULAR - end - end -}) +local default_colors = { } local Pad do local _class_0 local _base_0 = { + set_active = function(self, active) + self.active = active + return self._pad:attrset(active and self.colors.active_frame or self.colors.inactive_frame) + end, select = function(self, i) if i == self.selected or #self.lines == 0 then return self.selected @@ -63,22 +59,23 @@ do end if self.selected then local j = self.selected - self.chstrs[j]:set_str(0, self.lines[j], self.attrs[j]) - self.chstrs[j]:set_str(#self.lines[j], ' ', self.attrs[j], self.chstrs[j]:len() - #self.lines[j]) + local attr = (j % 2 == 0) and self.colors.even_row or self.colors.odd_row + self.chstrs[j]:set_str(0, self.lines[j], attr) + self.chstrs[j]:set_str(#self.lines[j], ' ', attr, self.chstrs[j]:len() - #self.lines[j]) self._pad:mvaddchstr(j - 1 + 1, 0 + 1, self.chstrs[j]) end if i then - assert(self.chstrs[i], "DIDN'T FIND CHSTR: " .. tostring(i) .. "/" .. tostring(#self.chstrs) .. " (" .. tostring(#self.lines) .. ")") - self.chstrs[i]:set_str(0, self.lines[i], HIGHLIGHTED) - self.chstrs[i]:set_str(#self.lines[i], ' ', HIGHLIGHTED, self.chstrs[i]:len() - #self.lines[i]) + local attr = self.active and self.colors.active or self.colors.highlight + self.chstrs[i]:set_str(0, self.lines[i], attr) + self.chstrs[i]:set_str(#self.lines[i], ' ', attr, self.chstrs[i]:len() - #self.lines[i]) self._pad:mvaddchstr(i - 1 + 1, 0 + 1, self.chstrs[i]) end self.selected = i if self.selected then - if self.offset + self.height - 1 < self.selected then - self.offset = math.min(self.selected - (self.height - 1), #self.lines - self.height) - elseif self.offset + 1 > self.selected then - self.offset = self.selected - 1 + if self.scroll_y + self.height - 1 < self.selected then + self.scroll_y = math.min(self.selected - (self.height - 1), #self.lines - self.height) + elseif self.scroll_y + 1 > self.selected then + self.scroll_y = self.selected - 1 end end self:refresh() @@ -89,11 +86,14 @@ do end, refresh = function(self) self._pad:border(C.ACS_VLINE, C.ACS_VLINE, C.ACS_HLINE, C.ACS_HLINE, C.ACS_ULCORNER, C.ACS_URCORNER, C.ACS_LLCORNER, C.ACS_LRCORNER) - return self._pad:pnoutrefresh(self.offset, 0, self.y, self.x, self.y + self.height + 1, self.x + self.width) + if self.label then + self._pad:mvaddstr(0, math.floor((self.width - #self.label - 2) / 2), " " .. tostring(self.label) .. " ") + end + return self._pad:pnoutrefresh(self.scroll_y, self.scroll_x, self.y, self.x, self.y + self.height + 1, self.x + self.width) end, erase = function(self) self._pad:erase() - return self._pad:pnoutrefresh(self.offset, 0, self.y, self.x, self.y + self.height, self.x + self.width) + return self._pad:pnoutrefresh(self.scroll_y, self.scroll_x, self.y, self.x, self.y + self.height, self.x + self.width) end, clear = function(self) self:erase() @@ -107,45 +107,51 @@ do self:set_size(self.height, self._width) end self.selected = nil - self.offset = 0 + self.scroll_y, self.scroll_x = 0, 0 return self:refresh() end } _base_0.__index = _base_0 _class_0 = setmetatable({ - __init = function(self, y, x, height, width, lines, attrs, pad_attr) - if attrs == nil then - attrs = alternating_colors + __init = function(self, y, x, height, width, lines, label, colors) + if colors == nil then + colors = default_colors end - if pad_attr == nil then - pad_attr = 0 + self.y, self.x, self.height, self.width, self.lines, self.label, self.colors = y, x, height, width, lines, label, colors + if self.colors and self.colors ~= default_colors then + setmetatable(self.colors, { + __index = default_colors + }) end - self.y, self.x, self.height, self.width, self.lines, self.attrs = y, x, height, width, lines, attrs - self.offset = 0 + self.scroll_y, self.scroll_x = 0, 0 self.selected = nil - self._height = #self.lines + 2 - self._width = self.width == AUTO and 2 or self.width - local _list_0 = self.lines - for _index_0 = 1, #_list_0 do - local x = _list_0[_index_0] - self._width = math.max(self._width, #x + 2) - end - if self.height == AUTO then - self.height = self._height - end if self.width == AUTO then - self.width = self._width + self.width = 2 + local _list_0 = self.lines + for _index_0 = 1, #_list_0 do + local x = _list_0[_index_0] + self.width = math.max(self.width, #x + 2) + end end + self._width = self.width + if self.height == AUTO then + self.height = #self.lines + 2 + end + self._height = self.height self._pad = C.newpad(self._height, self._width) self._pad:scrollok(true) - self._pad:attrset(pad_attr) + self:set_active(false) self.chstrs = { } for i, line in ipairs(self.lines) do - local attr = self.attrs[i] + local attr = (i % 2 == 0) and self.colors.even_row or self.colors.odd_row local chstr = C.new_chstr(self.width - 2) self.chstrs[i] = chstr + if #line >= chstr:len() then + line = line:sub(1, chstr:len()) + else + line = line .. (" "):rep(chstr:len() - #line) + end chstr:set_str(0, line, attr) - chstr:set_str(#line + 0, ' ', attr, chstr:len() - #line) self._pad:mvaddchstr(i - 1 + 1, 0 + 1, chstr) end return self:refresh() @@ -196,7 +202,7 @@ local line_tables = setmetatable({ }, { end end }) -local err_pad, stack_pad, var_names, var_values = nil, nil, nil, nil +local err_pad, stack_pad, src_pad, var_names, var_values = nil, nil, nil, nil, nil main_loop = function(err_msg, stack_index, var_index, value_index) local stack_names = { } local stack_locations = { } @@ -241,14 +247,57 @@ main_loop = function(err_msg, stack_index, var_index, value_index) end if not err_pad then local err_msg_lines = wrap_text(err_msg, SCREEN_W - 4) - err_pad = Pad(0, 0, AUTO, SCREEN_W, err_msg_lines, setmetatable({ }, { - __index = function() - return RED - end - }), RED) + for i, line in ipairs(err_msg_lines) do + err_msg_lines[i] = (" "):rep(math.floor((SCREEN_W - 2 - #line) / 2)) .. line + end + err_pad = Pad(0, 0, AUTO, SCREEN_W, err_msg_lines, "Error Message", { + even_row = COLORS.RED | C.A_BOLD, + odd_row = COLORS.RED | C.A_BOLD, + inactive_frame = COLORS.RED | C.A_DIM + }) end if not stack_pad then - stack_pad = Pad(err_pad.height, 0, AUTO, SCREEN_W, callstack, nil, BLUE) + stack_pad = Pad(err_pad.height, 0, math.max(#callstack + 2, 20), AUTO, callstack, "Callstack") + stack_pad.label = "Callstack" + stack_pad:set_active(true) + stack_pad:refresh() + stack_pad.on_select = function(self, stack_index) + local filename, line_no = stack_pad.lines[stack_index]:match("([^:]*):(%d*).*") + line_no = tonumber(line_no) + local file = file_cache[filename] + local src_lines = { } + local selected = nil + local i = 0 + for line in file:gmatch("[^\n]*") do + local _continue_0 = false + repeat + i = i + 1 + if i < line_no - (self.height - 2) / 2 then + _continue_0 = true + break + end + table.insert(src_lines, line) + if i == line_no then + selected = #src_lines + end + if #src_lines >= self.height - 2 then + break + end + _continue_0 = true + until true + if not _continue_0 then + break + end + end + if src_pad then + src_pad:erase() + end + src_pad = Pad(err_pad.height, stack_pad.x + stack_pad.width, stack_pad.height, SCREEN_W - stack_pad.x - stack_pad.width - 0, src_lines, "Source Code", { + highlight = COLORS.RED_BG, + inactive_frame = COLORS.GREEN | C.A_BOLD + }) + return src_pad:select(selected) + end end stack_index = stack_pad:select(stack_index) if var_names then @@ -274,17 +323,25 @@ main_loop = function(err_msg, stack_index, var_index, value_index) end local var_y = stack_pad.y + stack_pad.height local var_x = 0 - var_names = Pad(var_y, var_x, AUTO, AUTO, _var_names, nil, BLUE) + var_names = Pad(var_y, var_x, math.min(2 + #_var_names, SCREEN_H - err_pad.height - stack_pad.height), AUTO, _var_names, "Vars") if var_index and #_var_names > 0 then + var_names:set_active(value_index == nil) + stack_pad:set_active(false) + stack_pad:refresh() var_index = var_names:select(var_index) + else + stack_pad:set_active(true) + stack_pad:refresh() end local value_x = var_names.x + var_names.width local value_w = SCREEN_W - (value_x) if value_index then - var_values = Pad(var_y, value_x, AUTO, value_w, wrap_text(_var_values[var_index], value_w - 2), nil, BLUE) + var_values = Pad(var_y, value_x, var_names.height, value_w, wrap_text(_var_values[var_index], value_w - 2), "Values") + var_values:set_active(true) value_index = var_values:select(value_index) else - var_values = Pad(var_y, value_x, AUTO, value_w, _var_values, nil, BLUE) + var_values = Pad(var_y, value_x, var_names.height, value_w, _var_values, "Values") + var_values:set_active(false) end while true do C.doupdate() @@ -343,8 +400,8 @@ main_loop = function(err_msg, stack_index, var_index, value_index) elseif ('o'):byte() == _exp_0 then local file = stack_locations[stack_pad.selected] local filename, line_no = file:match("([^:]*):(.*)") + err_pad, stack_pad, src_pad, var_names, var_values = nil, nil, nil, nil, nil C.endwin() - err_pad, stack_pad, var_names, var_values = nil, nil, nil, nil os.execute((os.getenv("EDITOR") or "nano") .. " +" .. line_no .. " " .. filename) local initial_index = stack_pad.selected return main_loop(err_msg, stack_pad.selected, var_index) @@ -352,7 +409,7 @@ main_loop = function(err_msg, stack_index, var_index, value_index) break end end - err_pad, stack_pad, var_names, var_values = nil, nil, nil, nil + err_pad, stack_pad, src_pad, var_names, var_values = nil, nil, nil, nil, nil return C.endwin() end run_debugger = function(err_msg) @@ -365,11 +422,24 @@ run_debugger = function(err_msg) C.start_color() C.use_default_colors() local _ - _, REGULAR = C.init_pair(1, -1, -1), C.color_pair(1) - _, INVERTED = C.init_pair(2, -1, C.COLOR_BLACK), C.color_pair(2) - _, HIGHLIGHTED = C.init_pair(3, C.COLOR_BLACK, C.COLOR_YELLOW), C.color_pair(3) - _, RED = C.init_pair(4, C.COLOR_RED, -1), C.color_pair(4) | C.A_BOLD - _, BLUE = C.init_pair(5, C.COLOR_BLUE, -1), C.color_pair(5) | C.A_BOLD + _, COLORS.REGULAR = C.init_pair(1, C.COLOR_WHITE, -1), C.color_pair(1) + _, COLORS.INVERTED = C.init_pair(2, C.COLOR_WHITE, C.COLOR_BLACK), C.color_pair(2) + _, COLORS.YELLOW_BG = C.init_pair(3, C.COLOR_BLACK, C.COLOR_YELLOW), C.color_pair(3) + _, COLORS.RED = C.init_pair(4, C.COLOR_RED, -1), C.color_pair(4) + _, COLORS.BLUE = C.init_pair(5, C.COLOR_BLUE, -1), C.color_pair(5) | C.A_BOLD + _, COLORS.WHITE = C.init_pair(6, C.COLOR_WHITE, -1), C.color_pair(6) + _, COLORS.WHITE_BG = C.init_pair(7, C.COLOR_BLACK, C.COLOR_WHITE), C.color_pair(7) + _, COLORS.BROWN = C.init_pair(8, C.COLOR_BLACK, -1), C.color_pair(8) | C.A_BOLD + _, COLORS.RED_BG = C.init_pair(9, C.COLOR_YELLOW, C.COLOR_RED), C.color_pair(9) | C.A_BOLD | C.A_DIM + _, COLORS.GREEN = C.init_pair(10, C.COLOR_GREEN, -1), C.color_pair(10) + default_colors = { + active_frame = COLORS.BLUE, + inactive_frame = COLORS.BROWN, + odd_row = COLORS.REGULAR, + even_row = COLORS.INVERTED, + highlight = COLORS.WHITE_BG, + active = COLORS.YELLOW_BG + } stdscr:clear() stdscr:refresh() return main_loop(err_msg, 1) diff --git a/cursed.moon b/cursed.moon index 6511270..5edb583 100644 --- a/cursed.moon +++ b/cursed.moon @@ -1,6 +1,6 @@ C = require "curses" repr = require 'repr' -local REGULAR, INVERTED, HIGHLIGHTED, RED, BLUE, SCREEN_H, SCREEN_W +COLORS = {} local run_debugger, guard, stdscr, main_loop AUTO = -1 log = io.open("output.log", "w") @@ -34,60 +34,70 @@ wrap_text = (text, width)-> table.insert(lines, line) return lines -alternating_colors = setmetatable({}, {__index:(i)=> if i % 2 == 0 then INVERTED else REGULAR}) +default_colors = { +} + class Pad - new: (@y,@x,@height,@width,@lines,@attrs=alternating_colors, pad_attr=0)=> - --log\write("New Pad:\n #{table.concat @lines, "\n "}\n") - @offset = 0 + new: (@y,@x,@height,@width,@lines,@label,@colors=default_colors)=> + if @colors and @colors != default_colors + setmetatable(@colors, __index:default_colors) + @scroll_y, @scroll_x = 0, 0 @selected = nil - @_height = #@lines + 2 - @_width = @width == AUTO and 2 or @width - for x in *@lines do @_width = math.max(@_width, #x+2) + if @width == AUTO + @width = 2 + for x in *@lines do @width = math.max(@width, #x+2) + @_width = @width if @height == AUTO - @height = @_height - if @width == AUTO - @width = @_width + @height = #@lines + 2 + @_height = @height - --log\write("#lines = #{#@lines}, height = #{@_height}, width = #{@_width}\n") @_pad = C.newpad(@_height, @_width) @_pad\scrollok(true) - @_pad\attrset(pad_attr) + @set_active false @chstrs = {} for i, line in ipairs(@lines) - attr = @attrs[i] + attr = (i % 2 == 0) and @colors.even_row or @colors.odd_row chstr = C.new_chstr(@width-2) @chstrs[i] = chstr + if #line >= chstr\len! + line = line\sub(1, chstr\len!) + else + line ..= (" ")\rep(chstr\len!-#line) chstr\set_str(0, line, attr) - chstr\set_str(#line+0, ' ', attr, chstr\len!-#line) @_pad\mvaddchstr(i-1+1,0+1,chstr) @refresh! + set_active: (active)=> + @active = active + @_pad\attrset(active and @colors.active_frame or @colors.inactive_frame) + select: (i)=> if i == @selected or #@lines == 0 then return @selected if i != nil i = math.max(1, math.min(#@lines, i)) if @selected j = @selected - @chstrs[j]\set_str(0, @lines[j], @attrs[j]) - @chstrs[j]\set_str(#@lines[j], ' ', @attrs[j], @chstrs[j]\len!-#@lines[j]) + attr = (j % 2 == 0) and @colors.even_row or @colors.odd_row + @chstrs[j]\set_str(0, @lines[j], attr) + @chstrs[j]\set_str(#@lines[j], ' ', attr, @chstrs[j]\len!-#@lines[j]) @_pad\mvaddchstr(j-1+1,0+1,@chstrs[j]) if i - assert(@chstrs[i], "DIDN'T FIND CHSTR: #{i}/#{#@chstrs} (#{#@lines})") - @chstrs[i]\set_str(0, @lines[i], HIGHLIGHTED) - @chstrs[i]\set_str(#@lines[i], ' ', HIGHLIGHTED, @chstrs[i]\len!-#@lines[i]) + attr = @active and @colors.active or @colors.highlight + @chstrs[i]\set_str(0, @lines[i], attr) + @chstrs[i]\set_str(#@lines[i], ' ', attr, @chstrs[i]\len!-#@lines[i]) @_pad\mvaddchstr(i-1+1,0+1,@chstrs[i]) @selected = i if @selected - if @offset + @height-1 < @selected - @offset = math.min(@selected - (@height-1), #@lines-@height) - elseif @offset + 1 > @selected - @offset = @selected - 1 + if @scroll_y + @height-1 < @selected + @scroll_y = math.min(@selected - (@height-1), #@lines-@height) + elseif @scroll_y + 1 > @selected + @scroll_y = @selected - 1 @refresh! if @on_select then @on_select(@selected) return @selected @@ -97,11 +107,13 @@ class Pad C.ACS_HLINE, C.ACS_HLINE, C.ACS_ULCORNER, C.ACS_URCORNER, C.ACS_LLCORNER, C.ACS_LRCORNER) - @_pad\pnoutrefresh(@offset,0,@y,@x,@y+@height+1,@x+@width) + if @label + @_pad\mvaddstr(0, math.floor((@width-#@label-2)/2), " #{@label} ") + @_pad\pnoutrefresh(@scroll_y,@scroll_x,@y,@x,@y+@height+1,@x+@width) erase: => @_pad\erase! - @_pad\pnoutrefresh(@offset,0,@y,@x,@y+@height,@x+@width) + @_pad\pnoutrefresh(@scroll_y,@scroll_x,@y,@x,@y+@height,@x+@width) clear: => @erase! @@ -113,7 +125,7 @@ class Pad if @resize_width @set_size(@height, @_width) @selected = nil - @offset = 0 + @scroll_y, @scroll_x = 0, 0 @refresh! @@ -136,7 +148,7 @@ line_tables = setmetatable({}, {__index:(filename)=> return line_table }) -err_pad, stack_pad, var_names, var_values = nil, nil, nil, nil +err_pad, stack_pad, src_pad, var_names, var_values = nil, nil, nil, nil, nil main_loop = (err_msg, stack_index, var_index, value_index)-> export err_pad, stack_pad, var_names, var_values @@ -167,10 +179,45 @@ main_loop = (err_msg, stack_index, var_index, value_index)-> if not err_pad err_msg_lines = wrap_text(err_msg, SCREEN_W - 4) - err_pad = Pad(0,0,AUTO,SCREEN_W, err_msg_lines,setmetatable({}, __index:->RED), RED) + for i,line in ipairs(err_msg_lines) + err_msg_lines[i] = (" ")\rep(math.floor((SCREEN_W-2-#line)/2))..line + err_pad = Pad(0,0,AUTO,SCREEN_W, err_msg_lines, "Error Message", { + even_row: COLORS.RED | C.A_BOLD, odd_row: COLORS.RED | C.A_BOLD, + inactive_frame: COLORS.RED | C.A_DIM + }) if not stack_pad - stack_pad = Pad(err_pad.height,0,AUTO,SCREEN_W, callstack, nil, BLUE) + stack_pad = Pad(err_pad.height,0,math.max(#callstack+2, 20),AUTO, callstack, "Callstack") + stack_pad.label = "Callstack" + stack_pad\set_active(true) + stack_pad\refresh! + + stack_pad.on_select = (stack_index)=> + filename, line_no = stack_pad.lines[stack_index]\match("([^:]*):(%d*).*") + line_no = tonumber(line_no) + file = file_cache[filename] + src_lines = {} + selected = nil + i = 0 + for line in file\gmatch("[^\n]*") + i += 1 + if i < line_no-(@height-2)/2 + continue + table.insert src_lines, line + if i == line_no + selected = #src_lines + if #src_lines >= @height-2 + break + export src_pad + if src_pad + src_pad\erase! + src_pad = Pad(err_pad.height,stack_pad.x+stack_pad.width, + stack_pad.height,SCREEN_W-stack_pad.x-stack_pad.width-0, src_lines, "Source Code", { + highlight: COLORS.RED_BG, + inactive_frame: COLORS.GREEN | C.A_BOLD, + }) + src_pad\select(selected) + stack_index = stack_pad\select(stack_index) if var_names @@ -193,17 +240,25 @@ main_loop = (err_msg, stack_index, var_index, value_index)-> var_y = stack_pad.y + stack_pad.height var_x = 0 - var_names = Pad(var_y,var_x,AUTO,AUTO,_var_names, nil, BLUE) + var_names = Pad(var_y,var_x,math.min(2+#_var_names, SCREEN_H-err_pad.height-stack_pad.height),AUTO,_var_names,"Vars") if var_index and #_var_names > 0 + var_names\set_active(value_index == nil) + stack_pad\set_active(false) + stack_pad\refresh! var_index = var_names\select(var_index) + else + stack_pad\set_active(true) + stack_pad\refresh! value_x = var_names.x+var_names.width value_w = SCREEN_W-(value_x) if value_index - var_values = Pad(var_y,value_x,AUTO,value_w,wrap_text(_var_values[var_index], value_w-2), nil, BLUE) + var_values = Pad(var_y,value_x,var_names.height,value_w,wrap_text(_var_values[var_index], value_w-2), "Values") + var_values\set_active(true) value_index = var_values\select(value_index) else - var_values = Pad(var_y,value_x,AUTO,value_w,_var_values, nil, BLUE) + var_values = Pad(var_y,value_x,var_names.height,value_w,_var_values, "Values") + var_values\set_active(false) while true C.doupdate! @@ -263,8 +318,8 @@ main_loop = (err_msg, stack_index, var_index, value_index)-> file = stack_locations[stack_pad.selected] filename,line_no = file\match("([^:]*):(.*)") -- Launch system editor and then redraw everything + err_pad, stack_pad, src_pad, var_names, var_values = nil, nil, nil, nil, nil C.endwin! - err_pad, stack_pad, var_names, var_values = nil, nil, nil, nil os.execute((os.getenv("EDITOR") or "nano").." +"..line_no.." "..filename) initial_index = stack_pad.selected return main_loop(err_msg,stack_pad.selected,var_index) @@ -272,7 +327,7 @@ main_loop = (err_msg, stack_index, var_index, value_index)-> when ('q')\byte!, ("Q")\byte! break - err_pad, stack_pad, var_names, var_values = nil, nil, nil, nil + err_pad, stack_pad, src_pad, var_names, var_values = nil, nil, nil, nil, nil C.endwin! run_debugger = (err_msg)-> @@ -287,12 +342,25 @@ run_debugger = (err_msg)-> C.start_color! C.use_default_colors! - export REGULAR, INVERTED, HIGHLIGHTED, RED, BLUE - _, REGULAR = C.init_pair(1, -1, -1), C.color_pair(1) - _, INVERTED = C.init_pair(2, -1, C.COLOR_BLACK), C.color_pair(2) - _, HIGHLIGHTED = C.init_pair(3, C.COLOR_BLACK, C.COLOR_YELLOW), C.color_pair(3) - _, RED = C.init_pair(4, C.COLOR_RED, -1), C.color_pair(4) | C.A_BOLD - _, BLUE = C.init_pair(5, C.COLOR_BLUE, -1), C.color_pair(5) | C.A_BOLD + _, COLORS.REGULAR = C.init_pair(1, C.COLOR_WHITE, -1), C.color_pair(1) + _, COLORS.INVERTED = C.init_pair(2, C.COLOR_WHITE, C.COLOR_BLACK), C.color_pair(2) + _, COLORS.YELLOW_BG = C.init_pair(3, C.COLOR_BLACK, C.COLOR_YELLOW), C.color_pair(3) + _, COLORS.RED = C.init_pair(4, C.COLOR_RED, -1), C.color_pair(4) + _, COLORS.BLUE = C.init_pair(5, C.COLOR_BLUE, -1), C.color_pair(5) | C.A_BOLD + _, COLORS.WHITE = C.init_pair(6, C.COLOR_WHITE, -1), C.color_pair(6) + _, COLORS.WHITE_BG = C.init_pair(7, C.COLOR_BLACK, C.COLOR_WHITE), C.color_pair(7) + _, COLORS.BROWN = C.init_pair(8, C.COLOR_BLACK, -1), C.color_pair(8) | C.A_BOLD + _, COLORS.RED_BG = C.init_pair(9, C.COLOR_YELLOW, C.COLOR_RED), C.color_pair(9) | C.A_BOLD | C.A_DIM + _, COLORS.GREEN = C.init_pair(10, C.COLOR_GREEN, -1), C.color_pair(10) + export default_colors + default_colors = { + active_frame: COLORS.BLUE, + inactive_frame: COLORS.BROWN, + odd_row: COLORS.REGULAR, + even_row: COLORS.INVERTED, + highlight: COLORS.WHITE_BG, + active: COLORS.YELLOW_BG, + } stdscr\clear! stdscr\refresh!