Skip to content

Add macOS text-editing shortcuts as defaults #16529

Description

@ryan-carpenter

Problem

JabRef does not recognize macOS's native Control-modifier text-editing shortcuts, such as Control-A and Control-E. These can't be added manually because the Control key does not register when customizing shortcuts in Preferences. In any case, native shortcuts should be the default, not a customization. Refer to Mac keyboard shortcuts.
Edit: Control key registration has been fixed.

Suggested solution

Assign the following shortcuts to the matching unbound EDITOR_* functions in JabRef.

  • Control-A: Move to the beginning of the line or paragraph.
  • Control-E: Move to the end of a line or paragraph.
  • Control-F: Move one character forward.
  • Control-B: Move one character backward.
  • Control-P: Move up one line.
  • Control-N: Move down one line.
  • Edit: Also the rest, including Control, Option, and Command modifiers as shown in the comment below

Three of the native macOS text-editing shortcuts do not have a corresponding EDITOR_* function in JabRef. These would require new functions.

  • Control-L: Center the cursor or selection in the visible area (Positions the current line in the middle of the text-editor area).
  • Control-O: Insert a new line after the insertion point (Inserts a new line without moving the cursor).
  • Control-T: Swap the character behind the insertion point with the character in front of the insertion point.

Related JabRef activity

#16597 and #6037 concern the "bash" preset, which provides Emacs-like keybindings that overlap with but do not match macOS.

#6037 (comment) mentions an issue where the bash preset conflicts with Command-modifier shortcuts on macOS (as well as Windows/Linux shortcuts). Using the Control modifier (like macOS) avoids this problem. The Command and Option shortcuts not to hijack include:

  • Common "GUI shortcuts" such as Command-A, Command-C, Command-F, Command-P, Command-S (select all, copy, find, print, and save, respectively).
  • Accents and special characters, such as Option-A (å), Option-B (ß), Option-C (ç), Option-E + letter (é and ó), Option-V (√), and so on. These characters can also be produced by a long press on the letter keys or using LaTex codes, so they are not as critical to protect as some other shortcuts. However, it is best to assume that users might want the native shortcuts. BibTeX files typically require many accents and special characters in author names and other fields.

#16597 (comment) discusses "Readline" as an alternative name for the "bash" preset (formerly the "Emacs" preset). The Readline default is Emacs mode, but Readline also includes Vi mode, so "Emacs" or "Readline Emacs" and "Vi" or "Readline Vi" would be better names. Consider reverting bash to its former name and adding a preset for Vi-like bindings.

Edit: Rewrote the entire description to clarify mac-specific considerations and link to related issues.
Edit: Implementing the proposed keybindings will also fix #16528.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions