Fix segmentation Fault on 32-bit
Tig is failing 'make test' on 32-bit systems (pretty much _every_ test
fails due to Segmentation fault), but passing just fine on (two
different) 64-bit systems.
Bisecting reveals that the problem is commit
bcc44849c ("Fix user-action
prompt display regression", 11-03-2015). If this commit is reverted,
then the problem goes away. The problem is that pos is initialized to
-1, which leads to a buffer underflow in prompt_input.
[ jf: Further improve the fix to use a separate variable for tracking
changes instead of using pos. This also fixes an issue where the prompt
was not properly updated when the last character in the input buffer is
deleted. ]
Signed-off-by: Jonas Fonseca <jonas.fonseca@gmail.com>