Skip to content

Commit deec2fa

Browse files
committed
Adds density setting to rebase editor
1 parent a2451f2 commit deec2fa

File tree

8 files changed

+48
-11
lines changed

8 files changed

+48
-11
lines changed

docs/telemetry-events.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3522,6 +3522,7 @@ void
35223522
```typescript
35233523
{
35243524
'context.ascending': boolean,
3525+
'context.config.density': 'compact' | 'comfortable',
35253526
'context.config.openOnPausedRebase': boolean | 'interactive',
35263527
'context.config.ordering': 'asc' | 'desc',
35273528
'context.config.revealBehavior': 'onDoubleClick' | 'onSelection',

package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3705,6 +3705,21 @@
37053705
"title": "Interactive Rebase Editor",
37063706
"order": 600,
37073707
"properties": {
3708+
"gitlens.rebaseEditor.density": {
3709+
"type": "string",
3710+
"default": "compact",
3711+
"enum": [
3712+
"compact",
3713+
"comfortable"
3714+
],
3715+
"enumDescriptions": [
3716+
"Compact layout with minimal spacing",
3717+
"Comfortable layout with more space between rows"
3718+
],
3719+
"markdownDescription": "Specifies the layout density of the _Interactive Rebase Editor_",
3720+
"scope": "window",
3721+
"order": 5
3722+
},
37083723
"gitlens.rebaseEditor.ordering": {
37093724
"type": "string",
37103725
"default": "desc",

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ interface ProxyConfig {
665665
}
666666

667667
interface RebaseEditorConfig {
668+
readonly density: 'compact' | 'comfortable';
668669
readonly openOnPausedRebase: boolean | 'interactive';
669670
readonly ordering: 'asc' | 'desc';
670671
readonly revealLocation: 'graph' | 'inspect';

src/webviews/apps/rebase/components/rebase-entry.css.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const entryStyles = css`
8585
gap: 1rem;
8686
position: relative;
8787
padding-inline: 1rem;
88-
padding-block: 0.2rem;
88+
padding-block: var(--gl-rebase-entry-padding-block, 0.2rem);
8989
border-radius: 0.3rem;
9090
box-sizing: border-box;
9191
color: var(--fg);
@@ -116,13 +116,13 @@ export const entryStyles = css`
116116
117117
&.entry--first {
118118
.entry-graph::before {
119-
inset-block: 50% -0.225rem;
119+
inset-block: 50% var(--gl-rebase-entry-graph-offset, -0.225rem);
120120
}
121121
}
122122
123123
&.entry--last {
124124
.entry-graph::before {
125-
inset-block: -0.225rem 50%;
125+
inset-block: var(--gl-rebase-entry-graph-offset, -0.225rem) 50%;
126126
}
127127
}
128128
@@ -224,7 +224,7 @@ export const entryStyles = css`
224224
position: relative;
225225
flex: 0 0 auto;
226226
width: 16px;
227-
height: 25px;
227+
height: var(--gl-rebase-entry-graph-height, 25px);
228228
z-index: 2;
229229
230230
/* circle for commits */
@@ -252,7 +252,7 @@ export const entryStyles = css`
252252
&::before {
253253
content: '';
254254
position: absolute;
255-
inset-block: -0.225rem;
255+
inset-block: calc(-1 * var(--gl-rebase-entry-padding-block, 0.2rem));
256256
width: 0;
257257
border-right: 2px solid var(--action-line-color);
258258
z-index: -2;

src/webviews/apps/rebase/rebase.css.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ export const rebaseStyles = css`
147147
grid-template-columns: minmax(0, 1fr);
148148
height: 100vh;
149149
min-width: 0;
150+
box-sizing: border-box;
151+
padding: 0.5rem;
150152
}
151153
152154
/* ==========================================================================
@@ -174,9 +176,8 @@ export const rebaseStyles = css`
174176
display: flex;
175177
flex-direction: column;
176178
gap: 0.5rem;
177-
padding: 0.6rem 1rem;
179+
padding: 0.5rem 1rem;
178180
min-width: 0;
179-
border-bottom: 1px solid var(--vscode-sideBarSectionHeader-border);
180181
181182
gl-checkbox {
182183
margin-block: 0;
@@ -313,12 +314,15 @@ export const rebaseStyles = css`
313314
.entries {
314315
grid-area: entries;
315316
display: block;
316-
height: 100%;
317317
min-height: 0;
318318
overflow-x: hidden !important;
319319
overflow-y: visible;
320320
outline: none;
321-
margin-inline: 1rem;
321+
margin: 0.5rem 1rem;
322+
box-sizing: border-box;
323+
324+
border-top: 1px solid var(--vscode-sideBarSectionHeader-border);
325+
border-bottom: 1px solid var(--vscode-sideBarSectionHeader-border);
322326
}
323327
324328
.entries {
@@ -387,7 +391,6 @@ export const rebaseStyles = css`
387391
align-items: center;
388392
gap: 1rem;
389393
padding: 0.5rem 1rem;
390-
border-top: 1px solid var(--vscode-sideBarSectionHeader-border);
391394
background: var(--color-background);
392395
z-index: 1;
393396
min-width: 0;
@@ -459,4 +462,14 @@ export const rebaseStyles = css`
459462
gl-button:hover .button-shortcut {
460463
opacity: 1;
461464
}
465+
466+
/* ==========================================================================
467+
Density: Comfortable
468+
========================================================================== */
469+
470+
.container[data-density='comfortable'] {
471+
--gl-rebase-entry-padding-block: 0.5rem;
472+
--gl-rebase-entry-graph-height: 29px;
473+
--gl-rebase-entry-graph-offset: -0.5rem;
474+
}
462475
`;

src/webviews/apps/rebase/rebase.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,9 +1171,13 @@ export class GlRebaseEditor extends GlAppHost<State, RebaseStateProvider> {
11711171
const isReadOnly = this.state.isReadOnly ?? false;
11721172
const isActive = this.isRebasing;
11731173
const isEmptyOrNoop = this.isEmptyOrNoop;
1174+
const density = this.state.density ?? 'compact';
11741175

11751176
return html`
1176-
<div class="container ${isReadOnly ? 'read-only' : ''} ${isActive ? 'active-rebase' : ''}">
1177+
<div
1178+
class="container ${isReadOnly ? 'read-only' : ''} ${isActive ? 'active-rebase' : ''}"
1179+
data-density="${density}"
1180+
>
11771181
${guard(
11781182
[
11791183
this.state.branch,

src/webviews/rebase/protocol.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export interface State extends WebviewState<'gitlens.rebase'> {
3333
*/
3434
isReadOnly?: boolean;
3535

36+
/** Layout density */
37+
density: Config['rebaseEditor']['density'];
3638
/** Where to reveal commits when clicking on links or double-clicking rows */
3739
revealLocation: Config['rebaseEditor']['revealLocation'];
3840
/** When to automatically reveal commits */

src/webviews/rebase/rebaseWebviewProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ export class RebaseWebviewProvider implements Disposable {
761761
authors: authors != null ? Object.fromEntries(authors) : {},
762762
ascending: this.ascending,
763763
isReadOnly: processed.preservesMerges,
764+
density: configuration.get('rebaseEditor.density'),
764765
revealLocation: configuration.get('rebaseEditor.revealLocation'),
765766
revealBehavior: this.getRevealBehavior(),
766767
rebaseStatus: rebaseStatus,

0 commit comments

Comments
 (0)