Mercurial > public > mercurial-scm > hg-stable
diff tests/test-commit-interactive-curses.t @ 27914:505a10b504ed stable
crecord: edit during hg crecord should preserve cursor position (issue5041)
This patch adds a variable to keep track of what hunk was selected
before the edit. We use that variable to select the hunk or its
replacement after the edit.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Wed, 20 Jan 2016 11:21:13 -0800 |
parents | dcdf0a52ad36 |
children | 71e12fc53b80 |
line wrap: on
line diff
--- a/tests/test-commit-interactive-curses.t Thu Jan 21 02:42:01 2016 +0900 +++ b/tests/test-commit-interactive-curses.t Wed Jan 20 11:21:13 2016 -0800 @@ -193,3 +193,33 @@ +++ b/x Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +hello world + +Editing a hunk puts you back on that hunk when done editing (issue5041) +To do that, we change two lines in a file, pretend to edit the second line, +exit, toggle the line selected at the end of the edit and commit. +The first line should be recorded if we were put on the second line at the end +of the edit. + + $ hg update -C . + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo "foo" > x + $ echo "hello world" >> x + $ echo "bar" >> x + $ cat <<EOF >testModeCommands + > f + > KEY_DOWN + > KEY_DOWN + > KEY_DOWN + > KEY_DOWN + > e + > TOGGLE + > X + > EOF + $ printf "printf 'editor ran\n'; exit 0" > editor.sh + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0" + editor ran + $ hg cat -r . x + foo + hello world + +