get_selection_escapes_for_pane

On this page
  1. window:get_selection_escapes_for_pane(pane)

window:get_selection_escapes_for_pane(pane)#

Returns the text that is currently selected within the specified pane within the specified window formatted with the escape sequences necessary to reproduce the same colors and styling .

This is the same text that window:get_selection_text_for_pane() would return, except that it includes escape sequences.

This example copies the current selection + escapes to the clipboard when CTRL+SHIFT+E is pressed:

local wakterm = require 'wakterm'

return {
  keys = {
    {
      key = 'E',
      mods = 'CTRL',
      action = wakterm.action_callback(function(window, pane)
        local ansi = window:get_selection_escapes_for_pane(pane)
        window:copy_to_clipboard(ansi)
      end),
    },
  },
}

See also: window:copy_to_clipboard().

Edit this page