feat: 优化代码变更面板样式和交互

- 优化变更面板和 diff 视图样式
   - 新增全部采纳和全部拒绝按钮
   - 修复删除文件的变更追踪和采纳逻辑
   - 整个标题栏可点击展开/收起
   - 增强视觉效果和用户体验
This commit is contained in:
Roe-xin
2026-03-02 10:37:45 +08:00
parent 4c7ec65577
commit 5f88c7ceac
4 changed files with 201 additions and 43 deletions

View File

@ -121,49 +121,68 @@ export function getDiffStyles(): string {
return `
.diff-viewer {
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 12px;
line-height: 1.5;
font-size: 13px;
line-height: 1.6;
background: var(--vscode-editor-background);
border: 1px solid var(--vscode-panel-border);
border-radius: 4px;
overflow-x: auto;
border-radius: 6px;
overflow: hidden;
}
.diff-line {
display: flex;
align-items: center;
padding: 2px 0;
padding: 4px 0;
white-space: pre;
transition: background 0.15s;
}
.diff-line:hover {
background: var(--vscode-list-hoverBackground);
}
.diff-line-add {
background: rgba(40, 167, 69, 0.15);
background: rgba(40, 167, 69, 0.2);
border-left: 3px solid #28a745;
}
.diff-line-add:hover {
background: rgba(40, 167, 69, 0.25);
}
.diff-line-remove {
background: rgba(220, 53, 69, 0.15);
background: rgba(220, 53, 69, 0.2);
border-left: 3px solid #dc3545;
}
.diff-line-remove:hover {
background: rgba(220, 53, 69, 0.25);
}
.diff-line-context {
background: transparent;
border-left: 3px solid transparent;
}
.line-num {
display: inline-block;
width: 40px;
width: 45px;
text-align: right;
padding: 0 8px;
padding: 0 10px;
color: var(--vscode-editorLineNumber-foreground);
user-select: none;
flex-shrink: 0;
font-size: 11px;
opacity: 0.7;
}
.line-prefix {
display: inline-block;
width: 20px;
width: 24px;
text-align: center;
font-weight: bold;
flex-shrink: 0;
font-size: 14px;
}
.diff-line-add .line-prefix {
@ -176,7 +195,7 @@ export function getDiffStyles(): string {
.line-content {
flex: 1;
padding-right: 8px;
padding: 0 12px 0 8px;
overflow-x: auto;
}
`;