diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-08-30 06:43:01 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-08-30 06:44:54 -0700 |
commit | 7e97a2a1e7564c410236c012d7a6c4b0f141484d (patch) | |
tree | 20616ce5d79e2b69076ef16b3b3502e649e5c07c | |
parent | ca4ad8a9e50b62999566a211babc324b5a846feb (diff) | |
download | lines.love-7e97a2a1e7564c410236c012d7a6c4b0f141484d.tar.gz |
make a few names consistent with snake_case
-rw-r--r-- | app.lua | 22 | ||||
-rw-r--r-- | edit.lua | 6 | ||||
-rw-r--r-- | reference.md | 6 | ||||
-rw-r--r-- | source_edit.lua | 6 |
4 files changed, 20 insertions, 20 deletions
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 |