Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat up and down arrow key scrolls over chat channel message history #3059

Conversation

Kimo-s
Copy link
Contributor

@Kimo-s Kimo-s commented Nov 27, 2023

Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Merging #3059 (9a284d5) into develop (47ef44e) will decrease coverage by 0.08%.
The diff coverage is 28.57%.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3059      +/-   ##
=============================================
- Coverage      58.98%   58.90%   -0.08%     
+ Complexity      4458     4455       -3     
=============================================
  Files            561      561              
  Lines          20322    20350      +28     
  Branches        1025     1033       +8     
=============================================
+ Hits           11987    11988       +1     
- Misses          7790     7813      +23     
- Partials         545      549       +4     
Files Coverage Δ
...om/faforever/client/chat/ChannelTabController.java 85.85% <ø> (ø)
...forever/client/chat/AbstractChatTabController.java 69.50% <28.57%> (-3.67%) ⬇️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47ef44e...9a284d5. Read the comment docs.

Copy link
Member

@Sheikah45 Sheikah45 left a comment

Choose a reason for hiding this comment

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

I will probably put this one on hold until #3050 is merged because it reworks how the chat messages are handled and then this becomes easier to do in a consistent way.

@Sheikah45
Copy link
Member

Now that the state overhaul has been deployed you can use this with the chat messages kept in the chatChannel object once you rebase

@Kimo-s Kimo-s force-pushed the feature/#2881-arrow-up-insert-latest-chat-message branch from e81b1c8 to 65e94b7 Compare December 2, 2023 02:34
Copy link
Member

@Sheikah45 Sheikah45 left a comment

Choose a reason for hiding this comment

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

This is generally applicable across all chat channels so should be in the abstractTabController not the ChannelTabController

Copy link
Member

@Sheikah45 Sheikah45 left a comment

Choose a reason for hiding this comment

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

After testing there are a few things that should probably change to make this usable:

  • There is no way currently to get back to a blank/in progress message
  • You can easily lose the message you are typing by pressing the up or down arrow key accidentally
  • when there is text it was taking two button presses to traverse the message history

Copy link
Member

@Sheikah45 Sheikah45 left a comment

Choose a reason for hiding this comment

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

Looking good just some minor things.

Additionally it would be good to place the cursor at the end of the text after the up or down arrow navigation

Comment on lines 145 to 146
private String currentUserMessage = "";
private int curMessageHistoryIndex = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Move these down with the other private non final variable declarations

@@ -431,6 +465,9 @@ private void sendAction(final TextInputControl messageTextField, final String te
}

protected void onChatMessage(ChatMessage chatMessage) {
if(chatMessage.username().equals(playerService.getCurrentPlayer().getUsername())) {
userMessageHistory.add(chatMessage);
Copy link
Member

Choose a reason for hiding this comment

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

We should make sure to limit this to a max size. Lets just go with 50

Comment on lines 469 to 476
if(chatMessage.username().equals(playerService.getCurrentPlayer().getUsername())) {
if(userMessageHistory.size() >= 50){
userMessageHistory.remove(0);
userMessageHistory.add(chatMessage);
} else {
userMessageHistory.add(chatMessage);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

One thing I realized is that this is probably better off put in the send message method. Then you don't have to check the username

Comment on lines 229 to 233
if(event.getCode() == KeyCode.DOWN)
curMessageHistoryIndex--;
if(event.getCode() == KeyCode.UP)
curMessageHistoryIndex++;
Copy link
Member

Choose a reason for hiding this comment

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

Add brackets to the if statement

@Sheikah45 Sheikah45 force-pushed the feature/#2881-arrow-up-insert-latest-chat-message branch from 4abd7ff to 9a284d5 Compare December 15, 2023 00:02
@Sheikah45 Sheikah45 enabled auto-merge (squash) December 15, 2023 00:03
@Sheikah45 Sheikah45 disabled auto-merge December 15, 2023 00:14
@Sheikah45 Sheikah45 merged commit aeabfe0 into FAForever:develop Dec 15, 2023
3 of 4 checks passed
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