about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-08-30 06:43:01 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-08-30 06:44:54 -0700
commit7e97a2a1e7564c410236c012d7a6c4b0f141484d (patch)
tree20616ce5d79e2b69076ef16b3b3502e649e5c07c
parentca4ad8a9e50b62999566a211babc324b5a846feb (diff)
downloadtext.love-7e97a2a1e7564c410236c012d7a6c4b0f141484d.tar.gz
make a few names consistent with snake_case
-rw-r--r--app.lua22
-rw-r--r--edit.lua6
-rw-r--r--reference.md6
-rw-r--r--source_edit.lua6
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
ref='#n403'>403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611