Skip to content

Config editor buffer#2097

Open
casperstorm wants to merge 10 commits into
mainfrom
pane/text_editor
Open

Config editor buffer#2097
casperstorm wants to merge 10 commits into
mainfrom
pane/text_editor

Conversation

@casperstorm

@casperstorm casperstorm commented Jun 14, 2026

Copy link
Copy Markdown
Member

This introduces a config editor pane for easy edit of the config file.
You can ctrl(cmd)+s to save, and you can also press refresh or save in pane header.

Screenshot 2026-06-14 at 15 51 25

@casperstorm casperstorm force-pushed the pane/text_editor branch 2 times, most recently from 81436f4 to 57912d4 Compare June 15, 2026 19:47
@andymandias andymandias force-pushed the pane/text_editor branch 2 times, most recently from ad60d28 to cc1e0ba Compare June 16, 2026 17:36
@casperstorm casperstorm force-pushed the pane/text_editor branch 2 times, most recently from 1767839 to 6669278 Compare June 19, 2026 20:53

@andymandias andymandias left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is really neat, should reduce friction for users who would rather not open a separate text editor (hopefully meaningfully so for such users), and is well integrated so we can use any benefits brought to it into the input box as well. Case in point, the undo/redo feature added as a side quest to this PR.

I have a few nits, but I think this is a very solid initial implementation.

Comment thread src/buffer/input_view.rs
Comment on lines +313 to +336
// Undo / redo
if key_press.modifiers.command() {
match key_press.key.as_ref() {
iced::keyboard::Key::Character("z")
if key_press.modifiers.shift() =>
{
return Some(text_editor::Binding::Custom(
Message::Redo,
));
}
iced::keyboard::Key::Character("z") => {
return Some(text_editor::Binding::Custom(
Message::Undo,
));
}
iced::keyboard::Key::Character("y") => {
return Some(text_editor::Binding::Custom(
Message::Redo,
));
}
_ => {}
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be in text_editor_key_bindings?

Comment thread src/buffer/input_view.rs
Comment on lines +153 to 255
fn kill_binding(
kill: text_editor_key_bindings::Kill,
) -> text_editor::Binding<Message> {
text_editor::Binding::Custom(Message::Kill(kill, true))
}

#[cfg(target_os = "macos")]
fn platform_specific_key_bindings(
key_press: text_editor::KeyPress,
selection: Option<&str>,
) -> Option<text_editor::Binding<Message>> {
match key_press.key.as_ref() {
iced::keyboard::Key::Named(iced::keyboard::key::Named::Backspace)
if key_press.modifiers.alt() && selection.is_none() =>
{
Some(text_editor::Binding::Custom(Message::DeleteWordBackward(
Some(text_editor::Binding::Custom(Message::Kill(
text_editor_key_bindings::Kill::WordBackward,
false,
)))
}
iced::keyboard::Key::Named(iced::keyboard::key::Named::Backspace)
if key_press.modifiers.logo() && selection.is_none() =>
{
Some(text_editor::Binding::Custom(Message::DeleteToStart(false)))
Some(text_editor::Binding::Custom(Message::Kill(
text_editor_key_bindings::Kill::ToStart,
false,
)))
}
iced::keyboard::Key::Named(iced::keyboard::key::Named::Delete)
if key_press.modifiers.alt() =>
{
Some(text_editor::Binding::Custom(Message::DeleteWordForward(
Some(text_editor::Binding::Custom(Message::Kill(
text_editor_key_bindings::Kill::WordForward,
false,
)))
}
iced::keyboard::Key::Named(iced::keyboard::key::Named::Delete)
if key_press.modifiers.logo() =>
{
Some(text_editor::Binding::Custom(Message::DeleteToEnd(false)))
Some(text_editor::Binding::Custom(Message::Kill(
text_editor_key_bindings::Kill::ToEnd,
false,
)))
}
// cmd+v routes to Message::Paste normally, which means we lose our control flow. overwrite it with our own handler
iced::keyboard::Key::Character("v") if key_press.modifiers.logo() => {
Some(text_editor::Binding::Custom(Message::Paste))
}
_ => None,
}
}

#[cfg(not(target_os = "macos"))]
fn platform_specific_key_bindings(
key_press: text_editor::KeyPress,
selection: Option<&str>,
) -> Option<text_editor::Binding<Message>> {
match key_press.key.as_ref() {
iced::keyboard::Key::Named(iced::keyboard::key::Named::Backspace)
if key_press.modifiers.control() && selection.is_none() =>
{
if key_press.modifiers.shift() {
Some(text_editor::Binding::Custom(Message::DeleteToStart(
Some(text_editor::Binding::Custom(Message::Kill(
text_editor_key_bindings::Kill::ToStart,
false,
)))
} else {
Some(text_editor::Binding::Custom(Message::DeleteWordBackward(
Some(text_editor::Binding::Custom(Message::Kill(
text_editor_key_bindings::Kill::WordBackward,
false,
)))
}
}
iced::keyboard::Key::Named(iced::keyboard::key::Named::Delete)
if key_press.modifiers.control() =>
{
if key_press.modifiers.shift() {
Some(text_editor::Binding::Custom(Message::DeleteToEnd(false)))
Some(text_editor::Binding::Custom(Message::Kill(
text_editor_key_bindings::Kill::ToEnd,
false,
)))
} else {
Some(text_editor::Binding::Custom(Message::DeleteWordForward(
Some(text_editor::Binding::Custom(Message::Kill(
text_editor_key_bindings::Kill::WordForward,
false,
)))
}
}
iced::keyboard::Key::Named(iced::keyboard::key::Named::Insert)
if key_press.modifiers.shift() && key_press.text.is_none() =>
{
Some(text_editor::Binding::Custom(Message::Paste))
}
// ctrl+v routes to Message::Paste normally, which means we lose our control flow. overwrite it with our own handler
iced::keyboard::Key::Character("v")
if key_press.modifiers.control() =>
{
Some(text_editor::Binding::Custom(Message::Paste))
}

_ => None,
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to put these inside the text_editor_key_bindings module, so they could be re-used in the config editor?

Comment thread src/buffer.rs
Comment on lines -788 to +823
| Buffer::ChannelDiscovery(_) => Task::none(),
| Buffer::ChannelDiscovery(_)
| Buffer::ConfigEditor(_) => Task::none(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pass PageUp to the config editor. Similarly with scroll_down_page. Otherwise, PageUp/PageDown are inoperable in the Config Editor by default (in Linux/Windows).

Comment thread CHANGELOG.md
Added:

- Internal buffers (logs, highlights, etc) can be added to sidebar
- Config editor pane for editing the config file in-app

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add an entry for undo/redo. Very nice feature addition that needs a shout out.

Comment thread src/buffer.rs
| Buffer::FileTransfers(_)
| Buffer::ChannelDiscovery(_) => Task::none(),
| Buffer::ChannelDiscovery(_)
| Buffer::ConfigEditor(_) => Task::none(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to page-up/down, I think this should work in the config editor to scroll to the bottom of the file (and scroll_to_start should scroll to the top of the file).

@andymandias andymandias linked an issue Jul 4, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature request] text input ctrl + z/y undo/redo

2 participants