Browse Source

Add option to modify the scroll padding for the graph (#2378)

* Add option to modify the scroll padding for the graph

* Fix label ref
main
Ramin Tadayon 2 years ago
committed by GitHub
parent
commit
3717d2e19e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 1 deletions
  1. +7
    -0
      package.json
  2. +1
    -0
      src/config.ts
  3. +2
    -0
      src/plus/webviews/graph/graphWebview.ts
  4. +1
    -0
      src/plus/webviews/graph/protocol.ts
  5. +2
    -1
      src/webviews/apps/plus/graph/GraphWrapper.tsx
  6. +15
    -0
      src/webviews/apps/settings/partials/commit-graph.html

+ 7
- 0
package.json View File

@ -2181,6 +2181,13 @@
"scope": "window",
"order": 12
},
"gitlens.graph.scrollRowPadding": {
"type": "number",
"default": 0,
"markdownDescription": "Specifies how many rows from the edge a selected row should be before scrolling starts",
"scope": "window",
"order": 14
},
"gitlens.graph.showDetailsView": {
"type": [
"boolean",

+ 1
- 0
src/config.ts View File

@ -388,6 +388,7 @@ export interface GraphConfig {
dateStyle: DateStyle | null;
defaultItemLimit: number;
highlightRowsOnRefHover: boolean;
scrollRowPadding: number;
showDetailsView: 'open' | 'selection' | false;
showGhostRefsOnRowHover: boolean;
showRemoteNames: boolean;

+ 2
- 0
src/plus/webviews/graph/graphWebview.ts View File

@ -511,6 +511,7 @@ export class GraphWebview extends WebviewBase {
configuration.changed(e, 'graph.dateFormat') ||
configuration.changed(e, 'graph.dateStyle') ||
configuration.changed(e, 'graph.highlightRowsOnRefHover') ||
configuration.changed(e, 'graph.scrollRowPadding') ||
configuration.changed(e, 'graph.showGhostRefsOnRowHover') ||
configuration.changed(e, 'graph.showRemoteNames')
) {
@ -1310,6 +1311,7 @@ export class GraphWebview extends WebviewBase {
dateStyle: configuration.get('graph.dateStyle') ?? configuration.get('defaultDateStyle'),
enableMultiSelection: false,
highlightRowsOnRefHover: configuration.get('graph.highlightRowsOnRefHover'),
scrollRowPadding: configuration.get('graph.scrollRowPadding'),
showGhostRefsOnRowHover: configuration.get('graph.showGhostRefsOnRowHover'),
showRemoteNamesOnRefs: configuration.get('graph.showRemoteNames'),
idLength: configuration.get('advanced.abbreviatedShaLength'),

+ 1
- 0
src/plus/webviews/graph/protocol.ts View File

@ -102,6 +102,7 @@ export interface GraphComponentConfig {
dateStyle: DateStyle;
enableMultiSelection?: boolean;
highlightRowsOnRefHover?: boolean;
scrollRowPadding?: number;
showGhostRefsOnRowHover?: boolean;
showRemoteNamesOnRefs?: boolean;
idLength?: number;

+ 2
- 1
src/webviews/apps/plus/graph/GraphWrapper.tsx View File

@ -402,7 +402,7 @@ export function GraphWrapper({
}
if (id != null) {
queueMicrotask(() => graphRef.current?.selectCommits([id!], false));
queueMicrotask(() => graphRef.current?.selectCommits([id!], false, true));
}
};
@ -728,6 +728,7 @@ export function GraphWrapper({
highlightedShas={searchResults?.ids as GraphContainerProps['highlightedShas']}
highlightRowsOnRefHover={graphConfig?.highlightRowsOnRefHover}
hiddenRefsById={hiddenRefsById}
scrollRowPadding={graphConfig?.scrollRowPadding}
showGhostRefsOnRowHover={graphConfig?.showGhostRefsOnRowHover}
showRemoteNamesOnRefs={graphConfig?.showRemoteNamesOnRefs}
isLoadingRows={isLoading}

+ 15
- 0
src/webviews/apps/settings/partials/commit-graph.html View File

@ -65,6 +65,21 @@
</div>
<div class="setting">
<div class="setting__input">
<label for="graph.scrollRowPadding">Start scrolling at </label>
<input
id="graph.scrollRowPadding"
name="graph.scrollRowPadding"
type="number"
placeholder="0"
data-setting
data-default-value="0"
/>
<label for="graph.scrollRowPadding"> rows from the edge</label>
</div>
</div>
<div class="setting">
<div class="setting__input setting__input--inner-select">
<input
id="graph.showDetailsView"

Loading…
Cancel
Save