diff --git a/0004-on.update b/0004-on.update index 906606e..3b63632 100644 --- a/0004-on.update +++ b/0004-on.update @@ -12,8 +12,8 @@ on.update = function(dt) -- == main area if Current_pane.editor_state.scrollbar_drag then adjust_scrollbar(Current_pane.editor_state, App.mouse_y()) - elseif Current_pane.output_editor_state.scrollbar_drag then - adjust_scrollbar(Current_pane.output_editor_state, App.mouse_y()) + elseif Output_editor_state.scrollbar_drag then + adjust_scrollbar(Output_editor_state, App.mouse_y()) end end end \ No newline at end of file diff --git a/0011-on.initialize b/0011-on.initialize index 1b83088..d0222b2 100644 --- a/0011-on.initialize +++ b/0011-on.initialize @@ -19,5 +19,6 @@ on.initialize = function() Current_pane_index = 1 Current_pane = Panes[Current_pane_index] end + Output_editor_state = output_editor_state(Current_pane.editor_state) run_app() end \ No newline at end of file diff --git a/0012-on.draw b/0012-on.draw index c14ebc5..101c2d9 100644 --- a/0012-on.draw +++ b/0012-on.draw @@ -21,8 +21,8 @@ on.draw = function() draw_scrollbar(Current_pane.editor_state) -- output draw_output_border() - edit.draw(Current_pane.output_editor_state, Foreground_color, --[[hide cursor]] true) - draw_scrollbar(Current_pane.output_editor_state) + edit.draw(Output_editor_state, Foreground_color, --[[hide cursor]] true) + draw_scrollbar(Output_editor_state) -- menu and debug UI draw_menu() draw_next_frames_of_animations() diff --git a/0016-on.mouse_press b/0016-on.mouse_press index f4ed8fc..0461de2 100644 --- a/0016-on.mouse_press +++ b/0016-on.mouse_press @@ -40,11 +40,11 @@ on.mouse_press = function(x,y, mouse_button) elseif x < Current_pane.editor_state.right + 15 - 5 and y < Current_pane.editor_state.bottom + 5 + 10 - 5 then love.keyboard.setTextInput(true) edit.mouse_press(Current_pane.editor_state, x,y, mouse_button) - elseif on_editor_scrollbar(Current_pane.output_editor_state, x,y) then - Current_pane.output_editor_state.scrollbar_drag = true - local sbtopy = compute_scrollbar_topy(Current_pane.output_editor_state) - Current_pane.output_editor_state.scrollbar_offset = y - sbtopy - elseif on_editor_scrollbar_area(Current_pane.output_editor_state, x,y) then + elseif on_editor_scrollbar(Output_editor_state, x,y) then + Output_editor_state.scrollbar_drag = true + local sbtopy = compute_scrollbar_topy(Output_editor_state) + Output_editor_state.scrollbar_offset = y - sbtopy + elseif on_editor_scrollbar_area(Output_editor_state, x,y) then -- nothing end end diff --git a/0017-on.mouse_release b/0017-on.mouse_release index 8fa4da7..e6648a0 100644 --- a/0017-on.mouse_release +++ b/0017-on.mouse_release @@ -28,12 +28,12 @@ on.mouse_release = function(x,y, mouse_button) adjust_scrollbar(Current_pane.editor_state, y) elseif x < Current_pane.editor_state.right + 15 - 5 and y < Current_pane.editor_state.bottom + 5 + 10 - 5 then edit.mouse_release(Current_pane.editor_state, x,y, mouse_button) - elseif Current_pane.output_editor_state.scrollbar_drag then - adjust_scrollbar(Current_pane.output_editor_state, y) - Current_pane.output_editor_state.scrollbar_drag = nil - Current_pane.output_editor_state.scrollbar_offset = nil - elseif on_editor_scrollbar_area(Current_pane.output_editor_state, x,y) then - adjust_scrollbar(Current_pane.output_editor_state, y) + elseif Output_editor_state.scrollbar_drag then + adjust_scrollbar(Output_editor_state, y) + Output_editor_state.scrollbar_drag = nil + Output_editor_state.scrollbar_offset = nil + elseif on_editor_scrollbar_area(Output_editor_state, x,y) then + adjust_scrollbar(Output_editor_state, y) end end end \ No newline at end of file diff --git a/0032-update_font_settings b/0032-update_font_settings index 3963073..6e64bf6 100644 --- a/0032-update_font_settings +++ b/0032-update_font_settings @@ -16,7 +16,7 @@ update_font_settings = function(font_height) pane.editor_state.width = pane.editor_state.right - pane.editor_state.left edit.update_font_settings(pane.editor_state, Font_height) Text.redraw_all(pane.editor_state) - edit.update_font_settings(pane.output_editor_state, Font_height) - update_output_editor(pane) end + edit.update_font_settings(Output_editor_state, Font_height) + update_output_editor() end \ No newline at end of file diff --git a/0045-Current_pane b/0045-Current_pane index 9309e75..ad68e14 100644 --- a/0045-Current_pane +++ b/0045-Current_pane @@ -1,4 +1,3 @@ Current_pane = { editor_state = nil, - output_editor_state = nil, } \ No newline at end of file diff --git a/0049-new_pane b/0049-new_pane index fa5d7d0..d00a1a3 100644 --- a/0049-new_pane +++ b/0049-new_pane @@ -1,6 +1,3 @@ new_pane = function() - local result = {} - result.editor_state = code_editor_state() - result.output_editor_state = output_editor_state(result.editor_state) - return result + return {editor_state = code_editor_state()} end \ No newline at end of file diff --git a/0050-print_to_output b/0050-print_to_output index 27999ca..b4a524b 100644 --- a/0050-print_to_output +++ b/0050-print_to_output @@ -1,6 +1,6 @@ print_to_output = function(...) local line = table.concat(map({...}, tostring), ' ') - table.insert(Current_pane.output_editor_state.lines, + table.insert(Output_editor_state.lines, {data=line}) - Text.redraw_all(Current_pane.output_editor_state) + Text.redraw_all(Output_editor_state) end \ No newline at end of file diff --git a/0074-clear_pane_button b/0074-clear_pane_button deleted file mode 100644 index f986484..0000000 --- a/0074-clear_pane_button +++ /dev/null @@ -1,7 +0,0 @@ -clear_pane_button = function(x, y, r) - return overflowable_button('clear', x, y, r, - function() - Show_menu = nil - clear_pane() - end) -end diff --git a/0075-clear_pane b/0075-clear_pane deleted file mode 100644 index c4b63e8..0000000 --- a/0075-clear_pane +++ /dev/null @@ -1,4 +0,0 @@ -clear_pane = function() - edit.clear(Current_pane.editor_state) - edit.clear(Current_pane.output_editor_state) -end \ No newline at end of file diff --git a/0101-on.mouse_wheel_move b/0101-on.mouse_wheel_move index 65b8efb..49632ac 100644 --- a/0101-on.mouse_wheel_move +++ b/0101-on.mouse_wheel_move @@ -10,7 +10,7 @@ on.mouse_wheel_move = function(dx,dy) if App.mouse_y() < Current_pane.editor_state.bottom then edit.mouse_wheel_move(Current_pane.editor_state, dx,dy) else - edit.mouse_wheel_move(Current_pane.output_editor_state, dx,dy) + edit.mouse_wheel_move(Output_editor_state, dx,dy) end end end \ No newline at end of file diff --git a/0102-send_errors_to_output b/0102-send_errors_to_output index 9ae5723..b0b55b1 100644 --- a/0102-send_errors_to_output +++ b/0102-send_errors_to_output @@ -1,9 +1,9 @@ send_errors_to_output = function(err) local callstack = debug.traceback('', 3) local error_with_callstack = cleaned_up_frame(tostring(err))..'\n'..cleaned_up_callstack(callstack) - table.insert(Current_pane.output_editor_state.lines, {data=''}) - Current_pane.output_editor_state.cursor1 = {line=#Current_pane.output_editor_state.lines, pos=1} - Text.redraw_all(Current_pane.output_editor_state) - Text.insert_text(Current_pane.output_editor_state, error_with_callstack) + table.insert(Output_editor_state.lines, {data=''}) + Output_editor_state.cursor1 = {line=#Output_editor_state.lines, pos=1} + Text.redraw_all(Output_editor_state) + Text.insert_text(Output_editor_state, error_with_callstack) stop_app() end \ No newline at end of file diff --git a/0114-update_output_editor b/0114-update_output_editor index ed18160..1ba839b 100644 --- a/0114-update_output_editor +++ b/0114-update_output_editor @@ -1,7 +1,7 @@ -update_output_editor = function(pane) - pane.output_editor_state.top = pane.editor_state.bottom+5+10+5 - pane.output_editor_state.right = pane.editor_state.right - pane.output_editor_state.width = pane.editor_state.width - pane.output_editor_state.bottom = Safe_height - 5 - Text.redraw_all(pane.output_editor_state) +update_output_editor = function() + Output_editor_state.top = Current_pane.editor_state.bottom+5+10+5 + Output_editor_state.right = Current_pane.editor_state.right + Output_editor_state.width = Current_pane.editor_state.width + Output_editor_state.bottom = Safe_height - 5 + Text.redraw_all(Output_editor_state) end \ No newline at end of file diff --git a/0160-run_app b/0160-run_app index a5ad6d6..22f96ac 100644 --- a/0160-run_app +++ b/0160-run_app @@ -1,7 +1,7 @@ run_app = function() -- ## run: initialize clear_handlers() - edit.clear(Current_pane.output_editor_state) + edit.clear(Output_editor_state) print = print_to_output -- ## run local error = eval_all() @@ -11,11 +11,10 @@ run_app = function() else print = Real_print clear_handlers() - -- could be either output or error - table.insert(Current_pane.output_editor_state.lines, {data=tostring(error)}) + table.insert(Output_editor_state.lines, {data=tostring(error)}) end - if #Current_pane.output_editor_state.lines == 0 then - table.insert(Current_pane.output_editor_state.lines, {data=''}) + if #Output_editor_state.lines == 0 then + table.insert(Output_editor_state.lines, {data=''}) end - Text.redraw_all(Current_pane.output_editor_state) + Text.redraw_all(Output_editor_state) end \ No newline at end of file diff --git a/0162-Output_editor_state b/0162-Output_editor_state new file mode 100644 index 0000000..086086c --- /dev/null +++ b/0162-Output_editor_state @@ -0,0 +1 @@ +Output_editor_state = nil \ No newline at end of file