qlyoung's wiki

disable bracketed paste in gnu readline

In early 2021 GNU Readline, the venerated line editing library used in everything from bash to vtysh, enabled bracketed paste mode by default. This is a significant behavior change, and while it's noted that there is a compile time option to change this default, generally you can't tell users to recompile some system library to get a feature back.

The Readline docs themselves are in the typical overly-terse GNU style so this is a quick note on how to restore the old behavior in your readline-using program. There's a function in readline that takes a string and interprets it as if it were present in the user's .inputrc file; this can be leveraged to disable bracketed paste mode like so:

char *disable_bracketed_paste = strdup("set enable-bracketed-paste off");
rl_parse_and_bind(disable_bracketed_paste);
free(disable_bracketed_paste);
Panorama theme by desbest
disable_bracketed_paste_in_gnu_readline.txt · Last modified: 2024/01/06 05:25 by qlyoung
CC Attribution-Noncommercial-Share Alike 4.0 International Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International