@lvce-editor/source-control-worker 2.19.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,
@@ -1744,7 +1745,7 @@ const loadContent = async (state, savedState) => {
1744
1745
  const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, newFileIconCache);
1745
1746
  const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
1746
1747
  const inputPlaceholder = messageEnterToCommitOnMaster();
1747
- const inputBoxHeight = await getInputHeight(inputValue, width, inputFontFamily, inputFontSize, inputFontWeight, inputLetterSpacing, inputLineHeight);
1748
+ const inputBoxHeight = await getInputHeight(inputValue, width, inputFontFamily, inputFontSize, inputFontWeight, inputLetterSpacing, inputLineHeight, inputPadding);
1748
1749
  return {
1749
1750
  ...state,
1750
1751
  actionsCache,
@@ -1833,6 +1834,7 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
1833
1834
  inputFontWeight: 400,
1834
1835
  inputLetterSpacing: 0,
1835
1836
  inputLineHeight: 20,
1837
+ inputPadding: 2,
1836
1838
  inputPlaceholder: '',
1837
1839
  inputSource: 0,
1838
1840
  inputValue: '',
@@ -2259,9 +2261,10 @@ const handleInput = async (state, value, inputSource = User) => {
2259
2261
  inputFontWeight,
2260
2262
  inputLetterSpacing,
2261
2263
  inputLineHeight,
2264
+ inputPadding,
2262
2265
  width
2263
2266
  } = state;
2264
- const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight);
2267
+ const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight, inputPadding);
2265
2268
  return {
2266
2269
  ...state,
2267
2270
  inputBoxHeight,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/source-control-worker",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "description": "Source Control Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"