I’ve created an implementation of split views in TextMate. It is basically 
complete, except for one issue that I haven’t been able to fix and I am asking 
for help on this. I am posting it here rather than creating a Pull Request for 
several reasons. First, the known issue can be pretty serious, though it is not 
common in normal use. Second, my commits generally need work (which I 
appreciate, btw) and given the number of commits this may take some time to be 
ready for master. Third, I don’t want the pull request to become like the 
GitHub issue for split views, so I thought it would be better to post it here 
to work on, then when ready for master I’ll submit a Pull Request that can be 
merged quickly.

The usage is fairly simple, there are 4 new options in the View menu to control 
the splitting. The tab bar is global, it shows all the open document and the 
currently active document is highlighted. Selecting a new document in the tab 
bar will change the currently active split to show that document. Closing a 
document closes it from all of the splits that are showing it. The active 
document is changed by clicking inside a document (or menu options in Windows). 
Thats pretty much it.

Now the issue: if there are many documents open and they are closed “too fast" 
(holding CMD+W works) then the coherence of the documents is lost and the 
windows may end up in a state where closing “Untitled” opens “Untitled 2”, and 
closing “Untitled 2” opens “Untitled” and the window doesn’t close. Worse yet, 
the splits do not show a new document, they show documents that should have 
already been closed. I believe this is caused by the fact that 
`openAndSelectDocument` is somewhat asynchronous, and “too fast” perhaps means 
that the documents are closed faster than the new documents are open. But, 
since I have not been able to fix this problem perhaps my assessment is wrong.

The implementation is on my fork:

Steven Clukey

textmate-dev mailing list

Reply via email to