mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
first spike of buffer modified indicator
This commit is contained in:
@@ -186,6 +186,7 @@ class Buffer
|
||||
@change(range, '')
|
||||
|
||||
change: (oldRange, newText) ->
|
||||
@trigger 'buffer-change'
|
||||
oldRange = Range.fromObject(oldRange)
|
||||
operation = new BufferChangeOperation({buffer: this, oldRange, newText})
|
||||
@pushOperation(operation)
|
||||
@@ -223,6 +224,7 @@ class Buffer
|
||||
@undoManager.redo(editSession)
|
||||
|
||||
save: ->
|
||||
@trigger 'buffer-change'
|
||||
@saveAs(@getPath())
|
||||
|
||||
saveAs: (path) ->
|
||||
|
||||
@@ -17,7 +17,9 @@ class StatusBar extends View
|
||||
|
||||
@content: ->
|
||||
@div class: 'status-bar', =>
|
||||
@div class: 'current-path', outlet: 'currentPath'
|
||||
@div class: 'file-info', =>
|
||||
@div class: 'current-path', outlet: 'currentPath'
|
||||
@div class: 'buffer-modified', outlet: 'bufferModified'
|
||||
@div class: 'cursor-position', outlet: 'cursorPosition'
|
||||
|
||||
initialize: (@rootView, @editor) ->
|
||||
@@ -27,6 +29,15 @@ class StatusBar extends View
|
||||
@updateCursorPositionText()
|
||||
@editor.on 'cursor-move', => @updateCursorPositionText()
|
||||
|
||||
@updateBufferModifiedText()
|
||||
@editor.getBuffer().on 'buffer-change', => @updateBufferModifiedText()
|
||||
|
||||
updateBufferModifiedText: ->
|
||||
if @editor.getBuffer().isModified()
|
||||
@bufferModified.text('*')
|
||||
else
|
||||
@bufferModified.text('')
|
||||
|
||||
updatePathText: ->
|
||||
path = @editor.getPath()
|
||||
if path
|
||||
@@ -37,4 +48,3 @@ class StatusBar extends View
|
||||
updateCursorPositionText: ->
|
||||
{ row, column } = @editor.getCursorBufferPosition()
|
||||
@cursorPosition.text("#{row + 1},#{column + 1}")
|
||||
|
||||
|
||||
@@ -5,6 +5,14 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.status-bar .file-info {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.status-bar .buffer-modified {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.status-bar .cursor-position {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
|
||||
Reference in New Issue
Block a user