Disable jumping cursor in Erlang shell
Asked Answered
S

1

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.

Stratfordonavon answered 15/4, 2016 at 18:43 Comment(5)
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.Patriciapatrician
You may want to change the phrasing of your question and retag it. It may be that the Erlang folks may have some ideas.Keirakeiser
I changed the title to reflect that this is an Erlang shell issueRoomette
Today I spent whole morning to find it and @Patriciapatrician 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.Scabrous
I have created groups.google.com/forum/#!topic/elixir-lang-core/UiWQkj8OOKMChromaticity
N
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.

Nannienanning answered 12/12, 2016 at 3:57 Comment(2)
Thanks, it works. I am leaving this here as reference because I had to google it: erlang.org/pipermail/erlang-questions/2001-July/003416.htmlSankaran
erlang.org/pipermail/erlang-questions/2016-May/089186.htmlAcalia

© 2022 - 2024 — McMap. All rights reserved.