Skip to content

[gui] add Select All option to terminal right click menu #4211

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

levkropp
Copy link
Contributor

@levkropp levkropp commented Jul 3, 2025

image
This pull request introduces a new option to the right click menu in the terminal tab in the GUI, enabling users to select all text within the terminal buffer. The changes include the addition of a new Intent class, modifications to the context menu, and implementation of the logic for selecting all terminal text.

New Feature: Select All Terminal Text

  • Added SelectAllTerminalTextIntent class: Introduced a new Intent class to handle the "Select All" functionality.
  • Updated context menu: Added a new "Select All" option in the terminal's context menu, which triggers the SelectAllTerminalTextIntent.
  • Implemented selection logic: Defined the logic for selecting all meaningful text in the terminal buffer, ensuring that only non-empty lines are included in the selection. This involves creating anchors for the start and end of the selection and applying it via the terminalController.

Copy link

codecov bot commented Jul 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.35%. Comparing base (526c3e5) to head (deb9c30).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4211   +/-   ##
=======================================
  Coverage   89.35%   89.35%           
=======================================
  Files         259      259           
  Lines       15721    15721           
=======================================
  Hits        14047    14047           
  Misses       1674     1674           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricab
Copy link
Collaborator

ricab commented Jul 4, 2025

This is a nice initiative Lev, but it would be the first right-click menu. @vikorama's, I'd love your opinion in that regard.

@vikorama
Copy link
Collaborator

vikorama commented Jul 4, 2025

@ricab seems that this right-click menu is already there, at least on Mac:

image

So, if it's only about adding the 'Select all' option, I can't think of arguments for or against it.

@levkropp How did you come up with this idea? Would it improve any of your own workflows? As I user I normally just drag a cursor to select what I want.

@ricab
Copy link
Collaborator

ricab commented Jul 4, 2025

Ohh, my bad, sorry. I thought it was a new thing.

@levkropp
Copy link
Contributor Author

levkropp commented Jul 4, 2025

@levkropp How did you come up with this idea? Would it improve any of your own workflows? As I user I normally just drag a cursor to select what I want.

This idea came from #4192 which suggests a GUI toolbar at the top of the screen as an accessibility enhancement for Multipass. It suggests options for Copy, Paste, and Select All among others

image

Select All is a common option in right click menus for terminals. Above is the right click menu of the built in Terminal in Visual Studio Code as an example. Use cases would be for people who want to quickly select all information on their terminal screen with just 2 clicks, or those who have accessibility issues regarding the ability to click-and-drag

So regardless of future implementation plans for #4192's toolbar itself, I think Select All being implemented is a valuable addition to our GUI terminal's right click menu.

@vikorama
Copy link
Collaborator

vikorama commented Jul 9, 2025

Thank you for sharing the original request Lev! Something to look into, as I heard about similar struggles from other users.

This PR looks like a good step in the direction!

@levkropp levkropp requested review from Sploder12 and vikorama July 9, 2025 18:43
@levkropp
Copy link
Contributor Author

levkropp commented Jul 9, 2025

Thanks @vikorama ! Could I bother you for an approval on this?

@alexio-dev
Copy link

alexio-dev commented Jul 10, 2025

It would also be interesting to add the + and - buttons for zoom in one line, such as the GNOME terminal.

@alexio-dev
Copy link

@ricab seems that this right-click menu is already there, at least on Mac:

image

So, if it's only about adding the 'Select all' option, I can't think of arguments for or against it.

@levkropp How did you come up with this idea? Would it improve any of your own workflows? As I user I normally just drag a cursor to select what I want.

macOS offers tabs everywhere, if it is feasible it would be useful to block those of the system and provide a universal one.

@vikorama
Copy link
Collaborator

Thanks @vikorama ! Could I bother you for an approval on this? Here's an Intel Mac package for this PR: https://multipass-ci.s3.amazonaws.com/pr4211/multipass-1.17.0-dev.3884.pr4211%2Bg94a20f20.mac.x86_64-Darwin.pkg

@levkropp it's an honor. The Select all works like a charm, so I can approve this PR. One thing tho is that I realised I could not triple-click within a paragraph of text so that the whole paragraph gets selected. This is the expected behaviour in Mac's and Windows' terminals (Ubuntu too, right?). Is this easy to fix maybe in this PR?

@levkropp
Copy link
Contributor Author

One thing tho is that I realised I could not triple-click within a paragraph of text so that the whole paragraph gets selected. This is the expected behaviour in Mac's and Windows' terminals (Ubuntu too, right?). Is this easy to fix maybe in this PR?

Hey @vikorama , I wasn't able to reproduce this triple-click behavior on a KDE Konsole on Kubuntu 24.04 or on a Powershell Terminal on Windows 11 Pro. This may be a Mac-specific (Terminal.app) feature?

It also seems that this is not a very straightforward feature to implement in our Flutter GUI as it stands (I attempted a quick solution by wrapping the Terminal in a GestureDetector and calling the function to select all text when a triple click is detected, but this does not work) and may even require changes to our fork of terminal plugin we are using.

Copy link
Collaborator

@vikorama vikorama left a comment

Choose a reason for hiding this comment

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

Thanks @levkropp! LGTM then

@levkropp levkropp force-pushed the gui-terminal-selectall branch 3 times, most recently from 4565fc7 to 3f24346 Compare July 11, 2025 13:04
@levkropp levkropp force-pushed the gui-terminal-selectall branch from 3f24346 to deb9c30 Compare July 14, 2025 18:21
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.

4 participants