[AESH-249]
fixes bug in redirection, appending still doesnt work properly
fix bug when history doesnt show the correct line caused by optimizing when delta is -1