bugfix: delete selection before pasting
[?]
Jun 21, 2022, 4:53 PM
KMRJOSLYYHHPGMYXBSLUQTICP6F4LXRCGYSP55YTZQSX4SZISDEACDependencies
- [2]
AOIRVVJArevert selection logic to before commit 3ffc2ed8f - [3]
AVLAYODPmuch simpler - [4]
XDB5D7H7some early returns should be asserts - [5]
VJ77YABHmore efficient undo/redo - [6]
DRFE3B3Zmouse buttons are integers, not strings - [*]
LXTTOB33extract a couple of files - [*]
4WAFGF4Zselection bugfix - [*]
VG75U7IMbugfix: typing should delete highlighted text - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
OTIBCAUJlove2d scaffold - [*]
AVTNUQYRbasic test-enabled framework - [*]
Z4XRNDTRfind text
Change contents
- edit in text_tests.lua at line 262
endfunction test_cut()io.write('\ntest_cut')-- display a line of text with some part selectedApp.screen.init{width=80, height=80}Lines = load_array{'abc'}Line_width = 75Cursor1 = {line=1, pos=1}Selection1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}App.draw()-- press a keyApp.run_after_keychord('C-x')check_eq(App.clipboard, 'a', 'F - test_cut/clipboard')-- selected text is deletedcheck_eq(Lines[1].data, 'bc', 'F - test_cut/data')endfunction test_paste_replaces_selection()io.write('\ntest_paste_replaces_selection')-- display a line of text with a selectionApp.screen.init{width=80, height=80}Lines = load_array{'abc', 'def'}Line_width = 75Cursor1 = {line=2, pos=1}Selection1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}App.draw()-- set clipboardApp.clipboard = 'xyz'-- paste selectionApp.run_after_keychord('C-v')-- selection is reset since shift key is not pressed-- selection includes the newline, so it's also deletedcheck_eq(Lines[1].data, 'xyzdef', 'F - test_paste_replaces_selection') - edit in text.lua at line 145
if Selection1.line thenText.delete_selection()end - edit in main.lua at line 413[13.1550][14.3090]
if Selection1.line and not App.shift_down() and chord ~= 'C-c' and chord ~= 'C-x' and chord ~= 'backspace' and backspace ~= 'delete' thenText.delete_selection()end