Class AutopairWidgets


  • public class AutopairWidgets
    extends Widgets
    Creates and manages widgets that intelligently handle matching delimiters in the console.

    AutopairWidgets provides functionality for automatically:

    • Closing matching delimiters (brackets, quotes, etc.) when the opening delimiter is typed
    • Deleting matching delimiter pairs when backspace is pressed
    • Skipping over closing delimiters when they are typed and already present

    This behavior is similar to what many modern code editors provide, making it easier to work with paired delimiters in the console.

    Inspired by zsh-autopair: https://github.com/hlissner/zsh-autopair

    • Constructor Detail

      • AutopairWidgets

        public AutopairWidgets​(LineReader reader)
      • AutopairWidgets

        public AutopairWidgets​(LineReader reader,
                               boolean addCurlyBrackets)
    • Method Detail

      • enable

        public void enable()
      • disable

        public void disable()
      • toggle

        public boolean toggle()
      • autopairInsert

        public boolean autopairInsert()
      • autopairClose

        public boolean autopairClose()
      • autopairDelete

        public boolean autopairDelete()
      • toggleKeyBindings

        public boolean toggleKeyBindings()