E-book viewer: Add shortcuts shift+home and shift+end to extend current selection to start/end of line

This commit is contained in:
Kovid Goyal 2021-05-09 12:37:52 +05:30
parent 1095dc4dc6
commit b9dd3758ea
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 18 additions and 0 deletions

View File

@ -610,6 +610,8 @@ class SelectionBar:
'toggle_highlights': True, 'toggle_highlights': True,
'edit_book': True, 'edit_book': True,
'select_all': True, 'select_all': True,
'extend_selection_to_end_of_line': True,
'extend_selection_to_start_of_line': True,
} }
if sc_name is 'show_chrome': if sc_name is 'show_chrome':
self.clear_selection() self.clear_selection()

View File

@ -350,6 +350,18 @@ def common_shortcuts(): # {{{
_('Alter the current selection forward by a line'), _('Alter the current selection forward by a line'),
), ),
'extend_selection_to_start_of_line': desc(
v"['Shift+Home']",
'ui',
_('Extend current selection to the start of the line'),
),
'extend_selection_to_end_of_line': desc(
v"['Shift+End']",
'ui',
_('Extend current selection to the end of the line'),
),
'select_all': desc( 'select_all': desc(
v'["Ctrl+a"]', v'["Ctrl+a"]',
'ui', 'ui',

View File

@ -575,6 +575,10 @@ class View:
self.iframe_wrapper.send_message('modify_selection', direction='backward', granularity=data.name.rpartition('_')[-1]) self.iframe_wrapper.send_message('modify_selection', direction='backward', granularity=data.name.rpartition('_')[-1])
elif data.name.startsWith('extend_selection_by_'): elif data.name.startsWith('extend_selection_by_'):
self.iframe_wrapper.send_message('modify_selection', direction='forward', granularity=data.name.rpartition('_')[-1]) self.iframe_wrapper.send_message('modify_selection', direction='forward', granularity=data.name.rpartition('_')[-1])
elif data.name is 'extend_selection_to_start_of_line':
self.iframe_wrapper.send_message('modify_selection', direction='backward', granularity='lineboundary')
elif data.name is 'extend_selection_to_end_of_line':
self.iframe_wrapper.send_message('modify_selection', direction='forward', granularity='lineboundary')
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':