BracketedPaste (ne’s manual)

#### 4.9.21 BracketedPaste

Syntax: `BracketedPaste [0|1|macro_name_before macro_name_after]`
Abbreviation: `BP`

“Bracketed paste” is an informal though widely adopted protocol between terminal mode programs (like `ne`) and the terminal emulators through which they present their user interfaces. When `BracketedPaste` is enabled, blocks of text pasted from a system clipboard are “bracketed” – that is, they are immediately preceded and followed – by special character sequences which distinguish such blocks from text you actually typed. Bracketed paste text is usually already indented, tabbed, and line wrapped. The `BracketedPaste` command lets you manage factors that change input handling while inserting bracketed paste text into your document.

`BracketedPaste 0` disables bracketed paste support entirely; `BracketedPaste 1` enables bracketed paste support and temporarily disables the `AutoIndent` flag and increases the `AtomicUndo` level during bracketed pastes; when given a pair of macro names, bracketed paste support is enabled and the indicated macros will be run immediately before and after processing bracketed paste text. The macros need not already exist. (See the `Macro` help page, especially the warning at the bottom.) `BracketedPaste` with no argument will prompt you to enter a new value with the prompt’s default being the current value.

The default value is ‘`1`’ – enabled with default behaviour. This is an automatic preference (see AutoPrefs) and so will be saved by both `SaveAutoPrefs` and `SaveDefPrefs`.

Other flags you may want to manage through macros include `Tabs` and `WordWrap` as they affect handling of pasted text. The examples below show contents of before and after macros which would have the same effect as ‘`BracketedPaste 1`’.

    # Invoked Before Bracketed Paste    # Invoked After Bracketed Paste
    PushPrefs                           PopPrefs
    AtomicUndo +                        AtomicUndo -
    AutoIndent 0                        Refresh
    Refresh