First pass on fixes

This commit is contained in:
Piotr Osiewicz 2025-08-19 14:23:59 +02:00
parent 5826d89b97
commit 2f3be75fc7
269 changed files with 1593 additions and 2574 deletions

View file

@ -583,8 +583,8 @@ impl TerminalElement {
strikethrough,
};
if let Some((style, range)) = hyperlink {
if range.contains(&indexed.point) {
if let Some((style, range)) = hyperlink
&& range.contains(&indexed.point) {
if let Some(underline) = style.underline {
result.underline = Some(underline);
}
@ -593,7 +593,6 @@ impl TerminalElement {
result.color = color;
}
}
}
result
}
@ -1275,9 +1274,9 @@ impl Element for TerminalElement {
}
let text_paint_time = text_paint_start.elapsed();
if let Some(text_to_mark) = &marked_text_cloned {
if !text_to_mark.is_empty() {
if let Some(cursor_layout) = &original_cursor {
if let Some(text_to_mark) = &marked_text_cloned
&& !text_to_mark.is_empty()
&& let Some(cursor_layout) = &original_cursor {
let ime_position = cursor_layout.bounding_rect(origin).origin;
let mut ime_style = layout.base_text_style.clone();
ime_style.underline = Some(UnderlineStyle {
@ -1303,14 +1302,11 @@ impl Element for TerminalElement {
.paint(ime_position, layout.dimensions.line_height, window, cx)
.log_err();
}
}
}
if self.cursor_visible && marked_text_cloned.is_none() {
if let Some(mut cursor) = original_cursor {
if self.cursor_visible && marked_text_cloned.is_none()
&& let Some(mut cursor) = original_cursor {
cursor.paint(origin, window, cx);
}
}
if let Some(mut element) = block_below_cursor_element {
element.paint(window, cx);

View file

@ -255,8 +255,7 @@ impl TerminalPanel {
.transpose()
.log_err()
.flatten()
{
if let Ok(serialized) = workspace
&& let Ok(serialized) = workspace
.update_in(&mut cx, |workspace, window, cx| {
deserialize_terminal_panel(
workspace.weak_handle(),
@ -271,7 +270,6 @@ impl TerminalPanel {
{
terminal_panel = Some(serialized);
}
}
}
_ => {}
}
@ -1077,12 +1075,11 @@ pub fn new_terminal_pane(
return ControlFlow::Break(());
}
};
} else if let Some(project_path) = item.project_path(cx) {
if let Some(entry_path) = project.read(cx).absolute_path(&project_path, cx)
} else if let Some(project_path) = item.project_path(cx)
&& let Some(entry_path) = project.read(cx).absolute_path(&project_path, cx)
{
add_paths_to_terminal(pane, &[entry_path], window, cx);
}
}
}
} else if let Some(selection) = dropped_item.downcast_ref::<DraggedSelection>() {
let project = project.read(cx);
@ -1103,11 +1100,10 @@ pub fn new_terminal_pane(
{
add_paths_to_terminal(pane, &[entry_path], window, cx);
}
} else if is_local {
if let Some(paths) = dropped_item.downcast_ref::<ExternalPaths>() {
} else if is_local
&& let Some(paths) = dropped_item.downcast_ref::<ExternalPaths>() {
add_paths_to_terminal(pane, paths.paths(), window, cx);
}
}
ControlFlow::Break(())
});

View file

@ -308,11 +308,10 @@ impl TerminalView {
} else {
let mut displayed_lines = total_lines;
if !self.focus_handle.is_focused(window) {
if let Some(max_lines) = max_lines_when_unfocused {
if !self.focus_handle.is_focused(window)
&& let Some(max_lines) = max_lines_when_unfocused {
displayed_lines = displayed_lines.min(*max_lines)
}
}
ContentMode::Inline {
displayed_lines,
@ -1156,8 +1155,8 @@ fn subscribe_for_terminal_events(
if let Some(opened_item) = opened_items.first() {
if open_target.is_file() {
if let Some(Ok(opened_item)) = opened_item {
if let Some(row) = path_to_open.row {
if let Some(Ok(opened_item)) = opened_item
&& let Some(row) = path_to_open.row {
let col = path_to_open.column.unwrap_or(0);
if let Some(active_editor) =
opened_item.downcast::<Editor>()
@ -1177,7 +1176,6 @@ fn subscribe_for_terminal_events(
.log_err();
}
}
}
} else if open_target.is_dir() {
task_workspace.update(cx, |workspace, cx| {
workspace.project().update(cx, |_, cx| {
@ -1321,8 +1319,8 @@ fn possible_open_target(
}
};
if path_to_check.path.is_relative() {
if let Some(entry) = worktree.read(cx).entry_for_path(&path_to_check.path) {
if path_to_check.path.is_relative()
&& let Some(entry) = worktree.read(cx).entry_for_path(&path_to_check.path) {
return Task::ready(Some(OpenTarget::Worktree(
PathWithPosition {
path: worktree_root.join(&entry.path),
@ -1332,7 +1330,6 @@ fn possible_open_target(
entry.clone(),
)));
}
}
paths_to_check.push(path_to_check);
}
@ -1428,12 +1425,11 @@ fn possible_open_target(
let fs = workspace.read(cx).project().read(cx).fs().clone();
cx.background_spawn(async move {
for mut path_to_check in fs_paths_to_check {
if let Some(fs_path_to_check) = fs.canonicalize(&path_to_check.path).await.ok() {
if let Some(metadata) = fs.metadata(&fs_path_to_check).await.ok().flatten() {
if let Some(fs_path_to_check) = fs.canonicalize(&path_to_check.path).await.ok()
&& let Some(metadata) = fs.metadata(&fs_path_to_check).await.ok().flatten() {
path_to_check.path = fs_path_to_check;
return Some(OpenTarget::File(path_to_check, metadata));
}
}
}
worktree_check_task.await