diff options
| -rw-r--r-- | incdec | 24 | 
1 files changed, 23 insertions, 1 deletions
| @@ -128,10 +128,32 @@ sub incdec {  }  function __readline_incdec_increment { +	local old_line_length="${#READLINE_LINE}" +  	__readline_incdec 1 1 + +	local new_line_length="${#READLINE_LINE}" + +	if [ "$old_line_length" -gt "$new_line_length" ]; then +		READLINE_POINT="$(($READLINE_POINT - 1))" +	fi +} + +function __readline_incdec_decrement { +	local old_line_length="${#READLINE_LINE}" + +	__readline_incdec -1 1 + +	local new_line_length="${#READLINE_LINE}" + +	if [ "$old_line_length" -lt "$new_line_length" ]; then +		READLINE_POINT="$(($READLINE_POINT + 1))" +	# elif [ "$old_line_length" -gt "$new_line_length" ]; then +	# 	READLINE_POINT="$(($READLINE_POINT - 1))" +	fi  } -bind -x '"\C-x-": __readline_incdec -1 1' +bind -x '"\C-x-": __readline_incdec_decrement'  bind -x '"\C-x+": __readline_incdec_increment' | 
