Skip to content
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

Add setting for number of recent documents #407

Merged
merged 2 commits into from
Oct 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ReText/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def getBundledIcon(iconName):
'markdownDefaultFileExtension': '.mkd',
'openLastFilesOnStartup': False,
'pygmentsStyle': 'default',
'recentDocumentsCount': 10,
'relativeLineNumbers': False,
'restDefaultFileExtension': '.rst',
'rightMargin': 0,
Expand Down
3 changes: 3 additions & 0 deletions ReText/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def initConfigOptions(self):
(self.tr('Behavior'), (
(self.tr('Automatically save documents'), 'autoSave'),
(self.tr('Automatically open last documents on startup'), 'openLastFilesOnStartup'),
(self.tr('Number of recent documents'), 'recentDocumentsCount'),
(self.tr('Restore window geometry'), 'saveWindowGeometry'),
(self.tr('Use live preview by default'), 'livePreviewByDefault'),
(self.tr('Open external links in ReText window'), 'handleWebLinks'),
Expand Down Expand Up @@ -157,6 +158,8 @@ def getPageWidget(self, options):
self.configurators[name] = QSpinBox(self)
if name == 'tabWidth':
self.configurators[name].setRange(1, 10)
elif name == 'recentDocumentsCount':
self.configurators[name].setRange(5, 20)
else:
self.configurators[name].setMaximum(200)
self.configurators[name].setValue(value)
Expand Down
5 changes: 3 additions & 2 deletions ReText/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,9 @@ def moveToTopOfRecentFileList(self, fileName):
if fileName in files:
files.remove(fileName)
files.insert(0, fileName)
if len(files) > 10:
del files[10:]
recentCount = globalSettings.recentDocumentsCount
if len(files) > recentCount:
del files[recentCount:]
writeListToSettings("recentFileList", files)

def createNew(self, text=None):
Expand Down
1 change: 1 addition & 0 deletions configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ option name | type | description
`openLastFilesOnStartup` | boolean | whether to automatically open last documents on startup (default: false)
`paperSize` | string | name of default page size to use for print and export (e.g. A4, Letter)
`pygmentsStyle` | string | name of Pygments syntax highlighting style to use (default: `default`)
`recentDocumentsCount` | integer | number of recent files to show in the menu (default: 10)
`relativeLineNumbers` | boolean | whether to show line numbers as relative from the current line (default: false)
`restDefaultFileExtension` | string | default file extension for reStructuredText files (default: `.rst`)
`rightMargin` | integer | enable drawing of vertical line on defined position (or 0 to disable)
Expand Down