Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions kinode/packages/kino_updates/widget/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,13 @@ fn fetch_most_recent_blog_posts(n: usize) -> Vec<KinodeBlogPost> {
60,
vec![],
) {
Ok(response) => serde_json::from_slice::<Vec<KinodeBlogPost>>(response.body())
.expect("Invalid UTF-8 from kinode.org"),
Ok(response) => match serde_json::from_slice::<Vec<KinodeBlogPost>>(response.body()) {
Ok(posts) => posts,
Err(e) => {
println!("Failed to parse blog posts: {e:?}");
vec![]
}
},
Err(e) => {
println!("Failed to fetch blog posts: {e:?}");
vec![]
Expand Down
33 changes: 31 additions & 2 deletions kinode/src/terminal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,9 @@ pub async fn terminal(
)?;
},
//
// BACKSPACE or DELETE: delete a single character at cursor
// BACKSPACE: delete a single character at cursor
//
KeyCode::Backspace | KeyCode::Delete => {
KeyCode::Backspace => {
if line_col == prompt_len {
continue;
}
Expand Down Expand Up @@ -477,6 +477,35 @@ pub async fn terminal(
)?;
},
//
// DELETE: delete a single character at right of cursor
//
KeyCode::Delete => {
if line_col == current_line.len() {
continue;
}
current_line.remove(line_col);
if search_mode {
utils::execute_search(
&our,
&mut stdout,
&current_line,
prompt_len,
(win_cols, win_rows),
(line_col, cursor_col),
&mut command_history,
search_depth,
)?;
continue;
}
execute!(
stdout,
cursor::MoveTo(0, win_rows),
terminal::Clear(ClearType::CurrentLine),
Print(utils::truncate_in_place(&current_line, prompt_len, win_cols, (line_col, cursor_col))),
cursor::MoveTo(cursor_col, win_rows),
)?;
}
//
// LEFT: move cursor one spot left
//
KeyCode::Left => {
Expand Down