feat(ui): add configurable input panel max rows and horizontal scrolling
- Introduce `ui.input_max_rows` (default 5) to control how many rows the input panel expands before scrolling. - Bump `CONFIG_SCHEMA_VERSION` to **1.2.0** and update migration documentation. - Update `configuration.md` and migration guide to describe the new setting. - Adjust TUI height calculation to respect `input_max_rows` and add horizontal scrolling support for long lines. - Add `unicode-segmentation` dependency for proper grapheme handling.
This commit is contained in:
@@ -679,6 +679,11 @@ impl ChatApp {
|
||||
&self.theme
|
||||
}
|
||||
|
||||
pub fn input_max_rows(&self) -> u16 {
|
||||
let config = self.controller.config();
|
||||
config.ui.input_max_rows.max(1)
|
||||
}
|
||||
|
||||
pub fn set_theme(&mut self, theme: Theme) {
|
||||
self.theme = theme;
|
||||
}
|
||||
@@ -867,18 +872,9 @@ impl ChatApp {
|
||||
}
|
||||
Event::Paste(text) => {
|
||||
// Handle paste events - insert text directly without triggering sends
|
||||
if matches!(self.mode, InputMode::Editing) {
|
||||
// In editing mode, insert the pasted text directly into textarea
|
||||
let lines: Vec<&str> = text.lines().collect();
|
||||
for (i, line) in lines.iter().enumerate() {
|
||||
for ch in line.chars() {
|
||||
self.textarea.insert_char(ch);
|
||||
}
|
||||
// Insert newline between lines (but not after the last line)
|
||||
if i < lines.len() - 1 {
|
||||
self.textarea.insert_newline();
|
||||
}
|
||||
}
|
||||
if matches!(self.mode, InputMode::Editing | InputMode::Visual)
|
||||
&& self.textarea.insert_str(&text)
|
||||
{
|
||||
self.sync_textarea_to_buffer();
|
||||
}
|
||||
// Ignore paste events in other modes
|
||||
|
||||
Reference in New Issue
Block a user