Skip to content

Commit

Permalink
Merge branch 'dev'; Release 1.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
FichteFoll committed Jan 29, 2015
2 parents e0f15a5 + 3941c39 commit d6e6f4d
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 34 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
File History Changelog
======================

v1.7.1 (2015-01-29)
-------------------

- ST2: Fix "reopen last tab" not working at all
- ST2: Fix closed tabs not being tracked (which, again, fixes "reopen last tab")
- Fix files opened from the history being recorded twice
- Fix default settings having old setting names and values


v1.7.0 (2014-10-03)
-------------------

Expand Down
65 changes: 37 additions & 28 deletions FileHistory.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,79 +1,88 @@
{
// Path to store the history entries in (relative to the sublime packages path)
// Path to store the history entries in (relative to the sublime packages
// path).
"history_file": "User/FileHistory.json",

// Maximum number of history entries we should keep (older entries truncated)
// Maximum number of history entries we should keep (older entries
// truncated).
"global_max_entries": 100,

// Maximum number of history entries we should keep (older entries truncated)
// Maximum number of history entries we should keep (older entries
// truncated).
"project_max_entries": 50,

// Try to use the saved position of the file or blindly use the "new_tab_position" setting
// Try to use the saved position of the file or blindly use the
// "new_tab_position" setting.
"use_saved_position": true,

// Which position to open a file at when the saved index in no longer valid
// Which position to open a file at when the saved index in no longer
// valid.
//
// Options: "next", "first", "last"
"new_tab_position": "next",

// Should we show a preview of the history entries?
"show_file_preview": true,

// Remove any non-existent files from the history (when previewed or opened)
// Remove any non-existent files from the history (when previewed or
// opened).
"remove_non_existent_files_on_preview": false,

// If a cleanup of the history should be run on startup
// If a cleanup of the history should be run on startup.
"cleanup_on_startup": true,

// Should the history be reset on startup?
//
// BE CAREFUL, this will DELETE ALL of your history entries
// BE CAREFUL, this will DELETE ALL of your history entries.
"delete_all_on_startup": false,

// Should a monospace font be used in the quick panel?
"monospace_font": false,

// Should the last accessed timestamp be shown in the quick panel?
"display_timestamps": true,
"timestamp_show": true,

// How to display the timestamp:
// "relative": how long since the access, e.g. '2 days, 5 hours'
// "absolute": the date and time of the last access
//
// Please note that the "relative" option can cause a delay in the quick panel popping up.
"timestamp_display_type": "relative",
// Whether timestamps should be a relative approximation
// e.g. '2 days, 5 hours', or an absolute timestamp using
// the format below.
"timestamp_relative": true,

// Format of the absolute timestamp that should be added to the history entry
// Format of the absolute timestamp that should be added to the history
// entry.
"timestamp_format": "%Y-%m-%d @ %H:%M:%S",

// Which timestamp to display?
// "history_access" - last opened/closed timestamp
// "filesystem" - the file's last modified timestamp
"timestamp_mode": "filesystem",
"timestamp_mode": "history_access",

// Should the history file be nicely formatted?
"prettify_history": false,

// List of path regexs to exclude from the history tracking
// List of path regexs to exclude from the history tracking.
// Can be extended in project settings (in a "file_histoy" dict).
//
// Note: You must use forward slashes for the path separator (regardless of platform)
// and escape backslashes properly.
// e.g. ["/temp/", "C:/Program Files/Internet Explorer/", "\\.bak$"]
// Note: You must use forward slashes for the path separator (regardless of
// platform) and escape backslashes properly.
//
// Example: ["/temp/", "C:/Program Files/Internet Explorer/", "\\.bak$"]
"path_exclude_patterns": [],

// List of path regexs that will re-include files that were excluded before
// List of path regexs that will re-include files that were excluded before.
// Can be extended in project settings (in a "file_histoy" dict).
//
// Note: You must use forward slashes for the path separator (regardless of platform)
// and escape backslashes properly.
// e.g. ["/temp/", "C:/Program Files/Internet Explorer/", "\\.my\\.bak$"]
// Note: You must use forward slashes for the path separator (regardless of
// platform) and escape backslashes properly.
//
// Example: ["C:/Program Files/Internet Explorer/subdir/", "\\.my\\.bak$"]
"path_reinclude_patterns": [],

// The number of daily backups to keep (backup is saved the first time the history is modified)

// The number of daily backups to keep (backup is saved the first time the
// history is modified).
//
// To turn off backups, change this setting to 0 (zero).
"max_backup_count": 3,

// Print out debug text?
"debug": false
}
21 changes: 16 additions & 5 deletions file_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,9 @@ def open_history(self, window, history_entry):
# Open the file and position the view correctly
new_view = window.open_file(history_entry['filename'])
window.set_view_index(new_view, group, index)
self.debug('Opened file in group %s, index %s (based on saved group %s, index %s): %s' % (group, index, history_entry['group'], history_entry['index'], history_entry['filename']))
self.debug('Opened file in group %s, index %s (based on saved group %s, index %s): %s'
% (group, index, history_entry['group'], history_entry['index'], history_entry['filename']))

# Add the file we just opened to the history and clear the context
invoke_async(self.add_view(window, new_view, 'opened'), 0)
self.__clear_context()

def __close_preview(self, window):
Expand Down Expand Up @@ -572,11 +571,19 @@ def is_transient_view(self, window, view):
return view == window.transient_view_in_group(window.active_group())


#######################################


class OpenRecentlyClosedFileEvent(sublime_plugin.EventListener):
"""class to keep a history of the files that have been opened and closed"""
# We need pre close to detect if the view was transient,
# otherwise it always has (-1, -1) group and index.
def on_pre_close(self, view):
FileHistory().add_view(sublime.active_window(), view, 'closed')

# However, ST2 does not have pre_close (and no transient views either).
if is_ST2:
on_close = on_pre_close

def on_load(self, view):
FileHistory().add_view(sublime.active_window(), view, 'opened')

Expand Down Expand Up @@ -718,7 +725,11 @@ def is_active(cls):
def get_view_from_another_group(self, selected_entry):
open_view = self.window.find_open_file(selected_entry['filename'])
if open_view:
calling_group = FileHistory().calling_view_index[0]
if FileHistory().calling_view_index:
# Not always defined at this point
calling_group = FileHistory().calling_view_index[0]
else:
calling_group = self.window.get_view_index(self.window.active_view())
preview_group = self.window.get_view_index(open_view)[0]
if preview_group != calling_group:
return open_view
Expand Down
3 changes: 2 additions & 1 deletion messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"1.5.1": "messages/1.5.1.md",
"1.5.2": "messages/1.5.2.md",
"1.6.0": "messages/1.6.0.md",
"1.7.0": "messages/1.7.0.md"
"1.7.0": "messages/1.7.0.md",
"1.7.1": "messages/1.7.1.md"
}
7 changes: 7 additions & 0 deletions messages/1.7.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
v1.7.1 (2015-01-29)
-------------------

- ST2: Fix "reopen last tab" not working at all
- ST2: Fix closed tabs not being tracked (which, again, fixes "reopen last tab")
- Fix files opened from the history being recorded twice
- Fix default settings having old setting names and values

0 comments on commit d6e6f4d

Please sign in to comment.