Repository navigation
Fix #341: Switch chat input history only from the first or last visual line - #514
Open
Lars Vogel (vogella) wants to merge 1 commit into
Open
Lars Vogel (vogella) wants to merge 1 commit into
Lars Vogel (vogella) wants to merge 1 commit into
Conversation
Lars Vogel (vogella)
requested review from
Ethan Hou (ethanyhou),
Sheng Chen (jdneo) and
xinyi-gong
as code owners
November 5, 2026 18:07
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The test fixture leaves getChatFontService() unstubbed, causing a NullPointerException during viewer setup before any of the four new regression tests reaches its assertions.
1 open issue
What changed in this PR
This PR addresses #341 by preserving normal arrow-key navigation in the Eclipse chat input and switching history only when the caret cannot move.
Changes:
- Compare caret offsets before and after key handling instead of tracking logical line numbers.
- Remove obsolete line-tracking state and reset logic.
- Add regression tests for wrapped-line navigation and history switching.
| File | Description |
|---|---|
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ChatInputTextViewer.java |
Uses caret movement to distinguish text navigation from history switching. |
com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/ChatInputTextViewerTests.java |
Adds service mocks and four arrow-key regression tests. |
Review effort: Balanced
Comment on lines
+52
to
+53
| lenient().when(mockChatServiceManager.getUserPreferenceService()).thenReturn(mockUserPreferenceService); | ||
| lenient().when(mockChatServiceManager.getChatCompletionService()).thenReturn(mockChatCompletionService); |
…ast visual line The chat input guessed from the logical line number whether an arrow key moved the caret, so moving within a wrapped line, or from a line reached by mouse, replaced the prompt with an older one. It now checks before the key is handled whether the caret is on the first or last visual line and only then switches the history. Assisted-by: multiple AI agents and layers of automated tooling 🤖
Lars Vogel (vogella)
force-pushed
the
chat-input-arrow-keys-history
branch
from
November 6, 2026 01:13
d8301eb to
e4f9923
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pressing the up or down arrow in a multi-line chat prompt could replace the whole prompt with an older one instead of moving the caret. The input guessed whether the caret had moved by comparing logical line numbers, which stay the same within a word-wrapped line and go stale after a mouse click. It now checks, before StyledText handles the key, whether the caret is on the first or last visual line, and switches the input history only from there, so arrow keys behave like in any other text field while history stays one key press away. This also removes the line tracking state, and new tests cover wrapped-line navigation and history switching; the test fixture now stubs the chat font service and rethrows failures from the display thread, so its tests actually run. Fixes #341.