mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
ui tweaks (#442)
This commit is contained in:
@@ -20,7 +20,7 @@ import { ShellModeIndicator } from './components/ShellModeIndicator.js';
|
|||||||
import { EditorState, InputPrompt } from './components/InputPrompt.js';
|
import { EditorState, InputPrompt } from './components/InputPrompt.js';
|
||||||
import { Footer } from './components/Footer.js';
|
import { Footer } from './components/Footer.js';
|
||||||
import { ThemeDialog } from './components/ThemeDialog.js';
|
import { ThemeDialog } from './components/ThemeDialog.js';
|
||||||
import { shortenPath, type Config } from '@gemini-code/server';
|
import { type Config } from '@gemini-code/server';
|
||||||
import { Colors } from './colors.js';
|
import { Colors } from './colors.js';
|
||||||
import { Help } from './components/Help.js';
|
import { Help } from './components/Help.js';
|
||||||
import { loadHierarchicalGeminiMemory } from '../config/config.js';
|
import { loadHierarchicalGeminiMemory } from '../config/config.js';
|
||||||
@@ -342,14 +342,16 @@ export const App = ({
|
|||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
width="100%"
|
width="100%"
|
||||||
>
|
>
|
||||||
<Box>
|
{geminiMdFileCount > 0 && (
|
||||||
<>
|
<Box>
|
||||||
<Text color={Colors.SubtleComment}>cwd: </Text>
|
{process.env.GEMINI_SYSTEM_MD && (
|
||||||
<Text color={Colors.LightBlue}>
|
<Text color={Colors.AccentRed}>|⌐■_■| </Text>
|
||||||
{shortenPath(config.getTargetDir(), 70)}
|
)}
|
||||||
|
<Text color={Colors.SubtleComment}>
|
||||||
|
Using {geminiMdFileCount} GEMINI.md files
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
</Box>
|
||||||
</Box>
|
)}
|
||||||
<Box>
|
<Box>
|
||||||
{showAutoAcceptIndicator && !shellModeActive && (
|
{showAutoAcceptIndicator && !shellModeActive && (
|
||||||
<AutoAcceptIndicator />
|
<AutoAcceptIndicator />
|
||||||
@@ -431,7 +433,6 @@ export const App = ({
|
|||||||
debugMode={config.getDebugMode()}
|
debugMode={config.getDebugMode()}
|
||||||
debugMessage={debugMessage}
|
debugMessage={debugMessage}
|
||||||
cliVersion={cliVersion}
|
cliVersion={cliVersion}
|
||||||
geminiMdFileCount={geminiMdFileCount}
|
|
||||||
corgiMode={corgiMode}
|
corgiMode={corgiMode}
|
||||||
/>
|
/>
|
||||||
<ConsoleOutput debugMode={config.getDebugMode()} />
|
<ConsoleOutput debugMode={config.getDebugMode()} />
|
||||||
|
|||||||
@@ -7,14 +7,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Box, Text } from 'ink';
|
import { Box, Text } from 'ink';
|
||||||
import { Colors } from '../colors.js';
|
import { Colors } from '../colors.js';
|
||||||
import { Config } from '@gemini-code/server';
|
import { shortenPath, tildeifyPath, Config } from '@gemini-code/server';
|
||||||
|
|
||||||
interface FooterProps {
|
interface FooterProps {
|
||||||
config: Config;
|
config: Config;
|
||||||
debugMode: boolean;
|
debugMode: boolean;
|
||||||
debugMessage: string;
|
debugMessage: string;
|
||||||
cliVersion: string;
|
cliVersion: string;
|
||||||
geminiMdFileCount: number;
|
|
||||||
corgiMode: boolean;
|
corgiMode: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,19 +22,16 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
debugMode,
|
debugMode,
|
||||||
debugMessage,
|
debugMessage,
|
||||||
cliVersion,
|
cliVersion,
|
||||||
geminiMdFileCount,
|
|
||||||
corgiMode,
|
corgiMode,
|
||||||
}) => (
|
}) => (
|
||||||
<Box marginTop={1}>
|
<Box marginTop={1}>
|
||||||
<Box>
|
<Box>
|
||||||
{geminiMdFileCount > 0 && (
|
<Text color={Colors.LightBlue}>
|
||||||
<Text color={Colors.SubtleComment}>
|
{shortenPath(tildeifyPath(config.getTargetDir()), 70)}
|
||||||
Using {geminiMdFileCount} GEMINI.md files
|
</Text>
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
{debugMode && (
|
{debugMode && (
|
||||||
<Text color={Colors.AccentRed}>
|
<Text color={Colors.AccentRed}>
|
||||||
{debugMessage || ' | Running in debug mode.'}
|
{' ' + (debugMessage || '--debug')}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
@@ -74,9 +70,6 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
<Text color={Colors.AccentRed}>▼ </Text>
|
<Text color={Colors.AccentRed}>▼ </Text>
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
{process.env.GEMINI_SYSTEM_MD && (
|
|
||||||
<Text color={Colors.AccentRed}>|⌐■_■|</Text>
|
|
||||||
)}
|
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
|||||||
initialCursorOffset={editorState.initialCursorOffset}
|
initialCursorOffset={editorState.initialCursorOffset}
|
||||||
initialText={query}
|
initialText={query}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="Enter your message or use tools (e.g., @src/file.txt)..."
|
placeholder="Type your message or @path/to/file"
|
||||||
/* Account for width used by the box and > */
|
/* Account for width used by the box and > */
|
||||||
navigateUp={inputHistory.navigateUp}
|
navigateUp={inputHistory.navigateUp}
|
||||||
navigateDown={inputHistory.navigateDown}
|
navigateDown={inputHistory.navigateDown}
|
||||||
|
|||||||
@@ -5,6 +5,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
import os from 'os';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces the home directory with a tilde.
|
||||||
|
* @param path - The path to tildeify.
|
||||||
|
* @returns The tildeified path.
|
||||||
|
*/
|
||||||
|
export function tildeifyPath(path: string): string {
|
||||||
|
const homeDir = os.homedir();
|
||||||
|
if (path.startsWith(homeDir)) {
|
||||||
|
return path.replace(homeDir, '~');
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortens a path string if it exceeds maxLen, prioritizing the start and end segments.
|
* Shortens a path string if it exceeds maxLen, prioritizing the start and end segments.
|
||||||
|
|||||||
Reference in New Issue
Block a user