webmail: don't bind to shortcuts ctrl-l, ctrl-u and ctrl-I

ctrl-l is commonly "focus on browser address bar".
ctrl-u is commonly "view source".
ctrl-I (shift i) is commonly "open developer console".

these keys are more useful to leave for the browser.  ctrl-l and ctrl-u (moving
to a message without opening it) can still be had by using also pressing shift.
the previous ctrl-shift-i (show all headers) is now just ctrl-i.

this has been requested in the past on irc/matrix (i forgot who).
This commit is contained in:
Mechiel Lukkien 2024-12-07 11:51:11 +01:00
parent 0a77bc5955
commit 4d3c4115f8
No known key found for this signature in database
2 changed files with 33 additions and 6 deletions

View file

@ -2477,7 +2477,7 @@ const cmdHelp = async () => {
['←', 'collapse'], ['←', 'collapse'],
['→', 'expand'], ['→', 'expand'],
['b', 'show more actions'], ['b', 'show more actions'],
].map(t => dom.tr(dom.td(t[0]), dom.td(t[1]))), dom.tr(dom.td(attr.colspan('2'), dom.h2('Message list', style({ margin: '1ex 0 0 0' })))), dom.tr(dom.td('↓', ', j'), dom.td('down one message'), dom.td(attr.rowspan('6'), css('helpSideNote', { color: '#888', borderLeft: '2px solid', borderLeftColor: '#888', paddingLeft: '.5em' }), 'hold ctrl to only move focus', dom.br(), 'hold shift to expand selection')), [ ].map(t => dom.tr(dom.td(t[0]), dom.td(t[1]))), dom.tr(dom.td(attr.colspan('2'), dom.h2('Message list', style({ margin: '1ex 0 0 0' })))), dom.tr(dom.td('↓', ', j'), dom.td('down one message'), dom.td(attr.rowspan('6'), css('helpSideNote', { color: '#888', borderLeft: '2px solid', borderLeftColor: '#888', paddingLeft: '.5em' }), dom.div('hold ctrl to only move focus', attr.title('ctrl-l and ctrl-u are left for the browser the handle')), dom.div('hold shift to expand selection'))), [
[['↑', ', k'], 'up one message'], [['↑', ', k'], 'up one message'],
['PageDown, l', 'down one screen'], ['PageDown, l', 'down one screen'],
['PageUp, h', 'up one screen'], ['PageUp, h', 'up one screen'],
@ -2523,7 +2523,7 @@ const cmdHelp = async () => {
['O', 'show raw message'], ['O', 'show raw message'],
['ctrl p', 'print message'], ['ctrl p', 'print message'],
['I', 'toggle internals'], ['I', 'toggle internals'],
['ctrl I', 'toggle all headers'], ['ctrl i', 'toggle all headers'],
['alt k, alt ArrowUp', 'scroll up'], ['alt k, alt ArrowUp', 'scroll up'],
['alt j, alt ArrowDown', 'scroll down'], ['alt j, alt ArrowDown', 'scroll down'],
['alt K', 'scroll to top'], ['alt K', 'scroll to top'],
@ -3893,7 +3893,7 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
v: cmdViewAttachments, v: cmdViewAttachments,
t: cmdShowText, t: cmdShowText,
T: cmdShowHTMLCycle, T: cmdShowHTMLCycle,
'ctrl I': cmdToggleHeaders, 'ctrl i': cmdToggleHeaders,
'alt j': cmdDown, 'alt j': cmdDown,
'alt k': cmdUp, 'alt k': cmdUp,
'alt ArrowDown': cmdDown, 'alt ArrowDown': cmdDown,
@ -5380,6 +5380,11 @@ const newMsglistView = (msgElem, activeMailbox, listMailboxes, setLocationHash,
moveclick(i + 1, e.key === 'J'); moveclick(i + 1, e.key === 'J');
} }
else if (e.key === 'PageUp' || e.key === 'h' || e.key === 'H' || e.key === 'PageDown' || e.key === 'l' || e.key === 'L') { else if (e.key === 'PageUp' || e.key === 'h' || e.key === 'H' || e.key === 'PageDown' || e.key === 'l' || e.key === 'L') {
// Commonly bound to "focus to browser address bar", moving cursor to one page down
// without opening isn't useful enough.
if (e.key === 'l' && e.ctrlKey) {
return;
}
if (msgitemViews.length > 0) { if (msgitemViews.length > 0) {
let n = Math.max(1, Math.floor(scrollElemHeight() / mlv.itemHeight()) - 1); let n = Math.max(1, Math.floor(scrollElemHeight() / mlv.itemHeight()) - 1);
if (e.key === 'PageUp' || e.key === 'h' || e.key === 'H') { if (e.key === 'PageUp' || e.key === 'h' || e.key === 'H') {
@ -5423,6 +5428,11 @@ const newMsglistView = (msgElem, activeMailbox, listMailboxes, setLocationHash,
} }
} }
else if (e.key === 'u' || e.key === 'U') { else if (e.key === 'u' || e.key === 'U') {
// Commonly bound to "view source", moving cursor to next unread message without
// opening isn't useful enough.
if (e.key === 'u' && e.ctrlKey) {
return;
}
for (i = i < 0 ? 0 : i + 1; i < msgitemViews.length; i += 1) { for (i = i < 0 ? 0 : i + 1; i < msgitemViews.length; i += 1) {
if (!msgitemViews[i].messageitem.Message.Seen || msgitemViews[i].collapsed && msgitemViews[i].findDescendant(miv => !miv.messageitem.Message.Seen)) { if (!msgitemViews[i].messageitem.Message.Seen || msgitemViews[i].collapsed && msgitemViews[i].findDescendant(miv => !miv.messageitem.Message.Seen)) {
moveclick(i, true); moveclick(i, true);

View file

@ -1212,7 +1212,12 @@ const cmdHelp = async () => {
dom.tr( dom.tr(
dom.td('↓', ', j'), dom.td('↓', ', j'),
dom.td('down one message'), dom.td('down one message'),
dom.td(attr.rowspan('6'), css('helpSideNote', {color: '#888', borderLeft: '2px solid', borderLeftColor: '#888', paddingLeft: '.5em'}), 'hold ctrl to only move focus', dom.br(), 'hold shift to expand selection'), dom.td(
attr.rowspan('6'),
css('helpSideNote', {color: '#888', borderLeft: '2px solid', borderLeftColor: '#888', paddingLeft: '.5em'}),
dom.div('hold ctrl to only move focus', attr.title('ctrl-l and ctrl-u are left for the browser the handle')),
dom.div('hold shift to expand selection'),
),
), ),
[ [
[['↑', ', k'], 'up one message'], [['↑', ', k'], 'up one message'],
@ -1273,7 +1278,7 @@ const cmdHelp = async () => {
['O', 'show raw message'], ['O', 'show raw message'],
['ctrl p', 'print message'], ['ctrl p', 'print message'],
['I', 'toggle internals'], ['I', 'toggle internals'],
['ctrl I', 'toggle all headers'], ['ctrl i', 'toggle all headers'],
['alt k, alt ArrowUp', 'scroll up'], ['alt k, alt ArrowUp', 'scroll up'],
['alt j, alt ArrowDown', 'scroll down'], ['alt j, alt ArrowDown', 'scroll down'],
@ -3156,7 +3161,7 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
v: cmdViewAttachments, v: cmdViewAttachments,
t: cmdShowText, t: cmdShowText,
T: cmdShowHTMLCycle, T: cmdShowHTMLCycle,
'ctrl I': cmdToggleHeaders, 'ctrl i': cmdToggleHeaders,
'alt j': cmdDown, 'alt j': cmdDown,
'alt k': cmdUp, 'alt k': cmdUp,
@ -4981,6 +4986,12 @@ const newMsglistView = (msgElem: HTMLElement, activeMailbox: () => api.Mailbox |
} else if (e.key === 'ArrowDown' || e.key === 'j' || e.key === 'J') { } else if (e.key === 'ArrowDown' || e.key === 'j' || e.key === 'J') {
moveclick(i+1, e.key === 'J') moveclick(i+1, e.key === 'J')
} else if (e.key === 'PageUp' || e.key === 'h' || e.key === 'H' || e.key === 'PageDown' || e.key === 'l' || e.key === 'L') { } else if (e.key === 'PageUp' || e.key === 'h' || e.key === 'H' || e.key === 'PageDown' || e.key === 'l' || e.key === 'L') {
// Commonly bound to "focus to browser address bar", moving cursor to one page down
// without opening isn't useful enough.
if (e.key === 'l' && e.ctrlKey) {
return
}
if (msgitemViews.length > 0) { if (msgitemViews.length > 0) {
let n = Math.max(1, Math.floor(scrollElemHeight()/mlv.itemHeight())-1) let n = Math.max(1, Math.floor(scrollElemHeight()/mlv.itemHeight())-1)
if (e.key === 'PageUp' || e.key === 'h' || e.key === 'H') { if (e.key === 'PageUp' || e.key === 'h' || e.key === 'H') {
@ -5017,6 +5028,12 @@ const newMsglistView = (msgElem: HTMLElement, activeMailbox: () => api.Mailbox |
moveclick(msgitemViews.indexOf(thrmiv), true) moveclick(msgitemViews.indexOf(thrmiv), true)
} }
} else if (e.key === 'u' || e.key === 'U') { } else if (e.key === 'u' || e.key === 'U') {
// Commonly bound to "view source", moving cursor to next unread message without
// opening isn't useful enough.
if (e.key === 'u' && e.ctrlKey) {
return
}
for (i = i < 0 ? 0 : i+1; i < msgitemViews.length; i += 1) { for (i = i < 0 ? 0 : i+1; i < msgitemViews.length; i += 1) {
if (!msgitemViews[i].messageitem.Message.Seen || msgitemViews[i].collapsed && msgitemViews[i].findDescendant(miv => !miv.messageitem.Message.Seen)) { if (!msgitemViews[i].messageitem.Message.Seen || msgitemViews[i].collapsed && msgitemViews[i].findDescendant(miv => !miv.messageitem.Message.Seen)) {
moveclick(i, true) moveclick(i, true)