-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Make alt+click behavior configurable #3181
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
Conversation
|
Just a note: I am working on adding a couple of tests:
But I thought I would push up the PR with the implementation right away to get feedback on that. |
|
I am struggling with writing tests for this. It appears that interaction with the DOM is explicitly disabled in the |
|
Just wondering if we want to make this a breaking change. Before, the alt-click behavior was enabled by default. With this change it's disabled by default and must be enabled. It may be that we should disable it; I don't know, but I thought I'd ask. |
I meant for this not to be a breaking change. I set the default value to |
mofux
left a comment
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 for the contribution! Looks good so far, IMO no additional tests for this feature are required. There are still some missing bits though:
Please add the new option here:
xterm.js/src/browser/public/Terminal.ts
Line 173 in 84fa6be
| public getOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'disableStdin' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'visualBell'): boolean; |
and here:
xterm.js/src/browser/public/Terminal.ts
Line 185 in 84fa6be
| public setOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'disableStdin' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'visualBell', value: boolean): void; |
and here:
xterm.js/src/common/services/Services.ts
Line 186 in 84fa6be
| export interface IPartialTerminalOptions { |
| false | ||
| ); | ||
| if (coordinates && coordinates[0] !== undefined && coordinates[1] !== undefined) { | ||
| if (this._optionsService.getOption('altClickMovesCursor') && coordinates && coordinates[0] !== undefined && coordinates[1] !== undefined) { |
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 think the check for this option should be moved up to the parent if statement:
| if (this.selectionText.length <= 1 && timeElapsed < ALT_CLICK_MOVE_CURSOR_TIME && event.altKey) { |
|
Thanks @mofux, I made all of your requested changes |
|
@awmottaz I see, my mistake! |
|
Thanks @awmottaz 🙂 |
Adds a new Boolean option
altClickMovesCursorwhich enables/disables the alt+click behavior that moves the prompt cursor to the location of the mouse.Closes #3145