Skip to content

Commit

Permalink
Fix changed line updating (#2231)
Browse files Browse the repository at this point in the history
  • Loading branch information
fox0430 authored Feb 3, 2025
1 parent 6d4338c commit 5dc4754
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _#2231: https://github.com/fox0430/moe/pull/2231

Fixed
.....

- `#2231`_ Fix changed line updating

6 changes: 5 additions & 1 deletion src/moepkg/editorstatus.nim
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,10 @@ proc updateSyntaxHighlightings(status: EditorStatus) =
b.version.inc
b.isUpdate = false

if status.settings.git.showChangedLine and
b.isTrackingByGit:
b.isGitUpdate = true

if status.lspClients.isInitialized(b.langId) and b.isEditMode:
template client: LspClient = status.lspClients[b.langId]

Expand Down Expand Up @@ -1753,7 +1757,7 @@ proc runBackgroundTasks*(status: var EditorStatus) =

status.autoBackupStatus.lastBackupTime = now()

block updateGitInfo:
if status.settings.git.showChangedLine:
## Start background tasks for git info updates.

let
Expand Down
17 changes: 17 additions & 0 deletions tests/teditorstatus.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1198,3 +1198,20 @@ suite "editorstatus: update":

status.resize(100, 100)
status.update

suite "editorstatus: updateSyntaxHighlightings":
var status: EditorStatus

setup:
status = initEditorStatus()
status.settings.git.showChangedLine = true

assert status.addNewBufferInCurrentWin("test.txt").isOk

test "Check isGitUpdate":
currentBufStatus.isGitUpdate = false
currentBufStatus.isUpdate = true
currentBufStatus.isTrackingByGit = true
status.updateSyntaxHighlightings

check currentBufStatus.isGitUpdate

0 comments on commit 5dc4754

Please sign in to comment.