19

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.

Zepplock
  • 28,655
  • 4
  • 35
  • 50
sbs
  • 4,102
  • 5
  • 40
  • 54
  • 3
    No luck. This is feature of underlying Erlang shell and is not configurable. I thought that maybe `iex --erl -oldshell` will work, because it doesn't have the feature, but iex won't start at all in that mode. It requires modern shell. – tkowal Apr 15 '16 at 22:42
  • You may want to change the phrasing of your question and retag it. It may be that the Erlang folks may have some ideas. – Onorio Catenacci Apr 16 '16 at 13:40
  • I changed the title to reflect that this is an Erlang shell issue – Zepplock Apr 19 '16 at 18:50
  • Today I spent whole morning to find it and @tkowal has right- it's not configurable. I checked whole shell, shell_default and other docs about Erlang and I'm pretty sure it can't be changed. Also IEx won't work on erl oldshell. – PatNowak Oct 16 '16 at 12:48
  • I have created https://groups.google.com/forum/#!topic/elixir-lang-core/UiWQkj8OOKM – nhooyr Feb 11 '17 at 20:58

1 Answers1

9

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.

YellowApple
  • 901
  • 8
  • 13
  • 1
    Thanks, it works. I am leaving this here as reference because I had to google it: http://erlang.org/pipermail/erlang-questions/2001-July/003416.html – skamsie Aug 10 '17 at 21:05
  • 1
    http://erlang.org/pipermail/erlang-questions/2016-May/089186.html – 2240 Nov 26 '20 at 08:24