Retain cursor position on file change
Jake Archibald 12 years ago • updated by Steven Lacerda 2 years ago • 20
When a file has changed, Sublime picks up the change and updates the view. However, the scroll and cursor position are reset to the top.
It would be great if it retained the previous cursor position, even it if was simply the same line & char position (which may be different content following the edit).
Even better, it could try and place the cursor back on the same line even if that line has moved. A diff would provide the info.
Customer support service by UserEcho
I'm totally fine with the line/char position being retained and figuring out the context switch from there. There's a much better change of being in the right area where as going to the top is almost never where I want to be.
If only reloading the file could be disabled, it would be fine for me...
I often do modifications in both ST and VisualStudio interchangeably. Mainly because it's much faster to find a file in ST (Go to anywhere rocks while VS Express doesn't have such equivalent) but then I don't have auto-completion in ST so I can't use it all the time.
It's so annoying when after doing some small change in VS, ST scrolls file to the top. Also collapsing (loosing position of) all the bookmarks so that they end up on the first line is a bad issue. Please, please have a look at that.
Basically I have a log file loaded in the editor, and I would like the cursor to stay where it is instead of scrolling back to the top every time the log is being written to. Were you able to get BufferScroll to do something like that?
This is a deal breaker for me, I work in a company with >10 other devs, a few of us use Sublime Text 2 already (Unregistered) but find this issue extremely frustrating.
Save work, load web page (related to the save), go back to ST2 to look at the code and find the file has been refreshed and the cursor sent to the top of the page. Ctrl+Z seems to get the cursor back to the correct position but seems a bit lame having to do that every time you check your work. I (and others) would love to purchase ST2 to support this awesome editor - please fix!
(Here is a valid test to demonstrate the issue;
* open a large file (be it a log file or code file etc)
* position your cursor say, 2,000 or so lines through the code,
* open a terminal, use the "touch" command to touch the file
* look at your code/log again - Oh no! It's been reloaded without your consent and your cursor is now at line1, column1.)
Imagine now that, instead of arbitrarily "touching" the file, it's touched by a process such as reloading the php source via apache because you've edited your code, or your system administrator has just updated a file search index, or the automated backups have just run...
This is especially troubling when in a large log file, code file or data file. The file doesn't have to have been written to even for this behaviour to kick in...
This is *NOT* a feature - it is a bug and as Woody says, a deal breaker.
We cannot signoff licence purchases for ST2 without resolution of this issue.
Fixed in nightly.
Seems to be fixed in Version 3.0 Build 308
I am running version 3.2.2 3211 and this is still causing me havoc