# tty_set_selection

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/tty.c#L1897
- **Page:** https://libtmux.org/en/tmux/3.2a/reference/c-function-tty_set_selection/

```c
void tty_set_selection(struct tty *tty, const char *buf, size_t len)
```

## Parameters

- `tty` (`struct tty *`)
- `buf` (`const char *`)
- `len` (`size_t`)

## Called by

- [`cmd_load_buffer_done`](/en/tmux/3.2a/reference/c-function-cmd-load-buffer-c-cmd_load_buffer_done/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-load-buffer.c#L80)
- [`cmd_set_buffer_exec`](/en/tmux/3.2a/reference/c-function-cmd-set-buffer-c-cmd_set_buffer_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-set-buffer.c#L124)
- [`tty_cmd_setselection`](/en/tmux/3.2a/reference/c-function-tty_cmd_setselection/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/tty.c#L1893)

## Calls

- [`tty_putcode_ptr2`](/en/tmux/3.2a/reference/c-function-tty_putcode_ptr2/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/tty.c#L1911)
- [`tty_term_has`](/en/tmux/3.2a/reference/c-function-tty_term_has/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/tty.c#L1904)
- [`xmalloc`](/en/tmux/3.2a/reference/c-function-xmalloc/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/tty.c#L1908)

## Referenced declarations

- [`tty.flags`](/en/tmux/3.2a/reference/c-struct-tty-flags/) (attribute)
- [`tty.term`](/en/tmux/3.2a/reference/c-struct-tty-term/) (attribute)
- [`tty`](/en/tmux/3.2a/reference/c-struct-tty/) (struct)
- [`TTY_STARTED`](/en/tmux/3.2a/reference/c-define-tmux-h-tty_started/) (constant)
- [`TTYC_MS`](/en/tmux/3.2a/reference/c-enum-tty_code_code-ttyc_ms/) (constant)
