Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
insert, delete, home and end keys in xterm (nojvm/nodesktop)

Subject: insert, delete, home and end keys in xterm (nojvm/nodesktop)

From: Kevin Mitchell

Date: 11 Jul, 2007 08:21:21

Message: 1 of 6

Hello,
This is a problem that has been plaguing me for several years. I have searched the web high and low on several occasions, but to no avail. I'm actually surprised that this hasn't been resolved in the four versions of matlab that have been released in my time using it.

In any case, my problem is that the line editing keys (home,end,insert and delete) do not behave as they do on a regular unix command line. To be unambiguous, I want my home key to bring me to the beginning of the line, the end to go to the end of the line, and the delete key to delete the character following the cursor (as opposed to preceeding the cursor as with backspace). Less importantly, insert should toggle between inserting and overwriting text at the cursor. Instead, all i get when I press these keys are 7~,8~,2~, or 3~ appearing on the command line.

I've tried using different terminals aterm,xterm and even the more bloated konsole and gterm. The most that does is change the garbage that gets printed out when the keys are pressed. I also seem to recall wasting an afternoon fiddling with my .Xresources file, which ended up not helping. I have experienced this problem while running matlab itself on a Debian system (etch and then lenny) as well as on RedHat servers. I have also sshed in from mandrake, redhat, and debian systems in all possible permutations with the same behaviour.

I can't be the only person who hates the rediculous gui that takes five minutes to start, wastes precious screen space on doodads entirely secondary to the primary task of crunching numbers, and worst of all has Windows written all over it. Has anyone out there found a solution to this problem or better yet, is mathworks aware that it exists?

Thanks,
Kevin

Subject: insert, delete, home and end keys in xterm (nojvm/nodesktop)

From: Misha Koshelev

Date: 26 Jun, 2009 15:36:01

Message: 2 of 6

Actually this would be really nice to solve. I second it although I don't think there's going to be any progress since you posted in 2007.

Thanks
Misha

"Kevin Mitchell" <kevmitch@dadadada.gmail.com> wrote in message <f723u1$5n$1@fred.mathworks.com>...
> Hello,
> This is a problem that has been plaguing me for several years. I have searched the web high and low on several occasions, but to no avail. I'm actually surprised that this hasn't been resolved in the four versions of matlab that have been released in my time using it.
>
> In any case, my problem is that the line editing keys (home,end,insert and delete) do not behave as they do on a regular unix command line. To be unambiguous, I want my home key to bring me to the beginning of the line, the end to go to the end of the line, and the delete key to delete the character following the cursor (as opposed to preceeding the cursor as with backspace). Less importantly, insert should toggle between inserting and overwriting text at the cursor. Instead, all i get when I press these keys are 7~,8~,2~, or 3~ appearing on the command line.
>
> I've tried using different terminals aterm,xterm and even the more bloated konsole and gterm. The most that does is change the garbage that gets printed out when the keys are pressed. I also seem to recall wasting an afternoon fiddling with my .Xresources file, which ended up not helping. I have experienced this problem while running matlab itself on a Debian system (etch and then lenny) as well as on RedHat servers. I have also sshed in from mandrake, redhat, and debian systems in all possible permutations with the same behaviour.
>
> I can't be the only person who hates the rediculous gui that takes five minutes to start, wastes precious screen space on doodads entirely secondary to the primary task of crunching numbers, and worst of all has Windows written all over it. Has anyone out there found a solution to this problem or better yet, is mathworks aware that it exists?
>
> Thanks,
> Kevin

Subject: insert, delete, home and end keys in xterm (nojvm/nodesktop)

From: Harry Seldon

Date: 8 Aug, 2009 20:38:01

Message: 3 of 6

I got the same problem as you. So an extensive answer is here: http://tinyurl.com/n3cuj6

The short answer is simply to configure the keys to send the following codes :
ctrl+a (0x01) for home
ctrl+e (0x05) for end
ctrl+d (0x04) for delete

Terminals and Matlab recognize these ctrl code. So it should work. At least it worked for me.

Hope it helps,
H

Subject: insert, delete, home and end keys in xterm (nojvm/nodesktop)

From: Thomas Dickey

Date: 9 Aug, 2009 15:06:27

Message: 4 of 6

On Aug 8, 4:38 pm, "Harry Seldon" <harry.seldo...@gmail.com> wrote:
> I got the same problem as you. So an extensive answer is here:  http://tinyurl.com/n3cuj6
>
> The short answer is simply to configure the keys to send the following codes :
> ctrl+a (0x01) for home  
> ctrl+e (0x05) for end  
> ctrl+d (0x04) for delete  
>
> Terminals and Matlab recognize these ctrl code. So it should work. At least it worked for me.
>
> Hope it helps,
> H

Perhaps not - your solution works only for xterm (OP mentioned
others).

The root of the problem is bash's absence of support for anything
except
hardcoded key sequences (zsh for example allows use of terminfo
capability
names). Since they're hardcoded, only one choice is provided - and
may
happen to differ with terminals which set TERM=xterm...

--
Thomas E. Dickey <dickey@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net

Subject: insert, delete, home and end keys in xterm (nojvm/nodesktop)

From: Misha Koshelev

Date: 9 Aug, 2009 20:12:01

Message: 5 of 6

Thomas Dickey <dickey@his.com> wrote in message <99c2a244-ec03-4604-aaf3-c0fd6b1ca73b@g23g2000vbr.googlegroups.com>...
> On Aug 8, 4:38?pm, "Harry Seldon" <harry.seldo...@gmail.com> wrote:
> > I got the same problem as you. So an extensive answer is here: ?http://tinyurl.com/n3cuj6
> >
> > The short answer is simply to configure the keys to send the following codes :
> > ctrl+a (0x01) for home ?
> > ctrl+e (0x05) for end ?
> > ctrl+d (0x04) for delete ?
> >
> > Terminals and Matlab recognize these ctrl code. So it should work. At least it worked for me.
> >
> > Hope it helps,
> > H
>
> Perhaps not - your solution works only for xterm (OP mentioned
> others).
>
> The root of the problem is bash's absence of support for anything
> except
> hardcoded key sequences (zsh for example allows use of terminfo
> capability
> names). Since they're hardcoded, only one choice is provided - and
> may
> happen to differ with terminals which set TERM=xterm...
>
> --
> Thomas E. Dickey <dickey@invisible-island.net>
> http://invisible-island.net
> ftp://invisible-island.net

Thank you... I was just about to ask about gnome-terminal.

However, the nice thing I got from this message is that I can just use Ctrl-A and Ctrl-E which works fine for me :)

Thanks
Misha

Subject: insert, delete, home and end keys in xterm (nojvm/nodesktop)

From: Harry Seldon

Date: 9 Aug, 2009 21:02:39

Message: 6 of 6

@Thomas E. Dickey
Yes if you use a terminal where you cannot change the key codes, this solution won't work. The other solution would be to be able to tweak the key codes on the Matlab side. But I do not think it is feasible. Maybe on the most recent versions. See with Mathworks.

@Misha Koshelev
Glad you learnt about ctrl+a. However, beware that ctrl+z suspends a process. So as the z key is not far from the a key, beware of not killing the work you are doing. It happened to me a couple of times. So that is why I was not satisfied with this solution.

Regards,
H

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us