Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable jumping cursor in Erlang shell

When typing () in IEx 1.2.4, the cursor would "jumping" to the matching parenthesis for 1s and move back. Even though it's not really jumping but it's kinda annoying to the eye. Is there a way to disable this feature in IEx?

EDIT:

While the question originally concerned IEx, the actual issue (as pointed out by @tkowal in his comment below) is actually in the Erlang Shell which IEx runs on top of. Hence I added the erlang-shell tag to this question.

like image 827
sbs Avatar asked Apr 15 '16 18:04

sbs


1 Answers

The cursor jumping happens in lib/stdlib/src/edlin.erl (in Erlang's stdlib). Specifically, it seems to happen at lines 205 through 213, which is where ), ], and } appear to be captured and converted into instructions to move the cursor (which are then sent through various processes in erl's supervision tree all the way up to user_drv, which then sends the necessary commands to the tty_sl port to make the cursor movement requests happen).

Unfortunately, there's no way (AFAICT) to disable that functionality that doesn't involve patching the code in that spot (whether by commenting out those lines or by adding additional guards to check for a new option passed to erl). If you're up for patching that file and recompiling Erlang, then go for it. Else, it's at least a starting point for someone to try implementing a configuration option around that behavior.

like image 88
YellowApple Avatar answered Nov 04 '22 08:11

YellowApple