diff options
author | hut <hut@lavabit.com> | 2010-08-26 16:02:46 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-08-26 16:02:46 +0200 |
commit | 245e62ce8ce1db96ee053f89e15c68f717b616f9 (patch) | |
tree | 138b59e9f22477d55333c54498187415e0a8e83b /ranger | |
parent | f20fc829c48b2ac4076e388a320fd82580356658 (diff) | |
download | ranger-245e62ce8ce1db96ee053f89e15c68f717b616f9.tar.gz |
core.actions: 12? now opens help chapter 1 subchapter 2
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/actions.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py index c93fa0a5..6b8fc13c 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -524,15 +524,29 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): from ranger.help import get_help, get_help_by_index + scroll_to_line = 0 if narg is not None: - help_text = get_help_by_index(narg) + chapter, subchapter = int(str(narg)[0]), str(narg)[1:] + help_text = get_help_by_index(chapter) + lines = help_text.split('\n') + if chapter: + chapternumber = str(chapter) + '.' + subchapter + '. ' + skip_to_content = True + for line_number, line in enumerate(lines): + if skip_to_content: + if line[:10] == '==========': + skip_to_content = False + else: + if line.startswith(chapternumber): + scroll_to_line = line_number else: help_text = get_help(topic) + lines = help_text.split('\n') pager = self.ui.open_pager() pager.markup = 'help' - lines = help_text.split('\n') pager.set_source(lines) + pager.move(down=scroll_to_line) def display_log(self): if not hasattr(self.ui, 'open_pager'): |