<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>I just realized what is likely causing the problem. When I start
the shell with erl and type in this testing string (with spaces so
it's longer) it all works fine:</p>
<p>lists:sort([{a, 1}, {b, 2}, {c, 3}, {d, 4}, {e, 5}, {f, 6}, {g,
7}, {h, 8}, {i, 9}, {j, 10}]).</p>
<p>But I very rarely use Erlang shell in this way. Most of the time
I am connecting to running Erlang nodes using to_erl specifying
the shell's PID. Then it breaks, probably because my terminal size
doesn't match the default terminal size with which the shell has
been originally started.</p>
<p>When I then try to type in the same example the shell will match
each {} correctly but as soon as I type ']' to close the list the
cursor jumps to the line above, then some other place when I type
')'.<br>
</p>
<p>So it's not related to the environment but to the way I am using
Erlang shell. Is there any solution to that?</p>
<p>Grzegorz<br>
</p>
<br>
<div class="moz-cite-prefix">On 15/05/2016 20:28, Joshua Barney
wrote:<br>
</div>
<blockquote
cite="mid:E57114F9-D0DB-4F7A-83D3-8737ABD3BD17@icloud.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Grzegorz,
<div class=""><br class="">
</div>
<div class="">that’s a long list of environments!</div>
<div class=""><br class="">
</div>
<div class="">I took some time to reproduce the “Ubuntu ssh to
CentOS” (and vice versa) using vmware. on two fresh installs of
ubuntu and centos, the paren matching worked correctly. On
ubuntu, If I resized the window halfway through it would jump
backwards to the wrong point and then forwards to the correct
point—centos xterm re-flowed the text so this did not happen.
This worked with $TERM set to 'xterm' or ‘konsole’ or ‘putty’.</div>
<div class=""><br class="">
</div>
<div class="">you said earlier:</div>
<div class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">I don't have such
environment variables (LINES and COLUMNS) in my system and
I don't remember having them on Ubuntu or Red Hat (however
I can't double-check that now)<br class="">
</blockquote>
</blockquote>
</blockquote>
<br class="">
</div>
<div class="">These variables are set by your terminal in response
to resize events and are communicated over ssh as you can read
about here: <a moz-do-not-send="true"
href="http://unix.stackexchange.com/a/207802" class="">http://unix.stackexchange.com/a/207802</a></div>
<div class="">If your system does not have those variables, I
would strongly suspect that the nurses library would not
function in the way you desire.</div>
<div class=""><br class="">
</div>
<div class="">At this point I can only wildly speculate about ways
your erlang install (or terminfo database, or ncurses library)
is broken, and I don’t think you’re really looking for that.</div>
<div class=""><br class="">
</div>
<div class="">Josh</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On May 15, 2016, at 8:00 AM, Grzegorz Junka
<<a moz-do-not-send="true"
href="mailto:list1@gjunka.com" class="">list1@gjunka.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Joshua,<br class="">
<br class="">
This is what I said, it isn't broken only for me. I saw
it being broken on other people's computers as well.<br
class="">
<br class="">
It's unlikely for any scripts to set COLUMNS since I
don't see that environment variable being set when
running shell.<br class="">
<br class="">
I am running Konsole on the same system on which I am
running Erlang, both on FreeBSD. I don't need to SSH
anywhere. But the behaviour was the same no matter from
where or to where I was SSH-ing or not (or someone I saw
doing it), e.g.:<br class="">
<br class="">
Windows putty SSH to FreeBSD<br class="">
<br class="">
Windows putty SSH to Ubuntu<br class="">
<br class="">
Windows putty SSH to Red Hat<br class="">
<br class="">
Windows putty SSH to CentOS<br class="">
<br class="">
Windows xterm cygwin SSH to FreeBSD<br class="">
<br class="">
Windows xterm cygwin SSH To Ubuntu<br class="">
<br class="">
Windows xterm cygwin SSH to Red Hat<br class="">
<br class="">
Windows xterm cygwin SSH to CentOS<br class="">
<br class="">
FreeBSD xterm SSH to Ubuntu<br class="">
<br class="">
FreeBSD Konsole SSH to Ubuntu<br class="">
<br class="">
FreeBSD xterm SSH to FreeBSD<br class="">
<br class="">
FreeBSD Konsole SSH to Ubuntu<br class="">
<br class="">
FreeBSD xterm SSH to CentOS<br class="">
<br class="">
FreeBSD Konsole SSH to CentOS<br class="">
<br class="">
FreeBSD Konsole and Erlang shell on the same system (no
SSH)<br class="">
<br class="">
FreeBSD xterm end Erlang shell on the same system (no
SSH)<br class="">
<br class="">
Ubuntu SSH to CentOS<br class="">
<br class="">
It's fair to say that I haven't see a system on which
this feature worked fine, I just learned to not type
commands that are too long or copy-paste longer
commands, and I bet most people who experience it do the
same and don't bother complaining. I wonder if maybe
this has something to do with escape codes and for
example support for 256 colors in the terminal.<br
class="">
<br class="">
Grzegorz<br class="">
<br class="">
<br class="">
On 14/05/2016 22:49, Joshua Barney wrote:<br class="">
<blockquote type="cite" class="">It seems unlikely that
erlang shell is broken only for you on all these
systems.<br class="">
Have you checked that your shell scripts are not
setting COLUMNS? Perhaps you are ssh-ing from a client
that is doing something not quite right?<br class="">
<br class="">
Sent from my iPhone<br class="">
<br class="">
<blockquote type="cite" class="">On May 14, 2016, at
6:39 PM, Grzegorz Junka <<a
moz-do-not-send="true"
href="mailto:list1@gjunka.com" class=""><a class="moz-txt-link-abbreviated" href="mailto:list1@gjunka.com">list1@gjunka.com</a></a>>
wrote:<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">On 14/05/2016
21:19, Kenneth Lakin wrote:<br class="">
<blockquote type="cite" class="">On 05/14/2016
03:32 AM, Grzegorz Junka wrote:<br class="">
Fixing my terminal to 80 characters only seems
like taken straight from<br class="">
the Windows world. I hope Erlang can do better
;)<br class="">
</blockquote>
If ncurses can't determine your terminal size,
then falling back to<br class="">
80x24 makes a lot of sense. Do other ncurses-based
programs behave<br class="">
incorrectly?<br class="">
</blockquote>
No. Everything else is fine. This problem is not
related to my system, as I have seen the same
behaviour in Erlang running on FreeBSD, Ubuntu, Red
Hat and CentOS in different terminals, like putty,
cygwin and Konsole.<br class="">
<br class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">Is there any way
of<br class="">
telling the Erlang terminal how wide is my
terminal, e.g. an environment<br class="">
variable?<br class="">
</blockquote>
On my system, it looks like the environment
variables LINES and COLUMNS<br class="">
correspond to the current size of my terminal
window. When I set COLUMNS<br class="">
to a value that does not match the window's
current size, then the<br class="">
Erlang shell's paren matching bounces the cursor
backwards to the wrong<br class="">
place (but back forwards to the right place).
Maybe this will be the<br class="">
band-aid you need.<br class="">
</blockquote>
I don't have such environment variables in my system
and I don't remember having them on Ubuntu or Red
Hat (however I can't double-check that now)<br
class="">
<br class="">
<blockquote type="cite" class="">However, it might
be more useful to fix whatever is preventing
ncurses<br class="">
from determining the terminal size.<br class="">
</blockquote>
Yeah, and even more useful if the Erlang shell
allowed me to disable a feature that isn't really
necessary especially if it isn't working correctly.<br
class="">
<br class="">
<br class="">
_______________________________________________<br
class="">
erlang-questions mailing list<br class="">
<a moz-do-not-send="true"
href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br
class="">
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br
class="">
</blockquote>
</blockquote>
<br class="">
_______________________________________________<br
class="">
erlang-questions mailing list<br class="">
<a moz-do-not-send="true"
href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br
class="">
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br
class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</blockquote>
<br>
</body>
</html>