Start fixing MDI

This commit is contained in:
2025-04-22 13:54:57 +02:00
parent 792272a478
commit f3b508c9f7
8 changed files with 461 additions and 228 deletions

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { onMount, onDestroy, createEventDispatcher } from 'svelte';
import { outputHistory, addToOutputHistory, addToInputHistory, navigateInputHistory, inputHistoryIndex, activeConnection, uiSettings, accessibilitySettings, inputHistory } from '$lib/stores/mudStore';
import { activeOutputHistory, addToOutputHistory, addToInputHistory, navigateInputHistory, activeInputHistoryIndex, activeConnection, uiSettings, accessibilitySettings, activeInputHistory } from '$lib/stores/mudStore';
import { tick } from 'svelte';
import AnsiToHtml from 'ansi-to-html';
import { AccessibilityManager } from '$lib/accessibility/AccessibilityManager';
@@ -106,7 +106,7 @@
addToInputHistory(currentInput);
// Show the command in the output (only if not password - for privacy)
const isPassword = currentInput.startsWith('password') || currentInput.toLowerCase() === $inputHistory[$inputHistory.length - 2]?.toLowerCase().replace('username', 'password');
const isPassword = currentInput.startsWith('password') || currentInput.toLowerCase() === $activeInputHistory[$activeInputHistory.length - 2]?.toLowerCase().replace('username', 'password');
if (!isPassword) {
addToOutputHistory(`> ${currentInput}`, true);
} else {
@@ -146,7 +146,8 @@
} else if (event.key === 'Escape') {
event.preventDefault();
currentInput = '';
inputHistoryIndex.set(-1);
// No need to directly set inputHistoryIndex since we have per-profile indexes now
// This is handled in navigateInputHistory
}
}
@@ -267,7 +268,7 @@
// Watch output history changes to scroll to bottom
$: {
if ($outputHistory) {
if ($activeOutputHistory) {
scrollToBottom();
// Update message elements when output history changes
setTimeout(updateMessageElements, 0);
@@ -317,7 +318,7 @@
tabindex="0"
on:keydown={handleOutputKeyDown}
style="font-family: {$uiSettings.font}; font-size: {$accessibilitySettings.fontSize}px; line-height: {$accessibilitySettings.lineSpacing};">
{#each $outputHistory as item (item.id)}
{#each $activeOutputHistory as item (item.id)}
<!-- For input lines, keep them as a single block -->
{#if item.isInput}
<div class="mud-terminal-line mud-input-line" tabindex="-1">