       bufferCtx.draw(bufferLayer, at: drawOrigin)
 
       self.setNeedsDisplay(clipRect)
+
+      let rectToUpdate: CGRect
+      if count > 0 {
+        rectToUpdate = rectToScroll.divided(atDistance: offset, from: .minYEdge).slice
+      } else {
+        rectToUpdate = rectToScroll.divided(atDistance: abs(offset), from: .maxYEdge).slice
+      }
+      self.markForRender(rect: rectToUpdate)
+
+      self.bridgeLogger.debug("offset: \(offset), rectToScroll: \(rectToScroll), " +
+                              "clipRect: \(scaledClipRect), draw-at: \(drawOrigin), " +
+                              "rect-to-update: \(rectToUpdate)")
 
       // Do not send msgs to agent -> neovim in the delegate method. It causes spinning
       // when you're opening a file with existing swap file.

    self.rectsToUpdate.insert(self.bounds)
  }

  func markForRender(region: Region) {
    // position could be out of range when the last put position of the grid is out of range
    if region.left < 0 || region.right >= self.grid.size.width

      let scaledClipRect = clipRect.scaling(scale)
      let drawOrigin = CGPoint(x: 0, y: offset).scaling(scale)

      bufferCtx.saveGState()
      defer { bufferCtx.restoreGState() }

