#! /bin/sh
# -*- tcl -*-
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" ${1+"$@"}

#
# Test file for screen corruption issue 71:
# inserting chars near the end of a 79-character line garbles the screen.
#
# Note: after commit 83192720e, this bug has been papered over:
# To see it again you need to remove the call to s_inschar() in edit.c
# (or git checkout 94d149b7) and perform the below test manually
# using xterm or similar.
#
# When this test fails, the Y is printed over the top of the X.
#
# Was https://github.com/martinwguy/xvi/issues/71
#

source scripts/term
start_vi

# Tests begin

# Check it started up OK
test 100 ""		1 0 [list "" "~"]

# The bug places the Y on top of the X.
test 101 "79aa[esc]iXY" 2 0 [list "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaXY" "a" "~"]

exp_send "[esc]"

stop_vi

exit 0

