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

feat(console): rework (selectable/copyable log text entries) #2908

Merged

Conversation

tens0rfl0w
Copy link
Contributor

Goal of this PR

The goal of this PR is to enhance the functionality and usability of the client and server consoles by implementing selectable and copyable text, improving the user experience, and resolving various interface issues. This includes ensuring that the console input fields are more user-friendly and maintain proper focus behavior, while also improving the visual consistency and functionality of the consoles.

Cfx_selectable_console_log.mp4

How is this PR achieving the goal

  • Selectable/Copyable Text: Introduced a submodule that provides the functionality to select and copy text in ImGui windows. This has been implemented on all available consoles.

  • Modified the text input behavior so that the consoles' text input fields automatically gain focus when no other keyboard-interactive items are active.

  • Addressed viewport overflow issues that caused the entire console window to become scrollable.

  • Adjusted window padding to align with the inner item spacing.

  • The autoscroll ConVar is now initialized only on the client side.

  • Implemented support for disabling autoscrolling in the server console (svgui).

  • Ensured proper synchronization of the autoscroll state between the big console and the win console.

  • Updated the minicon behavior to prevent it from gaining focus when its viewport is clicked, allowing users to maintain focus on the big console regardless of the current mouse position.

  • Modified the draw FPS item to not gain focus upon activation.

  • Enhanced code style and performed general code cleanup

Dependency:

The submodule must either be transferred to the organization or included directly by source. Using the upstream repository is not feasible due to multiple modifications required to integrate it with the FiveM codebase. For reference, changes that were needed can be found here: https://github.com/tens0rfl0w/ImGuiTextSelect.

This PR applies to the following area(s)

FiveM, Server

Successfully tested on

Game builds: Not applicable

Platforms: Windows, Linux

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

/

@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Nov 4, 2024
@titanium-cfx
Copy link

That's a cool QoL improvement, thanks @tens0rfl0w!

@prikolium-cfx
Copy link
Contributor

Hi tens0rfl0w, that's great improvement. Thank you from us and community. Could you please remove submodule and just move this 2 files (they both contains license notice, so it's ok) to our project?

@prikolium-cfx prikolium-cfx self-requested a review November 5, 2024 09:23
feat(console): selectable / copiable text

This allows to select and copy log entries that are displayed in the big, win (client) and svgui (server) console.

tweak(console): rework

- Consoles' text input now gains focus automatically when no other keyboard-interactive items are active.
- Fixed viewport overflow issues that caused the entire console window to become scrollable.
- Reduced window padding to align with inner item spacing.
- The autoscroll ConVar is now only initialized on the client side.
- svgui (server console) now supports disabling autoscrolling.
- Ensured proper synchronization of the autoscroll state between the big console and the win console.
- The minicon will no longer gain focus when its viewport is clicked, maintaining its position behind the 'big' console.
- The draw FPS item will not gain focus upon activation.
- Enhanced code style and performed general code cleanup.
@tens0rfl0w
Copy link
Contributor Author

@prikolium-cfx
Files are now included by source and baked into conhost-v2 directly (backported from C++20 to C++17).

Commits squashed👍🏼

@prikolium-cfx prikolium-cfx added ready-to-merge This PR is enqueued for merging and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Nov 5, 2024
@prikolium-cfx prikolium-cfx merged commit 63bbcd5 into citizenfx:master Nov 5, 2024
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR is enqueued for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants