@lvce-editor/source-control-worker 2.18.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1491,28 +1491,28 @@ const getGroups = async enabledProviderIds => {
|
|
|
1491
1491
|
};
|
|
1492
1492
|
};
|
|
1493
1493
|
|
|
1494
|
-
const getTextHeight = async (input, width, fontFamily, fontSize, fontWeight, letterSpacing, lineHeight) => {
|
|
1494
|
+
const getTextHeight = async (input, width, fontFamily, fontSize, fontWeight, letterSpacing, lineHeight, inputPadding) => {
|
|
1495
1495
|
try {
|
|
1496
1496
|
if (!input) {
|
|
1497
|
-
return lineHeight;
|
|
1497
|
+
return lineHeight + inputPadding * 2;
|
|
1498
1498
|
}
|
|
1499
1499
|
const actualInput = input;
|
|
1500
1500
|
// TODO line height could also be like 1.5
|
|
1501
1501
|
const lineHeightPx = `${lineHeight}px`;
|
|
1502
1502
|
// @ts-ignore
|
|
1503
1503
|
const height = await invoke(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
|
|
1504
|
-
return height;
|
|
1504
|
+
return height + inputPadding * 2;
|
|
1505
1505
|
} catch {
|
|
1506
1506
|
// fallback
|
|
1507
1507
|
const lines = input.split('\n');
|
|
1508
1508
|
const lineCount = lines.length;
|
|
1509
|
-
const inputHeight = lineCount * lineHeight;
|
|
1509
|
+
const inputHeight = lineCount * lineHeight + inputPadding * 2;
|
|
1510
1510
|
return inputHeight;
|
|
1511
1511
|
}
|
|
1512
1512
|
};
|
|
1513
1513
|
|
|
1514
|
-
const getInputHeight = async (input, width, fontFamily, fontWeight, fontSize, letterSpacing, lineHeight) => {
|
|
1515
|
-
const height = await getTextHeight(input, width, fontFamily, fontSize, fontWeight, letterSpacing, lineHeight);
|
|
1514
|
+
const getInputHeight = async (input, width, fontFamily, fontWeight, fontSize, letterSpacing, lineHeight, inputPadding) => {
|
|
1515
|
+
const height = await getTextHeight(input, width, fontFamily, fontSize, fontWeight, letterSpacing, lineHeight, inputPadding);
|
|
1516
1516
|
return height;
|
|
1517
1517
|
};
|
|
1518
1518
|
|
|
@@ -1710,6 +1710,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1710
1710
|
inputFontWeight,
|
|
1711
1711
|
inputLetterSpacing,
|
|
1712
1712
|
inputLineHeight,
|
|
1713
|
+
inputPadding,
|
|
1713
1714
|
itemHeight,
|
|
1714
1715
|
minimumSliderSize,
|
|
1715
1716
|
width,
|
|
@@ -1732,6 +1733,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1732
1733
|
|
|
1733
1734
|
// TODO make preferences async and more functional
|
|
1734
1735
|
const splitButtonEnabled = await get$1('sourceControl.splitButtonEnabled');
|
|
1736
|
+
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
1735
1737
|
const total = displayItems.length;
|
|
1736
1738
|
const contentHeight = total * itemHeight;
|
|
1737
1739
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
@@ -1743,11 +1745,12 @@ const loadContent = async (state, savedState) => {
|
|
|
1743
1745
|
const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, newFileIconCache);
|
|
1744
1746
|
const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
|
|
1745
1747
|
const inputPlaceholder = messageEnterToCommitOnMaster();
|
|
1746
|
-
const inputBoxHeight = await getInputHeight(inputValue, width, inputFontFamily, inputFontSize, inputFontWeight, inputLetterSpacing, inputLineHeight);
|
|
1748
|
+
const inputBoxHeight = await getInputHeight(inputValue, width, inputFontFamily, inputFontSize, inputFontWeight, inputLetterSpacing, inputLineHeight, inputPadding);
|
|
1747
1749
|
return {
|
|
1748
1750
|
...state,
|
|
1749
1751
|
actionsCache,
|
|
1750
1752
|
allGroups,
|
|
1753
|
+
badgeCount,
|
|
1751
1754
|
decorationIcons: iconDefinitions,
|
|
1752
1755
|
enabledProviderIds,
|
|
1753
1756
|
fileIconCache: newFileIconCache,
|
|
@@ -1831,6 +1834,7 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1831
1834
|
inputFontWeight: 400,
|
|
1832
1835
|
inputLetterSpacing: 0,
|
|
1833
1836
|
inputLineHeight: 20,
|
|
1837
|
+
inputPadding: 2,
|
|
1834
1838
|
inputPlaceholder: '',
|
|
1835
1839
|
inputSource: 0,
|
|
1836
1840
|
inputValue: '',
|
|
@@ -2010,6 +2014,7 @@ const refresh = async state => {
|
|
|
2010
2014
|
} = await getGroups(enabledProviderIds);
|
|
2011
2015
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2012
2016
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2017
|
+
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
2013
2018
|
const total = displayItems.length;
|
|
2014
2019
|
const contentHeight = total * itemHeight;
|
|
2015
2020
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
@@ -2024,6 +2029,7 @@ const refresh = async state => {
|
|
|
2024
2029
|
...state,
|
|
2025
2030
|
actionsCache,
|
|
2026
2031
|
allGroups,
|
|
2032
|
+
badgeCount,
|
|
2027
2033
|
enabledProviderIds,
|
|
2028
2034
|
fileIconCache: newFileIconCache,
|
|
2029
2035
|
finalDeltaY,
|
|
@@ -2125,6 +2131,7 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2125
2131
|
itemHeight
|
|
2126
2132
|
} = state;
|
|
2127
2133
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2134
|
+
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
2128
2135
|
const total = displayItems.length;
|
|
2129
2136
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
2130
2137
|
const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
|
|
@@ -2133,6 +2140,7 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2133
2140
|
const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, fileIconCache);
|
|
2134
2141
|
return {
|
|
2135
2142
|
...state,
|
|
2143
|
+
badgeCount,
|
|
2136
2144
|
expandedGroups,
|
|
2137
2145
|
items: displayItems,
|
|
2138
2146
|
maxLineY,
|
|
@@ -2253,9 +2261,10 @@ const handleInput = async (state, value, inputSource = User) => {
|
|
|
2253
2261
|
inputFontWeight,
|
|
2254
2262
|
inputLetterSpacing,
|
|
2255
2263
|
inputLineHeight,
|
|
2264
|
+
inputPadding,
|
|
2256
2265
|
width
|
|
2257
2266
|
} = state;
|
|
2258
|
-
const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight);
|
|
2267
|
+
const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight, inputPadding);
|
|
2259
2268
|
return {
|
|
2260
2269
|
...state,
|
|
2261
2270
|
inputBoxHeight,
|