mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-344583 git: save 'staged' Document on disk to put file into "Staged" list on modifications
GitOrigin-RevId: 1727c264e6f5a0fdb0e3a003d17d94dfd5dfc854
This commit is contained in:
committed by
intellij-monorepo-bot
parent
70d4bb1db8
commit
b11445cf23
@@ -329,6 +329,8 @@ class GitStageLineStatusTracker(
|
||||
}
|
||||
|
||||
private inner class MyDocumentTrackerHandler(private val unstaged: Boolean) : DocumentTracker.Handler {
|
||||
private var wasEmpty = isTrackerEmpty()
|
||||
|
||||
override fun afterBulkRangeChange(isDirty: Boolean) {
|
||||
cachedBlocks = null
|
||||
|
||||
@@ -336,16 +338,14 @@ class GitStageLineStatusTracker(
|
||||
if (!isDirty) listeners.multicaster.onRangesChanged()
|
||||
|
||||
if (isOperational()) {
|
||||
if (unstaged) {
|
||||
if (unstagedTracker.blocks.isEmpty()) {
|
||||
val isEmpty = isTrackerEmpty()
|
||||
if (wasEmpty != isEmpty) {
|
||||
wasEmpty = isEmpty
|
||||
|
||||
if (isEmpty && unstaged) {
|
||||
saveDocumentWhenUnchanged(project, document)
|
||||
saveDocumentWhenUnchanged(project, stagedDocument)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (stagedTracker.blocks.isEmpty()) {
|
||||
saveDocumentWhenUnchanged(project, stagedDocument)
|
||||
}
|
||||
saveDocumentWhenUnchanged(project, stagedDocument)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,6 +354,15 @@ class GitStageLineStatusTracker(
|
||||
updateHighlighters()
|
||||
listeners.multicaster.onRangesChanged()
|
||||
}
|
||||
|
||||
private fun isTrackerEmpty(): Boolean {
|
||||
if (unstaged) {
|
||||
return unstagedTracker.blocks.isEmpty()
|
||||
}
|
||||
else {
|
||||
return stagedTracker.blocks.isEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MyLineStatusMarkerPopupRenderer(
|
||||
|
||||
Reference in New Issue
Block a user