strip trailing spaces writes to undo stack
Reported by delisa | August 16th, 2010 @ 04:54 PM
After saving with strip trailing spaces enabled, if I try to
undo a previous action, all of the actions on the undo stack are
the removing of the trailing spaces on each line of the file
actions.
Also seems slower than before (though I appreciate that it no
longer jerks to and fro).
Comments and changes to this ticket
-
Steven Hancock August 16th, 2010 @ 05:23 PM
I'll look into this. It's a little slower because it's going through the file line by line now (to prevent the jumping/jerking effect it had before), but I'm sure that change is what's causing it to write to the undo stack. Should be easy enough to solve.
Also just sent Dan a pull request that makes the auto-completer ignore the changes strip trailing spaces makes since that causes problems saving JSON runnables (noticed you got bit by that one).
-
Steven Hancock August 16th, 2010 @ 06:06 PM
Just an update on this one. Because of the was the JFace TextViewerUndoManager and Redcar's sensitivities work, it doesn't look like it's going to be possible to make line by line changes the way Strip Trailing Spaces does without touching the undo stack.
The best option I see is to make all the changes as a compound action, that way instead of filling the undo stack they only take up one undo action. I'll be editing that section of the plugin to look like this.
doc.compound do doc.line_count.times do |l| doc.replace_line(l) { |line_text| line_text.rstrip } end end
That should keep the plugin from filling the undo stack every time you save a file. :)
-
Daniel Lucraft August 16th, 2010 @ 09:28 PM
- State changed from new to open
Thanks Steven, let me know when this is ready to merge.
-
delisa August 16th, 2010 @ 10:56 PM
Thanks so much! Took a while to figure out what was happening to my JSON files too...
-
Steven Hancock August 17th, 2010 @ 12:08 AM
Yeah, I didn't notice that until I tried to edit a JSON file, wasn't happening with anything else I was editing, but that was a simple enough fix.
Dan, I have this bug and the JSON problem taken care of in my strip_trailing_spaces_bugfix branch, sent you a pull request for that branch earlier today. It should ready to merge whenever you want.
-
Daniel Lucraft September 4th, 2010 @ 01:21 PM
- State changed from open to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
A programmer's text editor for Gnome.