mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Make the commonly used shift+arrow key shortcuts for modifying selections using the keyboard work
Fixes #1919072 [[Enhancement - Viewer] Change which text is selected using Shift+arrow keys](https://bugs.launchpad.net/calibre/+bug/1919072)
This commit is contained in:
parent
a164265c90
commit
99f86498c0
@ -573,9 +573,19 @@ class SelectionBar:
|
|||||||
self.copy_to_clipboard()
|
self.copy_to_clipboard()
|
||||||
return
|
return
|
||||||
sc_name = shortcut_for_key_event(ev, self.view.keyboard_shortcut_map)
|
sc_name = shortcut_for_key_event(ev, self.view.keyboard_shortcut_map)
|
||||||
|
if ev.key is 'ArrowRight' and ev.shiftKey:
|
||||||
|
sc_name = 'extend_selection_by_word'
|
||||||
|
elif ev.key is 'ArrowLeft' and ev.shiftKey:
|
||||||
|
sc_name = 'shrink_selection_by_word'
|
||||||
|
|
||||||
if not sc_name:
|
if not sc_name:
|
||||||
return
|
return
|
||||||
forwarded = {'toggle_highlights': True, 'extend_selection_by_word': True, 'shrink_selection_by_word': True, 'edit_book': True}
|
forwarded = {
|
||||||
|
'toggle_highlights': True,
|
||||||
|
'edit_book': True,
|
||||||
|
'extend_selection_by_word': True, 'shrink_selection_by_word': True,
|
||||||
|
'extend_selection_by_line': True, 'shrink_selection_by_line': True,
|
||||||
|
}
|
||||||
if sc_name is 'show_chrome':
|
if sc_name is 'show_chrome':
|
||||||
self.clear_selection()
|
self.clear_selection()
|
||||||
elif sc_name is 'copy_to_clipboard':
|
elif sc_name is 'copy_to_clipboard':
|
||||||
|
@ -326,6 +326,18 @@ def common_shortcuts(): # {{{
|
|||||||
_('Alter the current selection backwards by a word'),
|
_('Alter the current selection backwards by a word'),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
'extend_selection_by_line': desc(
|
||||||
|
v"['Ctrl+Shift+ArrowDown', 'Shift+ArrowDown']",
|
||||||
|
'ui',
|
||||||
|
_('Alter the current selection forward by a line'),
|
||||||
|
),
|
||||||
|
|
||||||
|
'shrink_selection_by_line': desc(
|
||||||
|
v"['Ctrl+Shift+ArrowUp', 'Shift+ArrowUp']",
|
||||||
|
'ui',
|
||||||
|
_('Alter the current selection backwards by a line'),
|
||||||
|
),
|
||||||
|
|
||||||
'show_chrome': desc(
|
'show_chrome': desc(
|
||||||
v"['Escape', 'ContextMenu']",
|
v"['Escape', 'ContextMenu']",
|
||||||
'ui',
|
'ui',
|
||||||
|
@ -563,6 +563,10 @@ class View:
|
|||||||
self.iframe_wrapper.send_message('modify_selection', direction='backward', granularity='word')
|
self.iframe_wrapper.send_message('modify_selection', direction='backward', granularity='word')
|
||||||
elif data.name is 'extend_selection_by_word':
|
elif data.name is 'extend_selection_by_word':
|
||||||
self.iframe_wrapper.send_message('modify_selection', direction='forward', granularity='word')
|
self.iframe_wrapper.send_message('modify_selection', direction='forward', granularity='word')
|
||||||
|
elif data.name is 'shrink_selection_by_line':
|
||||||
|
self.iframe_wrapper.send_message('modify_selection', direction='backward', granularity='line')
|
||||||
|
elif data.name is 'extend_selection_by_line':
|
||||||
|
self.iframe_wrapper.send_message('modify_selection', direction='forward', granularity='line')
|
||||||
elif data.name is 'scrollspeed_increase':
|
elif data.name is 'scrollspeed_increase':
|
||||||
self.update_scroll_speed(SCROLL_SPEED_STEP)
|
self.update_scroll_speed(SCROLL_SPEED_STEP)
|
||||||
elif data.name is 'scrollspeed_decrease':
|
elif data.name is 'scrollspeed_decrease':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user