Bogdan Gusiev
Bogdan Gusiev

Reputation: 8305

Enter doesn't work when interactive command is launched in shell

After some actions in term enter stops working in with interactive commands in shell - I am still able to launch a command but if the command requires additional inputs line break is inserted at '^M'.

Example:

$ git add -p .
diff --git a/app/models/coupon.rb b/app/models/coupon.rb
index 39df1f3..736ea62 100644
--- a/app/models/coupon.rb
+++ b/app/models/coupon.rb
@@ -3,6 +3,7 @@ class Coupon < ActiveRecord::Base
   COUPON_PRECREATE_EXPIRATION_BUFFER = 5.days
   COUPON_PRECREATE_COUNT = 15

+  include CommonNamedScopes

   belongs_to :coupon_list
   #belongs_to :couponable, :polymorphic => true
Stage this hunk [y,n,q,a,d,/,e,?]? y^M

(same problem can be achived when using cat for example) so it has no relation to git.

Can someone advice why this is happening?

iTerm2 Build 1.0.0.20120724

zsh 5.0.0 (x86_64-apple-darwin11.4.2)

Upvotes: 5

Views: 1140

Answers (1)

qqx
qqx

Reputation: 19495

That generally is because a program changed the state of the terminal, but did not change it back.

Try running the reset command, and see if that fixes things.

Since you're using zsh, you could also use ttyctl -f to have zsh automatically reset terminal settings after commands are run. But don't use that before resetting the terminal first or zsh will freeze the settings in the broken state.

Upvotes: 8

Related Questions