about summary refs log tree commit diff stats
path: root/text_tests.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-30 19:50:27 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-30 19:50:27 -0700
commit8c7bea8f7615f34425742381aea21cd4991f97da (patch)
tree07edb04e1534f758199e44c9e3c5a6fbb9fefaef /text_tests.lua
parent08a50b7fff71324897eeb31a0d323d3444ef105b (diff)
downloadlines.love-8c7bea8f7615f34425742381aea21cd4991f97da.tar.gz
rip out notion of Line_width
Diffstat (limited to 'text_tests.lua')
-rw-r--r--text_tests.lua101
1 files changed, 17 insertions, 84 deletions
diff --git a/text_tests.lua b/text_tests.lua
index 5c21038..b16012f 100644
--- a/text_tests.lua
+++ b/text_tests.lua
@@ -51,7 +51,6 @@ function test_press_ctrl()
   -- press ctrl while the cursor is on text
   App.screen.init{width=50, height=80}
   Lines = load_array{''}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -63,7 +62,6 @@ function test_click_with_mouse()
   -- display two lines with cursor on one of them
   App.screen.init{width=50, height=80}
   Lines = load_array{'abc', 'def'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -78,7 +76,6 @@ function test_draw_text()
   io.write('\ntest_draw_text')
   App.screen.init{width=120, height=60}
   Lines = load_array{'abc', 'def', 'ghi'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -95,7 +92,6 @@ function test_draw_wrapping_text()
   io.write('\ntest_draw_wrapping_text')
   App.screen.init{width=50, height=60}
   Lines = load_array{'abc', 'defgh', 'xyz'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -112,7 +108,6 @@ function test_draw_word_wrapping_text()
   io.write('\ntest_draw_word_wrapping_text')
   App.screen.init{width=60, height=60}
   Lines = load_array{'abc def ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -130,7 +125,6 @@ function test_draw_text_wrapping_within_word()
   io.write('\ntest_draw_text_wrapping_within_word')
   App.screen.init{width=60, height=60}
   Lines = load_array{'abcd e fghijk', 'xyz'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -148,7 +142,6 @@ function test_draw_wrapping_text_containing_non_ascii()
   io.write('\ntest_draw_wrapping_text_containing_non_ascii')
   App.screen.init{width=60, height=60}
   Lines = load_array{'madam I’m adam', 'xyz'}  -- notice the non-ASCII apostrophe
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -164,10 +157,9 @@ end
 function test_click_on_wrapping_line()
   io.write('\ntest_click_on_wrapping_line')
   -- display a wrapping line
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, height=80}
                   --  12345678901234
   Lines = load_array{"madam I'm adam"}
-  Line_width = 75
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -187,10 +179,9 @@ end
 function test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen()
   io.write('\ntest_click_on_wrapping_line_rendered_from_partway_at_top_of_screen')
   -- display a wrapping line from its second screen line
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, height=80}
                   --  12345678901234
   Lines = load_array{"madam I'm adam"}
-  Line_width = 75
   Cursor1 = {line=1, pos=8}
   Screen_top1 = {line=1, pos=7}
   Screen_bottom1 = {}
@@ -208,10 +199,9 @@ end
 function test_click_past_end_of_wrapping_line()
   io.write('\ntest_click_past_end_of_wrapping_line')
   -- display a wrapping line
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, height=80}
                   --  12345678901234
   Lines = load_array{"madam I'm adam"}
-  Line_width = 75
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -232,10 +222,9 @@ end
 function test_click_on_wrapping_line_containing_non_ascii()
   io.write('\ntest_click_on_wrapping_line_containing_non_ascii')
   -- display a wrapping line containing non-ASCII
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, height=80}
                   --  12345678901234
   Lines = load_array{'madam I’m adam'}  -- notice the non-ASCII apostrophe
-  Line_width = 75
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -256,11 +245,10 @@ end
 function test_click_past_end_of_word_wrapping_line()
   io.write('\ntest_click_past_end_of_word_wrapping_line')
   -- display a long line wrapping at a word boundary on a screen of more realistic length
-  App.screen.init{width=200, height=80}
+  App.screen.init{width=160, height=80}
                    -- 0        1         2
                    -- 123456789012345678901
   Lines = load_array{'the quick brown fox jumped over the lazy dog'}
-  Line_width = 160
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -268,8 +256,8 @@ function test_click_past_end_of_word_wrapping_line()
   local y = Margin_top
   App.screen.check(y, 'the quick brown fox ', 'F - test_click_past_end_of_word_wrapping_line/baseline/screen:1')
   y = y + Line_height
-  -- click past the end of the screen line but within Line_width
-  App.run_after_mouse_click(Line_width-2,y-2, 1)
+  -- click past the end of the screen line
+  App.run_after_mouse_click(App.screen.width-2,y-2, 1)
   -- cursor moves to end of screen line
   check_eq(Cursor1.pos, 20, 'F - test_click_past_end_of_word_wrapping_line/cursor')
 end
@@ -277,9 +265,8 @@ end
 function test_select_text()
   io.write('\ntest_select_text')
   -- display a line of text
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, height=80}
   Lines = load_array{'abc def'}
-  Line_width = 75
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -299,9 +286,8 @@ end
 function test_cursor_movement_without_shift_resets_selection()
   io.write('\ntest_cursor_movement_without_shift_resets_selection')
   -- display a line of text with some part selected
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, 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}
@@ -317,9 +303,8 @@ end
 function test_edit_after_click_resets_selection()
   io.write('\ntest_edit_after_click_resets_selection')
   -- display a line of text
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, height=80}
   Lines = load_array{'abc'}
-  Line_width = 75
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -335,9 +320,8 @@ end
 function test_edit_deletes_selection()
   io.write('\ntest_edit_deletes_selection')
   -- display a line of text with some part selected
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, 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}
@@ -352,9 +336,8 @@ end
 function test_edit_with_shift_key_deletes_selection()
   io.write('\ntest_edit_with_shift_key_deletes_selection')
   -- display a line of text with some part selected
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, 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}
@@ -374,9 +357,8 @@ end
 function test_copy_does_not_reset_selection()
   io.write('\ntest_copy_does_not_reset_selection')
   -- display a line of text with a selection
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, 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}
@@ -392,9 +374,8 @@ end
 function test_cut()
   io.write('\ntest_cut')
   -- display a line of text with some part selected
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, 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}
@@ -410,9 +391,8 @@ end
 function test_paste_replaces_selection()
   io.write('\ntest_paste_replaces_selection')
   -- display a line of text with a selection
-  App.screen.init{width=80, height=80}
+  App.screen.init{width=75, height=80}
   Lines = load_array{'abc', 'def'}
-  Line_width = 75
   Cursor1 = {line=2, pos=1}
   Selection1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
@@ -432,7 +412,6 @@ function test_deleting_selection_may_scroll()
   -- display lines 2/3/4
   App.screen.init{width=120, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=3, pos=2}
   Screen_top1 = {line=2, pos=1}
   Screen_bottom1 = {}
@@ -456,7 +435,6 @@ function test_edit_wrapping_text()
   io.write('\ntest_edit_wrapping_text')
   App.screen.init{width=50, height=60}
   Lines = load_array{'abc', 'def', 'xyz'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=4}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -478,7 +456,6 @@ function test_insert_newline()
   -- display a few lines
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=2}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -507,7 +484,6 @@ function test_insert_newline_at_start_of_line()
   -- display a line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -524,7 +500,6 @@ function test_insert_from_clipboard()
   -- display a few lines
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=2}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -553,7 +528,6 @@ function test_move_cursor_using_mouse()
   io.write('\ntest_move_cursor_using_mouse')
   App.screen.init{width=50, height=60}
   Lines = load_array{'abc', 'def', 'xyz'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -570,7 +544,6 @@ function test_select_text_using_mouse()
   io.write('\ntest_select_text_using_mouse')
   App.screen.init{width=50, height=60}
   Lines = load_array{'abc', 'def', 'xyz'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -590,7 +563,6 @@ function test_select_text_using_mouse_and_shift()
   io.write('\ntest_select_text_using_mouse_and_shift')
   App.screen.init{width=50, height=60}
   Lines = load_array{'abc', 'def', 'xyz'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -614,7 +586,6 @@ function test_select_text_repeatedly_using_mouse_and_shift()
   io.write('\ntest_select_text_repeatedly_using_mouse_and_shift')
   App.screen.init{width=50, height=60}
   Lines = load_array{'abc', 'def', 'xyz'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -644,7 +615,6 @@ function test_cut_without_selection()
   -- display a few lines
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=2}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -660,7 +630,6 @@ function test_pagedown()
   io.write('\ntest_pagedown')
   App.screen.init{width=120, height=45}
   Lines = load_array{'abc', 'def', 'ghi'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -690,7 +659,6 @@ function test_pagedown_skips_drawings()
                      'def',               -- height 15
                      'ghi'}               -- height 15
   check_eq(Lines[2].mode, 'drawing', 'F - test_pagedown_skips_drawings/baseline/lines')
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -714,7 +682,6 @@ function test_pagedown_often_shows_start_of_wrapping_line()
   -- draw a few lines ending in part of a wrapping line
   App.screen.init{width=50, height=60}
   Lines = load_array{'abc', 'def ghi jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -744,7 +711,6 @@ function test_pagedown_can_start_from_middle_of_long_wrapping_line()
   -- draw a few lines starting from a very long wrapping line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc def ghi jkl mno pqr stu vwx yza bcd efg hij', 'XYZ'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=2}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -771,7 +737,6 @@ function test_down_arrow_moves_cursor()
   io.write('\ntest_down_arrow_moves_cursor')
   App.screen.init{width=120, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -801,7 +766,6 @@ function test_down_arrow_scrolls_down_by_one_line()
   -- display the first three lines with the cursor on the bottom line
   App.screen.init{width=120, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=3, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -829,7 +793,6 @@ function test_down_arrow_scrolls_down_by_one_screen_line()
   -- display the first three lines with the cursor on the bottom line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=3, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -858,7 +821,6 @@ function test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_
   -- display the first three lines with the cursor on the bottom line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghijkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=3, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -886,7 +848,6 @@ function test_page_down_followed_by_down_arrow_does_not_scroll_screen_up()
   io.write('\ntest_page_down_followed_by_down_arrow_does_not_scroll_screen_up')
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghijkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=3, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -920,7 +881,6 @@ function test_up_arrow_moves_cursor()
   -- display the first 3 lines with the cursor on the bottom line
   App.screen.init{width=120, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = 120
   Cursor1 = {line=3, pos=1}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -949,7 +909,6 @@ function test_up_arrow_scrolls_up_by_one_line()
   -- display the lines 2/3/4 with the cursor on line 2
   App.screen.init{width=120, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = 120
   Cursor1 = {line=2, pos=1}
   Screen_top1 = {line=2, pos=1}
   Screen_bottom1 = {}
@@ -977,7 +936,6 @@ function test_up_arrow_scrolls_up_by_one_screen_line()
   -- display lines starting from second screen line of a line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=3, pos=6}
   Screen_top1 = {line=3, pos=5}
   Screen_bottom1 = {}
@@ -1005,7 +963,6 @@ function test_up_arrow_scrolls_up_to_final_screen_line()
   -- display lines starting just after a long line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc def', 'ghi', 'jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=1}
   Screen_top1 = {line=2, pos=1}
   Screen_bottom1 = {}
@@ -1035,7 +992,6 @@ function test_up_arrow_scrolls_up_to_empty_line()
   -- display a screenful of text with an empty line just above it outside the screen
   App.screen.init{width=120, height=60}
   Lines = load_array{'', 'abc', 'def', 'ghi', 'jkl'}
-  Line_width = 120
   Cursor1 = {line=2, pos=1}
   Screen_top1 = {line=2, pos=1}
   Screen_bottom1 = {}
@@ -1062,7 +1018,6 @@ function test_pageup()
   io.write('\ntest_pageup')
   App.screen.init{width=120, height=45}
   Lines = load_array{'abc', 'def', 'ghi'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=1}
   Screen_top1 = {line=2, pos=1}
   Screen_bottom1 = {}
@@ -1087,7 +1042,6 @@ function test_pageup_scrolls_up_by_screen_line()
   -- display the first three lines with the cursor on the bottom line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc def', 'ghi', 'jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=1}
   Screen_top1 = {line=2, pos=1}
   Screen_bottom1 = {}
@@ -1116,7 +1070,6 @@ function test_pageup_scrolls_up_from_middle_screen_line()
   -- display a few lines starting from the middle of a line (Cursor1.pos > 1)
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc def', 'ghi jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=5}
   Screen_top1 = {line=2, pos=5}
   Screen_bottom1 = {}
@@ -1143,7 +1096,6 @@ function test_enter_on_bottom_line_scrolls_down()
   -- display a few lines with cursor on bottom line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=3, pos=2}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -1172,7 +1124,6 @@ function test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom()
   -- display just the bottom line on screen
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=4, pos=2}
   Screen_top1 = {line=4, pos=1}
   Screen_bottom1 = {}
@@ -1195,7 +1146,6 @@ function test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bot
   -- display just an empty bottom line on screen
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', ''}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=1}
   Screen_top1 = {line=2, pos=1}
   Screen_bottom1 = {}
@@ -1214,7 +1164,6 @@ function test_typing_on_bottom_line_scrolls_down()
   -- display a few lines with cursor on bottom line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = App.screen.width
   Cursor1 = {line=3, pos=4}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -1245,7 +1194,6 @@ function test_left_arrow_scrolls_up_in_wrapped_line()
   -- display lines starting from second screen line of a line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
-  Line_width = App.screen.width
   Screen_top1 = {line=3, pos=5}
   Screen_bottom1 = {}
   -- cursor is at top of screen
@@ -1274,7 +1222,6 @@ function test_right_arrow_scrolls_down_in_wrapped_line()
   -- display the first three lines with the cursor on the bottom line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
-  Line_width = App.screen.width
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
   -- cursor is at bottom right of screen
@@ -1304,7 +1251,6 @@ function test_home_scrolls_up_in_wrapped_line()
   -- display lines starting from second screen line of a line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
-  Line_width = App.screen.width
   Screen_top1 = {line=3, pos=5}
   Screen_bottom1 = {}
   -- cursor is at top of screen
@@ -1333,7 +1279,6 @@ function test_end_scrolls_down_in_wrapped_line()
   -- display the first three lines with the cursor on the bottom line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
-  Line_width = App.screen.width
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
   -- cursor is at bottom right of screen
@@ -1361,9 +1306,8 @@ end
 function test_position_cursor_on_recently_edited_wrapping_line()
   -- draw a line wrapping over 2 screen lines
   io.write('\ntest_position_cursor_on_recently_edited_wrapping_line')
-  App.screen.init{width=120, height=200}
+  App.screen.init{width=100, height=200}
   Lines = load_array{'abc def ghi jkl mno pqr ', 'xyz'}
-  Line_width = 100
   Cursor1 = {line=1, pos=25}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -1397,7 +1341,6 @@ function test_backspace_can_scroll_up()
   -- display the lines 2/3/4 with the cursor on line 2
   App.screen.init{width=120, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
-  Line_width = 120
   Cursor1 = {line=2, pos=1}
   Screen_top1 = {line=2, pos=1}
   Screen_bottom1 = {}
@@ -1425,7 +1368,6 @@ function test_backspace_can_scroll_up_screen_line()
   -- display lines starting from second screen line of a line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=3, pos=5}
   Screen_top1 = {line=3, pos=5}
   Screen_bottom1 = {}
@@ -1453,7 +1395,6 @@ function test_backspace_past_line_boundary()
   -- position cursor at start of a (non-first) line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=1}
   -- backspace joins with previous line
   App.run_after_keychord('backspace')
@@ -1468,7 +1409,6 @@ function test_backspace_over_selection()
   -- select just one character within a line with cursor before selection
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=1}
   Selection1 = {line=1, pos=2}
   -- backspace deletes the selected character, even though it's after the cursor
@@ -1486,7 +1426,6 @@ function test_backspace_over_selection_reverse()
   -- select just one character within a line with cursor after selection
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=2}
   Selection1 = {line=1, pos=1}
   -- backspace deletes the selected character
@@ -1504,7 +1443,6 @@ function test_backspace_over_multiple_lines()
   -- select just one character within a line with cursor after selection
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=2}
   Selection1 = {line=4, pos=2}
   -- backspace deletes the region and joins the remaining portions of lines on either side
@@ -1523,7 +1461,6 @@ function test_backspace_to_end_of_line()
   -- select region from cursor to end of line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=1, pos=2}
   Selection1 = {line=1, pos=4}
   -- backspace deletes rest of line without joining to any other line
@@ -1542,7 +1479,6 @@ function test_backspace_to_start_of_line()
   -- select region from cursor to start of line
   App.screen.init{width=Margin_left+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=1}
   Selection1 = {line=2, pos=3}
   -- backspace deletes beginning of line without joining to any other line
@@ -1560,7 +1496,6 @@ function test_undo_insert_text()
   io.write('\ntest_undo_insert_text')
   App.screen.init{width=120, height=60}
   Lines = load_array{'abc', 'def', 'xyz'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=4}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -1595,7 +1530,6 @@ function test_undo_delete_text()
   io.write('\ntest_undo_delete_text')
   App.screen.init{width=120, height=60}
   Lines = load_array{'abc', 'defg', 'xyz'}
-  Line_width = App.screen.width
   Cursor1 = {line=2, pos=5}
   Screen_top1 = {line=1, pos=1}
   Screen_bottom1 = {}
@@ -1631,9 +1565,8 @@ 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}
+  App.screen.init{width=75, 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}