Skip to content

Commit f59028d

Browse files
authored
Merge pull request #1849 from okdana/dana/kill-to-clipboard
buffer: add kill_to_clipboard setting to control clipboard behaviour
2 parents f896b8d + 4cfdd28 commit f59028d

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Added:
2323
- `channel-context` support
2424
- Expanded `tooltips` setting to allow hiding auto-complete tooltips
2525
- emacs bindings for <kbd>ctrl</kbd> + <kbd>u</kbd> and <kbd>ctrl</kbd> + <kbd>w</kbd>
26+
- `buffer.text_input.kill_to_clipboard` to control key bindings moving killed text to clipboard
2627

2728
Changed:
2829

data/src/config/buffer/text_input.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub struct TextInput {
1111
pub autocomplete: Autocomplete,
1212
pub nickname: Nickname,
1313
pub key_bindings: KeyBindings,
14+
pub kill_to_clipboard: bool,
1415
#[serde(deserialize_with = "deserialize_usize_positive_integer")]
1516
pub max_lines: usize,
1617
pub send_line_delay: u64,
@@ -25,6 +26,7 @@ impl Default for TextInput {
2526
autocomplete: Autocomplete::default(),
2627
nickname: Nickname::default(),
2728
key_bindings: KeyBindings::default(),
29+
kill_to_clipboard: true,
2830
max_lines: 5,
2931
send_line_delay: 100,
3032
persist: true,

docs/configuration/buffer.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,19 @@ Emacs variant has the following binds:
11991199
Global [keyboard shortcuts](/configuration/keyboard) take precedence. Unset any that collide (e.g., set `command_bar = "unset"`).
12001200
:::
12011201

1202+
### `kill_to_clipboard`
1203+
1204+
If enabled, certain key bindings move killed (deleted) text to the clipboard.
1205+
1206+
```toml
1207+
# Type: boolean
1208+
# Values: true, false
1209+
# Default: true
1210+
1211+
[buffer.text_input]
1212+
kill_to_clipboard = true
1213+
```
1214+
12021215
### `max_lines`
12031216

12041217
Maximum number of lines in a single input. If [`multiline`](https://ircv3.net/specs/extensions/multiline) is supported by the server then it will be utilized, otherwise messages will be sent individually with [`send_line_delay`](#send_line_delay) milliseconds between them.

src/buffer/input_view.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,9 @@ impl State {
13151315
text_editor::Motion::WordLeft,
13161316
));
13171317

1318-
let task = if save_to_clipboard {
1318+
let task = if save_to_clipboard
1319+
&& config.buffer.text_input.kill_to_clipboard
1320+
{
13191321
self.input_content.selection().map_or_else(
13201322
Task::none,
13211323
|selection| {
@@ -1339,7 +1341,9 @@ impl State {
13391341
text_editor::Motion::WordRight,
13401342
));
13411343

1342-
let task = if save_to_clipboard {
1344+
let task = if save_to_clipboard
1345+
&& config.buffer.text_input.kill_to_clipboard
1346+
{
13431347
self.input_content.selection().map_or_else(
13441348
Task::none,
13451349
|selection| {
@@ -1363,7 +1367,9 @@ impl State {
13631367
text_editor::Motion::End,
13641368
));
13651369

1366-
let task = if save_to_clipboard {
1370+
let task = if save_to_clipboard
1371+
&& config.buffer.text_input.kill_to_clipboard
1372+
{
13671373
self.input_content.selection().map_or_else(
13681374
Task::none,
13691375
|selection| {
@@ -1386,7 +1392,9 @@ impl State {
13861392
text_editor::Motion::Home,
13871393
));
13881394

1389-
let task = if save_to_clipboard {
1395+
let task = if save_to_clipboard
1396+
&& config.buffer.text_input.kill_to_clipboard
1397+
{
13901398
self.input_content.selection().map_or_else(
13911399
Task::none,
13921400
|selection| {

0 commit comments

Comments
 (0)