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

# Undoing "dl" leaves the cursor one place too far to the left.
#
# When undoing "dl", "d2l" etc, in the middle of a line, the cursor was left
# one place to the left compared to where it was.
#
# Was https://github.com/martinwguy/xvi/issues/93

source scripts/term
start_vi

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


test 101 "aabcde[esc]"	1 4 [list "abcde" "~"]

# Try a one-character deletion in middle of the line
test 102 "0ll"		1 2 [list "abcde" "~"]
test 103 "dl"		1 2 [list "abde" "~"]
test 104 "u"		1 2 [list "abcde" "~"]

# Try deleting 2 characters
test 105 "2dl"		1 2 [list "abe" "~"]
test 106 "u"		1 2 [list "abcde" "~"]

# Try deleting the last 2 characters
test 108 "l2dl"		1 2 [list "abc" "~"]
test 109 "u"		1 3 [list "abcde" "~"]

stop_vi

exit 0
