 
   public func updateBackground(_ bg: Int32) {
     DispatchUtils.gui {
+      NSLog("\(#function)")
       self.grid.background = UInt32(bitPattern: bg)
       self.layer?.backgroundColor = ColorUtils.colorIgnoringAlpha(self.grid.background).cgColor
 //      NSLog("\(ColorUtils.colorIgnoringAlpha(UInt32(bg)))")

  fileprivate func updateCursorWhenPutting(currentPosition curPos: Position, screenCursor: Position) {
    if self.mode == .Cmdline {
      // When the cursor is in the command line, then we need this...
      self.setNeedsDisplay(cellPosition: self.grid.previousCellPosition(curPos))
      self.setNeedsDisplay(cellPosition: self.grid.nextCellPosition(curPos))
      self.setNeedsDisplay(screenCursor: self.grid.screenCursor)
    }

    self.setNeedsDisplay(screenCursor: screenCursor)
    self.setNeedsDisplay(cellPosition: self.grid.screenCursor)
    self.grid.moveCursor(screenCursor)
  }

  fileprivate func setNeedsDisplay(region: Region) {
    self.setNeedsDisplay(self.regionRectFor(region: region))
  }

  fileprivate func setNeedsDisplay(cellPosition position: Position) {
    self.setNeedsDisplay(position: position)

    if self.grid.isCellEmpty(position) {
      self.setNeedsDisplay(position: self.grid.previousCellPosition(position))
    }

    if self.grid.isNextCellEmpty(position) {
      self.setNeedsDisplay(position: self.grid.nextCellPosition(position))
    }
  }

  fileprivate func setNeedsDisplay(position: Position) {
    self.setNeedsDisplay(row: position.row, column: position.column)
  }

  fileprivate func setNeedsDisplay(row: Int, column: Int) {
//    Swift.print("\(#function): \(row):\(column)")
    self.setNeedsDisplay(self.cellRectFor(row: row, column: column))
  }

  fileprivate func setNeedsDisplay(screenCursor position: Position) {
    self.setNeedsDisplay(position: position)
    if self.grid.isNextCellEmpty(position) {
      self.setNeedsDisplay(position: self.grid.nextCellPosition(position))
    }
  }
}

//      NSLog("\(#function): \(position)")

      self.grid.unmarkCell(position)
      self.markForRender(position: position)

      self.markForRender(screenCursor: self.grid.screenCursor)
    }
  }

