bugGNU Octave - Bugs: bug #40156, allow --traditional to set...


bug #40156: allow --traditional to set Matlab-compatible default readline keybindings

Submitter:  Felipe G. Nievinski <fgnievinski>
Submitted:  Tue 01 Oct 2013 09:25:48 PM UTC
Category:  Interpreter Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Postponed Assigned to:  None
Originator Name:  Felipe Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Mon 09 Feb 2015 11:38:44 PM UTC, comment #28: 

I have switched the category from GUI to Interpreter since this is no longer about the GUI keybindings, but about the readline keybindings used in the CLI and Command Window.  It would certainly be possible to figure out some inputrc file changes to use when --traditional is set.  But this won't gate the 4.0 release.

Rik <rik5>
Group administrator
Thu 15 May 2014 05:06:00 AM UTC, comment #27: 

To make things clearer, we should restrict this report to readline keybindings only and move all discussions on GUI keybindings into bug #41217.

Torsten Lilge <ttl>
Group Member
Mon 20 Jan 2014 03:20:52 AM UTC, comment #26: 

one more (from bug #41276:): Ctrl+D to edit function over which cursor is.

Felipe G. Nievinski <fgnievinski>
Sat 11 Jan 2014 12:40:40 AM UTC, comment #25: 

There are two independent sets of keybindings going on.

One affects the terminal widget when the keyboard focus is there. This is what is driven by readline and configured with the inputrc configuration file. The same set of actions work in Octave command-line mode as in the GUI.

The other set is the set of bindings handled by the Qt GUI itself. These are bindings for switching tabs, opening files in the editor, controlling the debugger, etc.

So as we're keeping track of these here, make sure to note the context, and whether the binding has to do with the terminal (command window), such as next/previous history, or the rest of the GUI, such as opening a file.

This bug report started out as only changing the readline bindings for the command window.

Mike Miller <mtmiller>
Group Member
Fri 10 Jan 2014 09:50:17 PM UTC, comment #24: 

another keybinding:
Ctrl+H: opens search & replace (same as Ctrl+F)

Felipe G. Nievinski <fgnievinski>
Fri 10 Jan 2014 09:17:01 PM UTC, comment #23: 

hum, there seems to be two overlapping keybinding environs, depending on which dock you're typing in: the command window or the editor.  it seems the latter is a superset of the former, e.g., F9 ("Evaluate current selection") only makes sense in the editor, but most (all?) keybindings valid in the terminal should remain the same in the editor?

Felipe G. Nievinski <fgnievinski>
Fri 10 Jan 2014 08:55:10 PM UTC, comment #22: 

some other missing keybindings (editor-specific)
collected from duplicated bug reports:

F3: find next

F12: Toggle Breakpoint

Felipe G. Nievinski <fgnievinski>
Mon 06 Jan 2014 04:25:01 AM UTC, comment #21: 

exactly, but --traditional should do enable the magic.
the migrating user shouldn't have to learn about this nuisance.

Felipe G. Nievinski <fgnievinski>
Mon 06 Jan 2014 04:17:17 AM UTC, comment #20: 

Yes, Jordi's suggestion is exactly what I was proposing. If it's important to distribute some "traditional" set of keybindings to users familiar with Matlab, then such an inputrc can always be made available somewhere and ready to drop in to their Octave installation.

Mike Miller <mtmiller>
Group Member
Mon 06 Jan 2014 04:14:40 AM UTC, comment #19: 

> pardon, but for a matlab user, inputrc is a nightmare.

This sounds like an excessively negative statement. Can you please moderate your tone? Feel free to call me out if you think I am not doing the same.

Also, there's an obvious solution to avoid giving Matlab's users night terrors and making them sweat in a panic due to a configuration file: we write it ourselves and make it easy for them to enable it.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Mon 06 Jan 2014 03:35:13 AM UTC, comment #18: 

pardon, but for a matlab user, inputrc is a nightmare.

Felipe G. Nievinski <fgnievinski>
Mon 06 Jan 2014 03:10:47 AM UTC, comment #17: 

I don't think you mean left-arrow and right-arrow to go backwards and forwards a word at a time, do you?

I'll reopen this as a feature request and retitle appropriately to what it sounds to me like you want to do. If you want to try to come up with a patch that will set some key bindings based on the --traditional option, feel free. But keep in mind that there is already a simple way to set up keybindings, and dropping an inputrc file somewhere isn't that much more difficult than editing a shortcut launcher command line.

Mike Miller <mtmiller>
Group Member
Mon 06 Jan 2014 02:31:48 AM UTC, comment #16: 

two more mappings for a smoother migration of matlab users to octave:

"\e[C": forward-word
"\e[D": backward-word

as time allows I'll make a patch for --traditional.
meanwhile, please leave this open as a feature request.

Felipe G. Nievinski <fgnievinski>
Fri 03 Jan 2014 06:14:46 PM UTC, comment #15: 

Double-ESC would be the next best thing then:

"\e\e": kill-whole-line

"\e[2~": overwrite-mode  # ins key

set bell-style none

Can I leave these as a feature request related to --traditional?
Later I may work on a patch.

Felipe G. Nievinski <fgnievinski>
Fri 03 Jan 2014 02:14:05 PM UTC, comment #14: 

Up arrow does currently recall previous history, unless you have started typing something, in which case it searches for previous commands starting with the same prefix. I personally prefer simple previous/next history so I have my own .inputrc to fix that for me. But I think some people might prefer the current behavior as the default.

Overwrite mode should be able to work.

I don't think you can bind a bare Escape to anything in readline, since it is a prefix for many other keybindings, including the Insert key and the arrow keys.

Mike Miller <mtmiller>
Group Member
Fri 03 Jan 2014 06:55:41 AM UTC, comment #13: 

I'd like to reopen this as a feature request, that --traditional honors the following:

o up-arrow key should recall command history
o esc should clear current command line
o ins key should allow overwriting text

I'll work on a patch after clarification in the maintainers list.

Felipe G. Nievinski <fgnievinski>
Wed 09 Oct 2013 03:35:13 AM UTC, comment #12: 

Closing this report since it seems from the discussion that all issues have been resolved in the current development version. If the problem remains this report can be reopened.

Mike Miller <mtmiller>
Group Member
Thu 03 Oct 2013 05:23:08 PM UTC, comment #11: 

I'm using Linux and Octave 3.7.7+.
But it's indeed a problem of configuration of my platform and I'll look into the preferences in ~/.inputrc.
Sorry about the confusion.

Guillaume <gyom>
Thu 03 Oct 2013 04:15:20 PM UTC, comment #10: 

@Mike: comment added to bug #37672

@Guillaume: I cannot reproduce your issue. After start-up, up-arrow neatly gives me the last command from the previous session.
My OS = WinXP, Octave-3.7.6+

Philip Nienhuis <philipnienhuis>
Group Member
Thu 03 Oct 2013 01:35:42 PM UTC, comment #9: 

@Philip: You said Ctrl-C does interrupt processes on Windows? Can you look at bug #37672 and comment there on whether that bug affects Windows or not?

@Guillaume: The arrow keys are configurable with readline, for example I prefer the behavior you describe so I have my up and down arrows mapped to the readline functions previous-history and next-history. Octave typically installs its own readline configuration file that maps them to history-search-backward and history-search-forward. Maybe that configuration is getting lost or overridden by some other preferences like your ~/.inputrc file. What OS by the way?

Mike Miller <mtmiller>
Group Member
Thu 03 Oct 2013 10:45:44 AM UTC, comment #8: 

[Sorry to hijack this report in case this is unrelated; it might also be a problem due to my own compiled version.]
In CLI, if I type the beginning of a command and press UP, I would expect to see appearing the last entire line from the history that started like that (ie perform a history filter/search). What I get now is the previous line in the history, such that my first typed characters are ignored.

Guillaume <gyom>
Wed 02 Oct 2013 10:40:27 PM UTC, comment #7: 

Nevermind, apparently I tried an ancient build (v. 3.6.2), available from <http://mat.caminos.upm.es/octave/>.  Already pretty impressed with the GUI though.  Let me know if you're aware of a more recent windows binary with the GUI enabled, then I can test it.

Felipe G. Nievinski <fgnievinski>
Wed 02 Oct 2013 10:07:49 PM UTC, comment #6: 

How recent is "recent"?

In my 3.7.6+ version from Sep 16 (John Donoghue's key mapping fixes were committed earlier) the HOME and END key work perfectly in the CLI & GUI version. They do just what you describe.
IIRC they still worked fine in the 3.7.7+ from a week ago as well (last build I made). As I use those keys a lot I should have noticed problems right away.

Issues could be related to the term setting. Could that "someone" have a different term setting applied, perhaps unnoticed?
I have:

>> getenv ("TERM")
ans = cygwin

Philip Nienhuis <philipnienhuis>
Group Member
Wed 02 Oct 2013 06:56:05 PM UTC, comment #5: 

I had someone report to me that the HOME and END keys were no longer working as expected in the command window with a recent windows build.  Can someone confirm?  I think HOME is supposed to move the cursor to the beginning of the line and END should move it to the end of the line.

John W. Eaton <jwe>
Group administrator
Wed 02 Oct 2013 01:50:54 PM UTC, comment #4: 

This bug is more or less a duplicate (or at least related to) bug #39822.

From that one the Esc issue still stands, as do the INS / Tab / Shift-Tab / Ctrl-Tab keys. The arrow keys work OK.
Ctrl-C doesn't clear the command line but leaves the current command line and 'goes to a new prompt'. Ctrl-C and Ctrl-V (with marked text) work for copy/paste; not perfect but good enough (IMO). Ctrl-C does interrupt running processes.

At the time of bug #39822 I announced to open a new bug report soon but as I figure there are much, more urgent issues I've just let it slip until now.
Maybe this report can function as such.

FYI, I run a MXE-cross-compiled Octave 3.7.6+ on WinXP and 3.7.7+ on Win7.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 02 Oct 2013 01:34:58 AM UTC, comment #3: 

How did you compile the GUI for Windows 7? Are you using MXE?

If you're using the ancient GUI version that Goffioul made a long time ago, that does not reflect the current development status.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 02 Oct 2013 12:06:54 AM UTC, comment #2: 

Win 7.

Felipe G. Nievinski <fgnievinski>
Tue 01 Oct 2013 11:56:33 PM UTC, comment #1: 

What system are you running the GUI on? The arrow keys all work as they should for me, as does Ctrl-C. Escape and Insert are mapped to other functions in readline by default.

Mike Miller <mtmiller>
Group Member
Tue 01 Oct 2013 09:25:48 PM UTC, original submission:  

o  left- and right-arrow keys should allow writing in between existing text
o  up-arrow key should recall command history
o  esc should clear current command line
o  ctrl+c should clear current command line and issue enter
o  ins key should allow overwriting text

Felipe G. Nievinski <fgnievinski>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by gyom (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by fgnievinski (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-21 mtmiller Priority5 - Normal 3 - Low
        StatusWorks For Me Postponed
    2015-02-09 rik5 CategoryGUI Interpreter
    2014-01-16 jordigh Dependencies- bugs #41180 is dependent
    2014-01-06 mtmiller Severity3 - Normal 1 - Wish
        Item GroupMatlab Compatibility Feature Request
        Open/ClosedClosed Open
        Summarysupport navigation keys in GUI command window allow --traditional to set Matlab-compatible default readline keybindings
    2013-10-09 mtmiller StatusNeed Info Works For Me
        Open/ClosedOpen Closed
    2013-10-01 mtmiller StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code