Skip to content
Open
1 change: 1 addition & 0 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Configure global formatting preferences that apply to all widgets:

- **Default Padding** - Add consistent padding around each widget
- **Padding Side** - Choose whether default padding applies to **Both** sides (default), **Left only**, or **Right only**
- Turning Powerline on sets Default Padding to one space. Turning Powerline off puts back the padding from before, unless you changed it while Powerline was on.
- **Default Separator** - Automatically insert a separator between all widgets
- Press **(p)** to edit padding
- Press **(d)** to cycle padding side
Expand Down
5 changes: 3 additions & 2 deletions src/tui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import {
checkPowerlineFonts,
checkPowerlineFontsAsync,
installPowerlineFonts,
type FontInstallResult,
type PowerlineFontStatus
} from '../utils/powerline';
import { getPackageVersion } from '../utils/terminal';
Expand Down Expand Up @@ -565,7 +566,7 @@ export const App: React.FC = () => {
const [terminalWidth, setTerminalWidth] = useState(process.stdout.columns || 80);
const [powerlineFontStatus, setPowerlineFontStatus] = useState<PowerlineFontStatus>({ installed: false });
const [installingFonts, setInstallingFonts] = useState(false);
const [fontInstallMessage, setFontInstallMessage] = useState<string | null>(null);
const [fontInstallMessage, setFontInstallMessage] = useState<FontInstallResult | null>(null);
const [existingStatusLine, setExistingStatusLine] = useState<string | null>(null);
const [flashMessage, setFlashMessage] = useState<FlashMessage | null>(null);
const [currentRefreshInterval, setCurrentRefreshInterval] = useState<number | null>(null);
Expand Down Expand Up @@ -1646,7 +1647,7 @@ export const App: React.FC = () => {
setTimeout(() => {
void installPowerlineFonts().then((result) => {
setInstallingFonts(false);
setFontInstallMessage(result.message);
setFontInstallMessage(result);
// Refresh font status
void checkPowerlineFontsAsync().then((asyncStatus) => {
setPowerlineFontStatus(asyncStatus);
Expand Down
30 changes: 18 additions & 12 deletions src/tui/components/PowerlineSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ import React, { useState } from 'react';
import type { PowerlineConfig } from '../../types/PowerlineConfig';
import type { Settings } from '../../types/Settings';
import { getPlainInput } from '../../utils/input-guards';
import { type PowerlineFontStatus } from '../../utils/powerline';
import { buildEnabledPowerlineSettings } from '../../utils/powerline-settings';
import {
type FontInstallResult,
type PowerlineFontStatus
} from '../../utils/powerline';
import {
buildDisabledPowerlineSettings,
buildEnabledPowerlineSettings
} from '../../utils/powerline-settings';

import { ConfirmDialog } from './ConfirmDialog';
import {
Expand Down Expand Up @@ -103,6 +109,12 @@ export function getThemeDisplay(powerlineConfig: PowerlineConfig): string {
return theme.charAt(0).toUpperCase() + theme.slice(1);
}

// From the install's own result, not its wording: the Windows success message
// doesn't say "success"
export function getFontInstallMessageColor(result: FontInstallResult): 'green' | 'red' {
return result.success ? 'green' : 'red';
}

export function buildPowerlineSetupMenuItems(
powerlineConfig: PowerlineConfig
): ListEntry<PowerlineMenuValue>[] {
Expand Down Expand Up @@ -147,7 +159,7 @@ export interface PowerlineSetupProps {
onBack: () => void;
onInstallFonts: () => void;
installingFonts: boolean;
fontInstallMessage: string | null;
fontInstallMessage: FontInstallResult | null;
onClearMessage: () => void;
}

Expand Down Expand Up @@ -197,13 +209,7 @@ export const PowerlineSetup: React.FC<PowerlineSetupProps> = ({
onUpdate(buildEnabledPowerlineSettings(settings));
}
} else {
onUpdate({
...settings,
powerline: {
...powerlineConfig,
enabled: false
}
});
onUpdate(buildDisabledPowerlineSettings(settings));
}
} else if (shortcut === 'i' || shortcut === 'I') {
setConfirmingFontInstall(true);
Expand Down Expand Up @@ -381,8 +387,8 @@ export const PowerlineSetup: React.FC<PowerlineSetupProps> = ({
</Box>
) : fontInstallMessage ? (
<Box flexDirection='column'>
<Text color={fontInstallMessage.includes('success') ? 'green' : 'red'}>
{fontInstallMessage}
<Text color={getFontInstallMessageColor(fontInstallMessage)}>
{fontInstallMessage.message}
</Text>
<Box marginTop={1}>
<Text dimColor>Press any key to continue...</Text>
Expand Down
Loading
Loading