make a few names consistent with snake_case
This commit is contained in:
parent
ca4ad8a9e5
commit
7e97a2a1e7
22
app.lua
22
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
|
||||
|
|
6
edit.lua
6
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue