-
Notifications
You must be signed in to change notification settings - Fork 6
Fix text selection from the panes #53
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
4a7c3e3
daba3b6
b275b0d
050f6db
9f41463
4f05f8f
a163a65
e440c69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,9 @@ | ||||||
| from __future__ import annotations | ||||||
| import os | ||||||
| import time | ||||||
| from textual.widgets import RichLog | ||||||
| from textual import events | ||||||
| from textual.reactive import reactive | ||||||
|
|
||||||
|
|
||||||
| class TextScrollView(RichLog): | ||||||
|
|
@@ -10,19 +14,73 @@ class TextScrollView(RichLog): | |||||
| DEFAULT_CSS = """ | ||||||
| TextScrollView { | ||||||
| height: 100%; | ||||||
| scrollbar-size: 1 1; | ||||||
| scrollbar-size: 1 1; | ||||||
| } | ||||||
| """ | ||||||
|
|
||||||
| # Terminal-specific selection tips | ||||||
| SELECTION_TIPS = { | ||||||
| "Terminal.app": "Option(⌥)+Click to select text", | ||||||
| "iTerm2": "Cmd(⌘)+Shift+C: Copy mode | Option(⌥)+Click: Selection", | ||||||
| "Warp": "Shift+Click to select text", | ||||||
| "default": "Use terminal's selection mechanism to copy text" #default mac terminal | ||||||
|
||||||
| "default": "Use terminal's selection mechanism to copy text" #default mac terminal | |
| "default": "Use terminal's selection mechanism to copy text (Maybe Shift+Click)" #default mac terminal |
Does this sound better?
vgvassilev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's show the tip multiple times. I will need it, I can't remember anything 😄.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Vipul-Cariappa I have tried this by setting tip_shown to false again in on_mouse_up function. The other issue I have is about the tip showing multiple times (depending on the pane I scroll+click). So I get multiple tips(one on top of the other) all showing at the same time. This comes from the fact that each pane initialises its own TextScrollView in DiffDebug. How would you go about this ? I have tried using global variables but it still seems to be attached to each instance of TextScrollView. I thought about maybe moving the tip_shown variable to DiffDebug ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not realise you were modifying TextScrollView. I believe you will have to move all these changes to DiffDebug. It belongs there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks!
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be part of __init__. Why recompute this again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks!
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialize self._clicked in __init__. And remove the hasattr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we detect which app we are running and display the relevant tip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is what is done currently(?)
For the "default" which is the Mac terminal, I haven't figured out the command and I don't think it's possible just with a command, that's why I put a general message for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, sounds good. Do we need to enumerate the shortcuts by hand -- isn't there some api that we can use? I bet there is some way to configure these on the user end...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I unfortunately couldn't find any api... I will definitely keep it in mind for later though