Skip to content

Commit d6e6f4d

Browse files
committed
Merge branch 'dev'; Release 1.7.1
cc @jbjornson
2 parents e0f15a5 + 3941c39 commit d6e6f4d

5 files changed

Lines changed: 71 additions & 34 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
File History Changelog
22
======================
33

4+
v1.7.1 (2015-01-29)
5+
-------------------
6+
7+
- ST2: Fix "reopen last tab" not working at all
8+
- ST2: Fix closed tabs not being tracked (which, again, fixes "reopen last tab")
9+
- Fix files opened from the history being recorded twice
10+
- Fix default settings having old setting names and values
11+
12+
413
v1.7.0 (2014-10-03)
514
-------------------
615

FileHistory.sublime-settings

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,88 @@
11
{
2-
// Path to store the history entries in (relative to the sublime packages path)
2+
// Path to store the history entries in (relative to the sublime packages
3+
// path).
34
"history_file": "User/FileHistory.json",
45

5-
// Maximum number of history entries we should keep (older entries truncated)
6+
// Maximum number of history entries we should keep (older entries
7+
// truncated).
68
"global_max_entries": 100,
79

8-
// Maximum number of history entries we should keep (older entries truncated)
10+
// Maximum number of history entries we should keep (older entries
11+
// truncated).
912
"project_max_entries": 50,
1013

11-
// Try to use the saved position of the file or blindly use the "new_tab_position" setting
14+
// Try to use the saved position of the file or blindly use the
15+
// "new_tab_position" setting.
1216
"use_saved_position": true,
1317

14-
// Which position to open a file at when the saved index in no longer valid
18+
// Which position to open a file at when the saved index in no longer
19+
// valid.
1520
//
1621
// Options: "next", "first", "last"
1722
"new_tab_position": "next",
1823

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

22-
// Remove any non-existent files from the history (when previewed or opened)
27+
// Remove any non-existent files from the history (when previewed or
28+
// opened).
2329
"remove_non_existent_files_on_preview": false,
2430

25-
// If a cleanup of the history should be run on startup
31+
// If a cleanup of the history should be run on startup.
2632
"cleanup_on_startup": true,
2733

2834
// Should the history be reset on startup?
2935
//
30-
// BE CAREFUL, this will DELETE ALL of your history entries
36+
// BE CAREFUL, this will DELETE ALL of your history entries.
3137
"delete_all_on_startup": false,
3238

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

3642
// Should the last accessed timestamp be shown in the quick panel?
37-
"display_timestamps": true,
43+
"timestamp_show": true,
3844

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

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

4954
// Which timestamp to display?
5055
// "history_access" - last opened/closed timestamp
5156
// "filesystem" - the file's last modified timestamp
52-
"timestamp_mode": "filesystem",
57+
"timestamp_mode": "history_access",
5358

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

57-
// List of path regexs to exclude from the history tracking
62+
// List of path regexs to exclude from the history tracking.
5863
// Can be extended in project settings (in a "file_histoy" dict).
5964
//
60-
// Note: You must use forward slashes for the path separator (regardless of platform)
61-
// and escape backslashes properly.
62-
// e.g. ["/temp/", "C:/Program Files/Internet Explorer/", "\\.bak$"]
65+
// Note: You must use forward slashes for the path separator (regardless of
66+
// platform) and escape backslashes properly.
67+
//
68+
// Example: ["/temp/", "C:/Program Files/Internet Explorer/", "\\.bak$"]
6369
"path_exclude_patterns": [],
6470

65-
// List of path regexs that will re-include files that were excluded before
71+
// List of path regexs that will re-include files that were excluded before.
6672
// Can be extended in project settings (in a "file_histoy" dict).
6773
//
68-
// Note: You must use forward slashes for the path separator (regardless of platform)
69-
// and escape backslashes properly.
70-
// e.g. ["/temp/", "C:/Program Files/Internet Explorer/", "\\.my\\.bak$"]
74+
// Note: You must use forward slashes for the path separator (regardless of
75+
// platform) and escape backslashes properly.
76+
//
77+
// Example: ["C:/Program Files/Internet Explorer/subdir/", "\\.my\\.bak$"]
7178
"path_reinclude_patterns": [],
72-
73-
// The number of daily backups to keep (backup is saved the first time the history is modified)
79+
80+
// The number of daily backups to keep (backup is saved the first time the
81+
// history is modified).
82+
//
7483
// To turn off backups, change this setting to 0 (zero).
7584
"max_backup_count": 3,
76-
85+
7786
// Print out debug text?
7887
"debug": false
7988
}

file_history.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,9 @@ def open_history(self, window, history_entry):
532532
# Open the file and position the view correctly
533533
new_view = window.open_file(history_entry['filename'])
534534
window.set_view_index(new_view, group, index)
535-
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']))
535+
self.debug('Opened file in group %s, index %s (based on saved group %s, index %s): %s'
536+
% (group, index, history_entry['group'], history_entry['index'], history_entry['filename']))
536537

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

541540
def __close_preview(self, window):
@@ -572,11 +571,19 @@ def is_transient_view(self, window, view):
572571
return view == window.transient_view_in_group(window.active_group())
573572

574573

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

583+
# However, ST2 does not have pre_close (and no transient views either).
584+
if is_ST2:
585+
on_close = on_pre_close
586+
580587
def on_load(self, view):
581588
FileHistory().add_view(sublime.active_window(), view, 'opened')
582589

@@ -718,7 +725,11 @@ def is_active(cls):
718725
def get_view_from_another_group(self, selected_entry):
719726
open_view = self.window.find_open_file(selected_entry['filename'])
720727
if open_view:
721-
calling_group = FileHistory().calling_view_index[0]
728+
if FileHistory().calling_view_index:
729+
# Not always defined at this point
730+
calling_group = FileHistory().calling_view_index[0]
731+
else:
732+
calling_group = self.window.get_view_index(self.window.active_view())
722733
preview_group = self.window.get_view_index(open_view)[0]
723734
if preview_group != calling_group:
724735
return open_view

messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"1.5.1": "messages/1.5.1.md",
55
"1.5.2": "messages/1.5.2.md",
66
"1.6.0": "messages/1.6.0.md",
7-
"1.7.0": "messages/1.7.0.md"
7+
"1.7.0": "messages/1.7.0.md",
8+
"1.7.1": "messages/1.7.1.md"
89
}

messages/1.7.1.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
v1.7.1 (2015-01-29)
2+
-------------------
3+
4+
- ST2: Fix "reopen last tab" not working at all
5+
- ST2: Fix closed tabs not being tracked (which, again, fixes "reopen last tab")
6+
- Fix files opened from the history being recorded twice
7+
- Fix default settings having old setting names and values

0 commit comments

Comments
 (0)