hide editor cursor while in file navigator

This commit is contained in:
Kartik K. Agaram 2022-09-18 01:32:23 -07:00
parent 936d3b4616
commit 141d41aec5
3 changed files with 6 additions and 6 deletions

View File

@ -222,7 +222,7 @@ function source.switch_to_file(filename)
end end
function source.draw() function source.draw()
edit.draw(Editor_state) edit.draw(Editor_state, --[[hide cursor?]] Show_file_navigator)
if Show_log_browser_side then if Show_log_browser_side then
-- divider -- divider
App.color(Divider_color) App.color(Divider_color)

View File

@ -124,7 +124,7 @@ function edit.fixup_cursor(State)
end end
end end
function edit.draw(State) function edit.draw(State, hide_cursor)
State.button_handlers = {} State.button_handlers = {}
App.color(Text_color) App.color(Text_color)
if #State.lines ~= #State.line_cache then if #State.lines ~= #State.line_cache then
@ -170,7 +170,7 @@ function edit.draw(State)
end, end,
}) })
end end
y, State.screen_bottom1.pos, State.screen_bottom1.posB = Text.draw(State, line_index, y, startpos, startposB) y, State.screen_bottom1.pos, State.screen_bottom1.posB = Text.draw(State, line_index, y, startpos, startposB, hide_cursor)
y = y + State.line_height y = y + State.line_height
--? print('=> y', y) --? print('=> y', y)
elseif line.mode == 'drawing' then elseif line.mode == 'drawing' then

View File

@ -4,7 +4,7 @@ AB_padding = 20 -- space in pixels between A side and B side
-- draw a line starting from startpos to screen at y between State.left and State.right -- draw a line starting from startpos to screen at y between State.left and State.right
-- return the final y, and pos,posB of start of final screen line drawn -- return the final y, and pos,posB of start of final screen line drawn
function Text.draw(State, line_index, y, startpos, startposB) function Text.draw(State, line_index, y, startpos, startposB, hide_cursor)
local line = State.lines[line_index] local line = State.lines[line_index]
local line_cache = State.line_cache[line_index] local line_cache = State.line_cache[line_index]
line_cache.starty = y line_cache.starty = y
@ -18,7 +18,7 @@ function Text.draw(State, line_index, y, startpos, startposB)
return y, screen_line_starting_pos return y, screen_line_starting_pos
end end
if Focus == 'edit' and State.cursor1.pos then if Focus == 'edit' and State.cursor1.pos then
if State.search_term == nil then if not hide_cursor and not State.search_term then
if line_index == State.cursor1.line and State.cursor1.pos == pos then if line_index == State.cursor1.line and State.cursor1.pos == pos then
Text.draw_cursor(State, x, y) Text.draw_cursor(State, x, y)
end end
@ -64,7 +64,7 @@ function Text.draw(State, line_index, y, startpos, startposB)
--? if line_index == 8 then print('a') end --? if line_index == 8 then print('a') end
if Focus == 'edit' and State.cursor1.posB then if Focus == 'edit' and State.cursor1.posB then
--? if line_index == 8 then print('b') end --? if line_index == 8 then print('b') end
if State.search_term == nil then if not hide_cursor and not State.search_term then
--? if line_index == 8 then print('c', State.cursor1.line, State.cursor1.posB, line_index, pos) end --? if line_index == 8 then print('c', State.cursor1.line, State.cursor1.posB, line_index, pos) end
if line_index == State.cursor1.line and State.cursor1.posB == pos then if line_index == State.cursor1.line and State.cursor1.posB == pos then
Text.draw_cursor(State, x, y) Text.draw_cursor(State, x, y)