bring back syntax highlighting (but so ugly)
This commit is contained in:
parent
279285a726
commit
9b18e35aaa
|
@ -4,7 +4,7 @@ on.draw = function()
|
|||
draw_canvas()
|
||||
if Show_code then
|
||||
draw_editor_border()
|
||||
edit.draw(Current_pane.editor_state, --[[fg]] Foreground_color, --[[hide_cursor]] nil, --[[show_line_numbers]] true)
|
||||
edit.draw(Current_pane.editor_state, --[[implicitly use Foreground_color]] nil, --[[hide_cursor]] nil, --[[show_line_numbers]] true)
|
||||
draw_scrollbar(Current_pane.editor_state)
|
||||
draw_output_border()
|
||||
edit.draw(Current_pane.output_editor_state, Foreground_color, --[[hide cursor]] true)
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
Foreground_color = {r=0, g=0, b=0}
|
||||
-- Foreground_color comes predefined, and we have to be careful
|
||||
-- to use the precise table instance used by colorize.lua
|
||||
--
|
||||
-- This 'definition' is only here to remind us of this global,
|
||||
-- and this gotcha.
|
||||
Foreground_color = Foreground_color
|
||||
|
|
|
@ -31,7 +31,7 @@ String_color = {r=0, g=0.5, b=0.5}
|
|||
Divider_color = {r=0.7, g=0.7, b=0.7}
|
||||
|
||||
Colors = {
|
||||
normal=Text_color,
|
||||
normal=Foreground_color,
|
||||
comment=Comment_color,
|
||||
sstring=String_color,
|
||||
dstring=String_color,
|
||||
|
@ -47,9 +47,13 @@ function initialize_color()
|
|||
end
|
||||
|
||||
function select_color(frag)
|
||||
--? if frag == 'do ' then
|
||||
--? print('before', '^'..frag..'$', Current_state)
|
||||
--? end
|
||||
switch_color_based_on_prefix(frag)
|
||||
--? print('using color', Current_state, Colors[Current_state])
|
||||
--? if frag == 'do ' then
|
||||
--? print('using color', Current_state, Colors[Current_state], Colors[Current_state].r, Colors[Current_state].g, Colors[Current_state].b)
|
||||
--? end
|
||||
App.color(Colors[Current_state])
|
||||
switch_color_based_on_suffix(frag)
|
||||
--? print('state after suffix', Current_state)
|
||||
|
|
3
edit.lua
3
edit.lua
|
@ -1,5 +1,6 @@
|
|||
-- some constants people might like to tweak
|
||||
Text_color = {r=0, g=0, b=0}
|
||||
Text_color = {r=0, g=0, b=0} -- only used in tests
|
||||
Foreground_color = {r=0, g=0, b=0}
|
||||
Cursor_color = {r=1, g=0, b=0}
|
||||
Highlight_color = {r=0.7, g=0.7, b=0.9} -- selected text
|
||||
Line_number_color = {r=0.4, g=0.4, b=0.4}
|
||||
|
|
|
@ -11,7 +11,7 @@ function Text.draw_search_bar(State)
|
|||
love.graphics.rectangle('fill', 20, y-6, App.screen.width-40, h+2, 2,2)
|
||||
love.graphics.setColor(0.6,0.6,0.6)
|
||||
love.graphics.rectangle('line', 20, y-6, App.screen.width-40, h+2, 2,2)
|
||||
App.color(Text_color)
|
||||
App.color(Foreground_color)
|
||||
App.screen.print(State.search_term, 25,y-5)
|
||||
Text.draw_cursor(State, 25+App.width(State.search_term),y-5, Cursor_color)
|
||||
end
|
||||
|
|
|
@ -62,7 +62,7 @@ function Text.draw_highlight(State, line, x,y, pos, lo,hi)
|
|||
local s = line.data:sub(lo_offset, hi_offset-1)
|
||||
App.color(Highlight_color)
|
||||
love.graphics.rectangle('fill', x+lo_px,y, App.width(s),State.line_height)
|
||||
App.color(Text_color)
|
||||
App.color(Foreground_color)
|
||||
return lo_px
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue