-
Notifications
You must be signed in to change notification settings - Fork 687
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
Implement color hotkeys #810
Conversation
0c3ddb6
to
5c19177
Compare
contextMenuContainer.hide(); | ||
}); | ||
var colorsHotkeys = { | ||
k: "\x03", |
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.
command+k
is already used by clearing the screen on macOS (see L1298)... I don't want us to clearing this to command+l
because it focuses the URL bar, which is immensely useful.
Any other hot key we can use for colors?
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.
Is there any reason not to simply bind Ctrl+K on every platform? That's what a number of existing clients use, and it would reduce The Lounge's learning curve if that keybinding remained the same.
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.
@astorije On windows it uses ctrl+shift+l
. While ctrl+l
focuses address bar, shift modifier does not. Can we do the same on mac?
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.
So cmd+shift+L to clear the screen and cmd+K to set up color? Works for me.
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.
Done.
5c19177
to
03f144b
Compare
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.
Great job on this! 👏
Nice, this works well 👍. After this gets merged perhaps making it easier to see that you've pressed this would be good -- right now it's just a little hard to tell that you've actually entered one of these chars until you hit enter. |
Sadly this is almost impossible with the current |
@astorije it's a branch
…On Tue, 20 Dec 2016, 03:28 Jérémie Astori, ***@***.***> wrote:
Sadly this is almost impossible with the current textarea, but if we ever
go for a rich-content equivalent, it would. Not on the agenda for now
though.
I reckon @xPaw <https://github.com/xPaw> had a crazy idea with
tailor-made font or something, but I can't find it in the issues/PRs.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#810 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAlb07RM58UPJe8b5bM6_8DHtJxQOdLvks5rJy8ygaJpZM4LP9-f>
.
|
Ah ah, I see the result, pretty crazy indeed! I don't think the font-family falls back on the next font when a char is missing (i.e. all non-control-code chars in the case of a font with just B, I, U symbols), does it? |
} | ||
}); | ||
Mousetrap.bind([ | ||
"command+shift+l", |
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.
Write a changelog entry for this change.
client/js/lounge.js
Outdated
"ctrl+" + hotkey | ||
], function(e) { | ||
e.preventDefault(); | ||
input.val(input.val() + colorsHotkeys[e.key]); |
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.
This does not care about cursor position, need to fix.
03f144b
to
f2e43b8
Compare
I've updated the PR to correctly insert formatting characters at the position where the cursor is. Also supports selections. |
@xPaw, I added the new shortcuts in the help windows, let me know what you think. I'll review your recent changes as well. |
@astorije I don't quite understand why we have separate sections for windows and macOS bindings. The only difference is the meta key (ctrl vs ⌘) |
Because that might not be the case for long, due to the different nature of OSes. As a matter of fact, they used to be different before a recent PR. |
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.
Looks good to me.
Implement color hotkeys
Same key bindings as http://www.ircbeginner.com/ircinfo/colors.html
Even though the characters are invisible (in Chrome at least), it's still useful as an initial implementation.
I moved all hotkey bindings into their own scope (add
?w=1
to url for saner diff)