-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
New file menu item - Reopen Closed Tab #543
Conversation
Thanks for putting some time into this! I don't think that using Also, since <menukey>-shift-t is so widely used for this shortcut, I wouldn't mind changing that. |
@rfindler on futher exploring, recently-opened-files does behave unexpectedly for this feature. I'll set up a new preference that maintains a list of closed tabs. |
Great! The preference will probably need to be initialized and maintained in the racket/gui repo (in the framework, near to where |
I have added a new preference
|
|
|
I see what you mean about removing items from the list (because they were
opened elsewhere). I think we could achieve that goal if we wanted to (I
can dig around to find the single point of control -- I am sure there is
one or we could make one), but if you think it would be clearer to the
users to not do that, I am on board.
Robby
|
I think it would be more straightforward to just reopen the first file, even if it is already open. But rather than reopening the same file again, we can change to the tab where the file is open. Another issue with removing from the list is that there isn't really an easy way to remove files that don't exist anymore. So we would still have to loop through the list while reopening closed tabs until we find a suitable entry. |
That's a great point about just moving to the active tab. Indeed, unless we go to some lengths, just opening the file will send them to the tab where it is already open! Great! |
Indeed, the only way I was able to open the same file twice was by playing around with One problem though. I have retrieved the insertion positions from get-definitions-text, but the values will be lost since |
I think adding a keyword, optional argument that specifies the position to I think that Because the definition of Probably good to remove the shortcut for the other item -- or is that not in DrR? I'm forgetting where it is. And there eventually needs to be an update to |
drracket/drracket/private/unit.rkt
Outdated
@@ -3075,7 +3075,7 @@ | |||
;; create-new-tab : -> void | |||
;; creates a new tab and updates the GUI for that new tab | |||
(define/public create-new-tab | |||
(lambda ([filename #f]) | |||
(lambda ([filename #f] [start-pos 0] [end-pos 'same]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think keyword arguments here is better, eg:
(lambda ([filename #f] #:start-pos [start-pos 0] #:end-pos [end-pos 'same])
drracket/drracket/private/unit.rkt
Outdated
(define/public (open-in-new-tab filename) | ||
(create-new-tab filename)) | ||
(define/public (open-in-new-tab filename [start-pos 0] [end-pos 0]) | ||
(create-new-tab filename start-pos end-pos)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto here for the keywords.
|
Are there any updates on this? |
(for/or ([file (in-list closed-tabs)]) | ||
(define filename (first file)) | ||
(and (file-exists? filename) | ||
(set! closed-tabs (cdr closed-tabs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work properly? Maybe better to remove file-to-open
from closed-tabs
after this loop completes? And if any files were skipped because they don't exist anymore, those should probably be removed from the preference too.
Opens a new tab in this frame. If @racket[filename] is a @racket[path-string?], | ||
It loads that file in the definitions window of the new tab. | ||
It loads that file in the definitions window of the new tab. If @racket[start-pos] and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lowercase "i" in "it".
Sorry for the long delay here @squarebat . I think that it is basically ready to go. I can address the two comments I put in and merge it, if you want? |
Sure!
…On Fri, 1 Apr 2022, 20:16 Robby Findler, ***@***.***> wrote:
Sorry for the long delay here @squarebat <https://github.com/squarebat> .
I think that it is basically ready to go. I can address the two comments I
put in and merge it, if you want?
—
Reply to this email directly, view it on GitHub
<#543 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOCT4DMCPM7DYL634IKFIPTVC4D3PANCNFSM5MD5PBSQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
As discussed in Issue #508 , this PR implements the functionality for reopening previously closed tabs. It has been added to the file menu after
Open Require Path...
as 'Reopen Closed Tab'. SinceCtrl-Shift-T
is reserved for 'Spell Check Test' in the edit menu, I gave this the shortcutCtrl-*
, which might be a bit unintuitive.As in @Metaxal 's quickscript, the callback
reopen-closed-tab
finds the first file in recently-opened-files that isn't already open and still exists. If no tabs were closed in the current session, it will open files that were active in previous sessions. However, after the recently-opened-files list is exhausted, it will just open new tabs. I thought it would be best for the callback to reside in unit.rkt where related methodscreate-new-tab
andopen-in-new-tab
are stored.This has only been manually tested, how should I write the tests for it? I couldn't find an appropriate file in the repository for testing GUI related features.
I will admit I couldn't look into this issue for a long time, and I am extremely sorry about the delay ;-;
The corresponding PR to add the new string constant reopen-closed-tab - string-constants/pull/56