Improve quick prompt appearance

This commit is contained in:
Anthony Sottile
2020-03-19 20:37:39 -07:00
parent efa6561200
commit b2ebfa7b48
4 changed files with 54 additions and 29 deletions

View File

@@ -37,7 +37,7 @@ def test_replace_actual_contents(run, ten_lines):
h.press_and_enter('line_0')
h.await_text('replace with:')
h.press_and_enter('ohai')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('y')
h.await_text_missing('line_0')
h.await_text('ohai')
@@ -59,7 +59,7 @@ match me!
h.press_and_enter('me!')
h.await_text('replace with:')
h.press_and_enter('youuuu')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('y')
h.await_cursor_position(x=6, y=3)
h.press('Up')
@@ -74,7 +74,7 @@ def test_replace_cancel_at_individual_replace(run, ten_lines):
h.press_and_enter(r'line_\d')
h.await_text('replace with:')
h.press_and_enter('ohai')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('^C')
h.await_text('cancelled')
@@ -86,7 +86,7 @@ def test_replace_unknown_characters_at_individual_replace(run, ten_lines):
h.press_and_enter(r'line_\d')
h.await_text('replace with:')
h.press_and_enter('ohai')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('?')
h.press('^C')
h.await_text('cancelled')
@@ -99,7 +99,7 @@ def test_replace_say_no_to_individual_replace(run, ten_lines):
h.press_and_enter('line_[135]')
h.await_text('replace with:')
h.press_and_enter('ohai')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('y')
h.await_text_missing('line_1')
h.press('n')
@@ -116,7 +116,7 @@ def test_replace_all(run, ten_lines):
h.press_and_enter(r'line_(\d)')
h.await_text('replace with:')
h.press_and_enter(r'ohai+\1')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('a')
h.await_text_missing('line')
h.await_text('ohai+1')
@@ -130,7 +130,7 @@ def test_replace_with_empty_string(run, ten_lines):
h.press_and_enter('line_1')
h.await_text('replace with:')
h.press('Enter')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('y')
h.await_text_missing('line_1')
@@ -153,7 +153,7 @@ def test_replace_small_window_size(run, ten_lines):
h.press_and_enter('line')
h.await_text('replace with:')
h.press_and_enter('wat')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
with h.resize(width=8, height=24):
h.await_text('replace…')
@@ -170,7 +170,7 @@ def test_replace_height_1_highlight(run, tmpdir):
h.press_and_enter('^x+$')
h.await_text('replace with:')
h.press('Enter')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
with h.resize(width=80, height=1):
h.await_text_missing('xxxxx')
@@ -189,7 +189,7 @@ def test_replace_line_goes_off_screen(run):
h.press_and_enter('b+')
h.await_text('replace with:')
h.press_and_enter('wat')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.await_text(f'{"a" * 20}{"b" * 59}»')
h.press('y')
h.await_text(f'{"a" * 20}wat')
@@ -221,7 +221,7 @@ def test_replace_multiple_occurrences_in_line(run):
h.press_and_enter('a+')
h.await_text('replace with:')
h.press_and_enter('q')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('a')
h.await_text('bqbq')
@@ -234,7 +234,7 @@ def test_replace_after_wrapping(run, ten_lines):
h.press_and_enter('line_[02]')
h.await_text('replace with:')
h.press_and_enter('ohai')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('y')
h.await_text_missing('line_2')
h.press('y')
@@ -251,7 +251,7 @@ def test_replace_after_cursor_after_wrapping(run):
h.press_and_enter('b')
h.await_text('replace with:')
h.press_and_enter('q')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('n')
h.press('y')
h.await_text('replaced 1 occurrence')
@@ -267,7 +267,7 @@ def test_replace_separate_line_after_wrapping(run, ten_lines):
h.press_and_enter('line_[01]')
h.await_text('replace with:')
h.press_and_enter('_')
h.await_text('replace [y(es), n(o), a(ll)]?')
h.await_text('replace [yes, no, all]?')
h.press('y')
h.await_text_missing('line_0')
h.press('y')

View File

@@ -148,7 +148,7 @@ def test_save_on_exit_cancel_yn(run):
h.press('hello')
h.await_text('hello')
h.press('^X')
h.await_text('file is modified - save [y(es), n(o)]?')
h.await_text('file is modified - save [yes, no]?')
h.press('^C')
h.await_text('cancelled')
@@ -158,7 +158,7 @@ def test_save_on_exit_cancel_filename(run):
h.press('hello')
h.await_text('hello')
h.press('^X')
h.await_text('file is modified - save [y(es), n(o)]?')
h.await_text('file is modified - save [yes, no]?')
h.press('y')
h.await_text('enter filename:')
h.press('^C')
@@ -171,7 +171,7 @@ def test_save_on_exit(run, tmpdir):
h.press('hello')
h.await_text('hello')
h.press('^X')
h.await_text('file is modified - save [y(es), n(o)]?')
h.await_text('file is modified - save [yes, no]?')
h.press('y')
h.await_text(f'enter filename: {f}')
h.press('Enter')
@@ -183,9 +183,9 @@ def test_save_on_exit_resize(run, tmpdir):
h.press('hello')
h.await_text('hello')
h.press('^X')
h.await_text('file is modified - save [y(es), n(o)]?')
h.await_text('file is modified - save [yes, no]?')
with h.resize(width=10, height=24):
h.await_text('file is m…')
h.await_text('file is modified - save [y(es), n(o)]?')
h.await_text('file is modified - save [yes, no]?')
h.press('^C')
h.await_text('cancelled')