Skip to content

feat(terminal): add terminal emulator support - #7

Merged
nathabonfim59 merged 20 commits into
mainfrom
terminal.main
Dec 20, 2024
Merged

feat(terminal): add terminal emulator support#7
nathabonfim59 merged 20 commits into
mainfrom
terminal.main

Conversation

@nathabonfim59

Copy link
Copy Markdown
Member

This pull request introduces a terminal feature to the application and includes various updates to support this functionality. The changes span across the backend (app.go) and frontend (package-lock.json, package.json, and several Svelte components).

Backend changes:

  • Added TerminalService to the App struct and initialized it in the startup method. This service handles terminal events and communicates with the frontend. (app.go) [1] [2] [3]
  • Implemented methods in App for creating, destroying, resizing terminals, and handling terminal input. (app.go)

Frontend changes:

  • Updated dependencies to include xterm.js and its addons for terminal emulation. (package-lock.json, package.json) [1] [2] [3] [4]
  • Introduced TerminalPane.svelte to manage terminal tabs and interactions. (frontend/src/lib/editor/panes/TerminalPane.svelte)
  • Added BottomPane.svelte to encapsulate the bottom pane of the editor, which includes the terminal. (frontend/src/lib/editor/panes/BottomPane.svelte)
  • Enhanced ResizeHandle.svelte to support both vertical and horizontal resizing, improving the UI/UX for resizing panes. (frontend/src/lib/editor/ResizeHandle.svelte) [1] [2] [3]
  • Modified Select.svelte to use tailwind-merge for better class merging. (frontend/src/lib/components/Select.svelte) [1] [2]

These changes collectively add a robust terminal feature to the application, enhancing its functionality and user experience.

1. Better cleanup of terminal instances
2. Proper handling of component lifecycle
3. Prevention of operations on destroyed terminals
4. Improved state management in the store
5. Prevent line wrap
- Add scroll buttons for terminal tabs (left/right navigation)
- Implement smooth tab scrolling behavior
- Hide scrollbars while maintaining scroll functionality
- Add visual separators between navigation controls
- Auto-scroll to active tab when selected
- Add smooth centering of tabs in container
- Add delay for DOM updates before scrolling
- Return new tab ID from store for immediate reference
- Improve tab scroll positioning calculation
- Add terminal service for managing multiple terminal instances
- Implement terminal screen handling with tcell library
- Add terminal event handling and lifecycle management
- Add terminal input/output processing
- Implement terminal resize functionality
- Add cursor position tracking and screen content management
- Add terminal options configuration support
…tion

- Add TerminalService with terminal instance management
- Implement terminal event handling and lifecycle management
- Add terminal resize functionality and cursor tracking
- Integrate terminal frontend with backend communication
- Add terminal input/output handling
- Implement terminal creation and destruction endpoints
- Add terminal event notification system
- Migrate terminal backend from tcell to pty for full TTY support
- Add base64 encoding/decoding for terminal data
- Add debug logs for terminal operations
- Enhance terminal event handling with PTY lifecycle
- Improve error handling and terminal cleanup
- Add TERM environment variable configuration
- Remove screen.go and simplify terminal architecture
- Update terminal resizing to use PTY native functions
- Calculate terminal rows accounting for status bar height
- Add TODO comment for future dynamic status bar height handling
…ormance

- Refactor terminal component for better lifecycle management
- Improve terminal initialization and cleanup logic
- Add base64 encoding for input handling
- Optimize terminal resizing and event handling
- Fix terminal tab visibility with absolute positioning
- Add isInitialized flag to prevent duplicate initialization
…onsiveness

- Add active state detection and auto-focus for terminals
- Implement debounced resize handling with 100ms delay
- Fix terminal tab switching behavior and focus management
- Add resize timeout cleanup on component destroy
- Adjust status bar height calculation to 3 rows
- Fix type safety with null checks
- Add automatic terminal focus handling when switching tabs
- Implement ctrl+j shortcut to open terminal panel
- Add terminal state management with bottomPaneStore
- Improve keyboard context switching between editor and terminal
- Add focus method to XtermComponent for external control
- Update tab click behavior to focus terminal automatically
- Fix keyboard context handling in bottom pane collapse state
…handling

- Add focus tracking and restoration between editor and terminal
- Implement Alt+J shortcut to return to previous context
- Add keyboard event handling for terminal shortcuts
- Improve editor focus management with focusStore integration
- Format keyboard store code for better readability
- Add xterm addons (fit, search, webgl) for enhanced terminal functionality
- Implement terminal manager for better instance tracking and lifecycle
- Add terminal ID-based management and cleanup
- Update terminal service to handle ID-based operations
- Refactor terminal creation and destruction logic

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 10 out of 25 changed files in this pull request and generated no comments.

Files not reviewed (15)
  • frontend/package-lock.json: Language not supported
  • frontend/package.json: Language not supported
  • frontend/package.json.md5: Language not supported
  • frontend/src/lib/components/Select.svelte: Language not supported
  • frontend/src/lib/editor/Editor.svelte: Language not supported
  • frontend/src/lib/editor/ResizeHandle.svelte: Language not supported
  • frontend/src/lib/editor/panes/BottomPane.svelte: Language not supported
  • frontend/src/lib/editor/panes/TerminalPane.svelte: Language not supported
  • frontend/src/lib/terminal/XtermComponent.svelte: Language not supported
  • frontend/src/routes/Editor.svelte: Language not supported
  • go.mod: Language not supported
  • frontend/src/stores/keyboardStore.ts: Evaluated as low risk
  • frontend/src/stores/terminalStore.ts: Evaluated as low risk
  • frontend/src/types/keyboard.ts: Evaluated as low risk
  • frontend/src/types/ui.ts: Evaluated as low risk
Comments suppressed due to low confidence (1)

frontend/src/lib/terminal/types.ts:1

  • This file is empty and should either be removed or populated with relevant content.
+

@nathabonfim59
nathabonfim59 merged commit e8a931c into main Dec 20, 2024
@nathabonfim59
nathabonfim59 deleted the terminal.main branch December 20, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants