Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Tabline says dirty after undolevels = 0 #624

Closed
cyansprite opened this issue Aug 16, 2017 · 5 comments
Closed

Tabline says dirty after undolevels = 0 #624

cyansprite opened this issue Aug 16, 2017 · 5 comments

Comments

@cyansprite
Copy link
Contributor

cyansprite commented Aug 16, 2017

Vim help:

It is then possible to exit Vim with ":q" instead of ":q!".
Note that this is relative to the last write of the file.  Typing "u" after
":w" actually changes the buffer, compared to what was written, so the buffer
is considered changed then.

So you can change the buffer, but the tab icon is still dirty.
I'm not sure what we need to detect in order to update the tab state, I can do some research on this.

@bryphe
Copy link
Member

bryphe commented Aug 16, 2017

Nice catch... I've seen a bit of flakiness around the dirty indicator so perhaps this is related.

I think right now we are using the 'b:changedtick' variable - perhaps we need to switch to use '&modified'?

@cyansprite
Copy link
Contributor Author

cyansprite commented Aug 16, 2017

right because b:changedtick will change even if you type and then undo like wise undo redo (assuming you saved after a change)

b:changedtick	The total number of changes to the current buffer.  It is
		incremented for each change.  An undo command is also a change
		in this case.  This can be used to perform an action only when
		the buffer has changed. 

so checking &modified should give us the correct answer each time, I just tested it and it and seems correct

'modified' 'mod'	boolean	(default off)
			local to buffer
	When on, the buffer is considered to be modified.  This option is set
	when:
	1. A change was made to the text since it was last written.  Using the
	   |undo| command to go back to the original text will reset the
	   option.  But undoing changes that were made before writing the
	   buffer will set the option again, since the text is different from
	   when it was written.

@bryphe
Copy link
Member

bryphe commented Aug 16, 2017

so checking &modified should give us the correct answer each time, I just tested it and it and seems correct

Cool, that does seem what we want!

To implement this, right now, the UI.Actions.bufferUpdate takes a version parameter. Seems like we'd want to replace that with an isDirty flag. We'd have to modify it in a couple places (action creator, action, reducer, state).

In addition, we don't send up the &modified flag. We might want to add that to the context we send up from neovim -> Oni. If we have that, then we can pass that easily to the bufferUpdate redux action.

cyansprite added a commit to cyansprite/oni that referenced this issue Aug 17, 2017
If one would modify a buffer then undo it, instead of changing from
isDirty to not dirty (tabline with the little circle) it would remain
dirty because ticks update even when undoing...

Therefore check for modified instead.

This would have caused furthur issues whenever we implement
requesting not close on dirty.

Issue(s) : onivim#624
cyansprite added a commit to cyansprite/oni that referenced this issue Aug 17, 2017
If one would modify a buffer then undo it, instead of changing from
isDirty to not dirty (tabline with the little circle) it would remain
dirty because ticks update even when undoing...

Therefore check for modified instead.

This would have caused furthur issues whenever we implement
requesting not close on dirty.

Issue(s) : onivim#624
cyansprite added a commit to cyansprite/oni that referenced this issue Aug 17, 2017
If one would modify a buffer then undo it, instead of changing from
isDirty to not dirty (tabline with the little circle) it would remain
dirty because ticks update even when undoing...

Therefore check for modified instead.

This would have caused furthur issues whenever we implement
requesting not close on dirty.

Issue(s) : onivim#624
cyansprite added a commit to cyansprite/oni that referenced this issue Aug 17, 2017
If one would modify a buffer then undo it, instead of changing from
isDirty to not dirty (tabline with the little circle) it would remain
dirty because ticks update even when undoing...

Therefore check for modified instead.

This would have caused furthur issues whenever we implement
requesting not close on dirty.

Issue(s) : onivim#624
bryphe pushed a commit that referenced this issue Aug 20, 2017
…scrollbar on overflow (#626)

* Fix tabs not changedTick instead of modified

If one would modify a buffer then undo it, instead of changing from
isDirty to not dirty (tabline with the little circle) it would remain
dirty because ticks update even when undoing...

Therefore check for modified instead.

This would have caused furthur issues whenever we implement
requesting not close on dirty.

Issue(s) : #624

* Added back in version, change modified to boolean

* Don't show hidden/unlisted buffers in tabline

* Super simple scrollbar implementation for tabs

* Fix linting
@bryphe
Copy link
Member

bryphe commented Aug 20, 2017

Just tried out the latest changes - works great! The behavior of the dirty flag is working as I'd expect it now 😄 Thanks!

@bryphe bryphe closed this as completed Aug 20, 2017
@bryphe
Copy link
Member

bryphe commented Aug 20, 2017

Since this is closed now, @cyansprite , you should be able to submit the solution @ bountysource. https://www.bountysource.com/issues/48329508-tabline-says-dirty-after-undolevels-0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants