Skip to content

Commit

Permalink
cmd/govim: do not remove highlights on delta when auto-highlighting (#…
Browse files Browse the repository at this point in the history
…857)

In 3139f79 I incorrectly removed all reference highlights when a delta
is received. However, the logic prior to that change was that highlights
would only be moved (even in insert mode) if the cursor falls outside of
a highlighted range.

Therefore, we adopt exactly the logic that @leitzler proposed in #852 to
only remove highlights on delta if we are in manual highlighting mode.
  • Loading branch information
myitcv committed Apr 13, 2020
1 parent 3139f79 commit 9c78a05
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/govim/buffer_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ type bufChangedChange struct {
// bufChanged(bufnr, start, end, added, changes)
//
func (v *vimstate) bufChanged(args ...json.RawMessage) (interface{}, error) {
// For now any change (in a .go file) causes an existing highlights to be removed
v.highlightingReferences = false
v.removeReferenceHighlight(nil)
// For now, if we are "manually" highlighting, any change (in a .go file)
// causes an existing highlights to be removed.
if v.highlightingReferences {
v.highlightingReferences = false
v.removeReferenceHighlight(nil)
}

bufnr := v.ParseInt(args[0])
b, ok := v.buffers[bufnr]
Expand Down

0 comments on commit 9c78a05

Please sign in to comment.