Skip to content

refactor(editview): don't wrap the entire EditView in a RefCell<T>

Rasmus Thomsen requested to merge dev into master

This has multiple benefits:

  • More finegrained mutable borrowing. Mutably borrowing the entire EditView just to change its file_name/pristine-ness isn't pretty and could lead to panics if another event happened at the same time (e.g. if you edit an unchanged file, go to the very end of file and delete a line, you'll end up with a RefMut (because the pristine-ness has changed) and a Ref (because the adjustment's value has changed), so you'll get a BorrowError which will panic Tau.
  • Less unneccessary borrow()ing when we just need a non-mutable borrow of the EditView, e.g. to poll a font's size or when we want to work with a GtkWidget

Merge request reports