about summary refs log blame commit diff stats
path: root/053recipe_header.cc
blob: e299d3c0508f1d4b1b11021d28828ea3e682cb32 (plain) (tree)
/span>=1, pos=1} Screen_bottom1 = {} -- delete a character App.run_after_keychord('backspace') check_eq(Cursor1.line, 2, 'F - test_undo_delete_text/baseline/cursor:line') check_eq(Cursor1.pos, 4, 'F - test_undo_delete_text/baseline/cursor:pos') check_nil(Selection1.line, 'F - test_undo_delete_text/baseline/selection:line') check_nil(Selection1.pos, 'F - test_undo_delete_text/baseline/selection:pos') local y = Margin_top App.screen.check(y, 'abc', 'F - test_undo_delete_text/baseline/screen:1') y = y + Line_height App.screen.check(y, 'def', 'F - test_undo_delete_text/baseline/screen:2') y = y + Line_height App.screen.check(y, 'xyz', 'F - test_undo_delete_text/baseline/screen:3') -- undo --? -- after undo, the backspaced key is selected App.run_after_keychord('C-z') check_eq(Cursor1.line, 2, 'F - test_undo_delete_text/cursor:line') check_eq(Cursor1.pos, 5, 'F - test_undo_delete_text/cursor:pos') check_nil(Selection1.line, 'F - test_undo_delete_text/selection:line') check_nil(Selection1.pos, 'F - test_undo_delete_text/selection:pos') --? check_eq(Selection1.line, 2, 'F - test_undo_delete_text/selection:line') --? check_eq(Selection1.pos, 4, 'F - test_undo_delete_text/selection:pos') y = Margin_top App.screen.check(y, 'abc', 'F - test_undo_delete_text/screen:1') y = y + Line_height App.screen.check(y, 'defg', 'F - test_undo_delete_text/screen:2') y = y + Line_height App.screen.check(y, 'xyz', 'F - test_undo_delete_text/screen:3') end function test_undo_restores_selection() io.write('\ntest_undo_restores_selection') -- display a line of text with some part selected App.screen.init{width=80, height=80} Lines = load_array{'abc'} Line_width = 75 Cursor1 = {line=1, pos=1} Selection1 = {line=1, pos=2} Screen_top1 = {line=1, pos=1} Screen_bottom1 = {} App.draw() -- delete selected text App.run_after_textinput('x') check_eq(Lines[1].data, 'xbc', 'F - test_undo_restores_selection/baseline') check_nil(Selection1.line, 'F - test_undo_restores_selection/baseline:selection') -- undo App.run_after_keychord('C-z') -- selection is restored check_eq(Selection1.line, 1, 'F - test_undo_restores_selection/line') check_eq(Selection1.pos, 2, 'F - test_undo_restores_selection/pos') end