diff --git a/app.lua b/app.lua index 87211ef..7099596 100644 --- a/app.lua +++ b/app.lua @@ -169,12 +169,12 @@ function App.screen.check(y, expected_contents, msg) check_eq(contents, expected_contents, msg) end --- If you access the time using App.getTime instead of love.timer.getTime, +-- If you access the time using App.get_time instead of love.timer.getTime, -- tests will be able to move the time back and forwards as needed using -- App.wait_fake_time below. App.time = 1 -function App.getTime() +function App.get_time() return App.time end function App.wait_fake_time(t) @@ -185,16 +185,16 @@ function App.width(text) return love.graphics.getFont():getWidth(text) end --- If you access the clipboard using App.getClipboardText and --- App.setClipboardText instead of love.system.getClipboardText and --- love.system.setClipboardText respectively, tests will be able to manipulate --- the clipboard by reading/writing App.clipboard. +-- If you access the clipboard using App.get_clipboard and App.set_clipboard +-- instead of love.system.getClipboardText and love.system.setClipboardText +-- respectively, tests will be able to manipulate the clipboard by +-- reading/writing App.clipboard. App.clipboard = '' -function App.getClipboardText() +function App.get_clipboard() return App.clipboard end -function App.setClipboardText(s) +function App.set_clipboard(s) App.clipboard = s end @@ -417,9 +417,9 @@ function App.disable_tests() end end end - App.getTime = love.timer.getTime - App.getClipboardText = love.system.getClipboardText - App.setClipboardText = love.system.setClipboardText + App.get_time = love.timer.getTime + App.get_clipboard = love.system.getClipboardText + App.set_clipboard = love.system.setClipboardText App.key_down = love.keyboard.isDown App.mouse_move = love.mouse.setPosition App.mouse_down = love.mouse.isDown diff --git a/edit.lua b/edit.lua index ef1cda4..7c5e4e0 100644 --- a/edit.lua +++ b/edit.lua @@ -459,13 +459,13 @@ function edit.keychord_press(State, chord, key) elseif chord == 'C-c' then local s = Text.selection(State) if s then - App.setClipboardText(s) + App.set_clipboard(s) end elseif chord == 'C-x' then for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scroll local s = Text.cut_selection(State, State.left, State.right) if s then - App.setClipboardText(s) + App.set_clipboard(s) end schedule_save(State) elseif chord == 'C-v' then @@ -474,7 +474,7 @@ function edit.keychord_press(State, chord, key) -- and sometimes scroll when we didn't quite need to. local before_line = State.cursor1.line local before = snapshot(State, before_line) - local clipboard_data = App.getClipboardText() + local clipboard_data = App.get_clipboard() for _,code in utf8.codes(clipboard_data) do local c = utf8.char(code) if c == '\n' then diff --git a/reference.md b/reference.md index 8136ea2..03ebf62 100644 --- a/reference.md +++ b/reference.md @@ -379,15 +379,15 @@ and [the Lua manual](https://www.lua.org/manual/5.1/manual.html#5.7). ### desiderata -* `App.getTime()` -- returns the number of seconds elapsed since some +* `App.get_time()` -- returns the number of seconds elapsed since some unspecified start time. (Based on [LÖVE](https://love2d.org/wiki/love.timer.getTime).) -* `App.getClipboardText()` -- returns a string with the current clipboard +* `App.get_clipboard()` -- returns a string with the current clipboard contents. (Based on [LÖVE](https://love2d.org/wiki/love.system.getClipboardText).) -* `App.setClipboardText(text)` -- stores the string `text` in the clipboard. +* `App.set_clipboard(text)` -- stores the string `text` in the clipboard. (Based on [LÖVE](https://love2d.org/wiki/love.system.setClipboardText).) * `array.find(arr, elem)` -- scan table `arr` for `elem` assuming it's diff --git a/source_edit.lua b/source_edit.lua index 565b989..96bfb12 100644 --- a/source_edit.lua +++ b/source_edit.lua @@ -448,13 +448,13 @@ function edit.keychord_press(State, chord, key) elseif chord == 'C-c' then local s = Text.selection(State) if s then - App.setClipboardText(s) + App.set_clipboard(s) end elseif chord == 'C-x' then for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end -- just in case we scroll local s = Text.cut_selection(State, State.left, State.right) if s then - App.setClipboardText(s) + App.set_clipboard(s) end schedule_save(State) elseif chord == 'C-v' then @@ -463,7 +463,7 @@ function edit.keychord_press(State, chord, key) -- and sometimes scroll when we didn't quite need to. local before_line = State.cursor1.line local before = snapshot(State, before_line) - local clipboard_data = App.getClipboardText() + local clipboard_data = App.get_clipboard() for _,code in utf8.codes(clipboard_data) do local c = utf8.char(code) if c == '\n' then