feat(mcp): enhance MCP server registration with error handling and improve transport process management
refactor: update various tools for better error handling and path resolution fix: improve markdown rendering and input display in TUI
This commit is contained in:
@@ -22,19 +22,18 @@ pub fn render(
|
||||
))
|
||||
.border_style(Style::default().fg(Theme::WARNING));
|
||||
let input_text = &state.input.buffer;
|
||||
let display = if input_text.is_empty() {
|
||||
" Type your API key..."
|
||||
let char_count = input_text.chars().count();
|
||||
let display: String = if input_text.is_empty() {
|
||||
" Type your API key...".to_string()
|
||||
} else if char_count > 8 {
|
||||
input_text.chars().take(4).collect()
|
||||
} else {
|
||||
if input_text.len() > 8 {
|
||||
&input_text[..4]
|
||||
} else {
|
||||
input_text.as_str()
|
||||
}
|
||||
input_text.to_string()
|
||||
};
|
||||
let masked = if input_text.is_empty() {
|
||||
display.to_string()
|
||||
display
|
||||
} else {
|
||||
let suffix = if input_text.len() > 8 { "****" } else { "" };
|
||||
let suffix = if char_count > 8 { "****" } else { "" };
|
||||
format!("{display}{suffix}")
|
||||
};
|
||||
let lines = vec![
|
||||
|
||||
@@ -89,12 +89,12 @@ pub fn render(
|
||||
let max_lines = h_chunks[0].height.saturating_sub(2) as usize;
|
||||
let selected = state.misc.selected_index;
|
||||
let start_idx = if selected >= max_lines {
|
||||
selected - max_lines + 1
|
||||
selected.saturating_sub(max_lines).saturating_add(1)
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let end_idx = (start_idx + max_lines).min(left_lines.len());
|
||||
let visible_lines = if left_lines.is_empty() {
|
||||
let visible_lines = if left_lines.is_empty() || start_idx >= left_lines.len() {
|
||||
Vec::new()
|
||||
} else {
|
||||
left_lines[start_idx..end_idx].to_vec()
|
||||
|
||||
Reference in New Issue
Block a user