fn process_messages(
        internal_buf: (*mut u8, usize),
        rx: crossbeam::channel::Receiver<EditMessage>,
        has_work: Arc<AtomicBool>,
        window_offset: Arc<AtomicUsize>,
    ) {
        let internal_buf =
            unsafe { std::slice::from_raw_parts_mut(internal_buf.0, internal_buf.1) };
        let mut internal_start = window_offset.load(Ordering::SeqCst);

        std::thread::spawn(move || loop {
            for rcv in &rx {
                has_work.store(true, Ordering::SeqCst);

                let start = window_offset.load(Ordering::SeqCst);
                let internal_buf = &mut internal_buf[start..];

                match rcv {
                    EditMessage::Remove => unsafe {
                        debug_assert!(internal_start >= start);

                        std::ptr::copy(
                            internal_buf.as_ptr().add(internal_start - start),
                            internal_buf.as_mut_ptr(),
                            internal_buf.len() - (internal_start - start),
                        );

                        internal_start = start;
                    },
                    EditMessage::Add(byte) => unsafe {
                        debug_assert_eq!(internal_start, window_offset.load(Ordering::SeqCst));

                        std::ptr::copy(
                            internal_buf.as_ptr(),
                            internal_buf.as_mut_ptr().add(1),
                            internal_buf.len() - 1,
                        );

                        internal_buf[0] = byte;
                    },
                    EditMessage::ModifyWindow(new_window) => {
                        window_offset.store(new_window, Ordering::SeqCst);
                        internal_start = new_window;
                    }
                }

                has_work.store(rx.is_full(), Ordering::SeqCst);
            }
        });
    }
Receives messages of type [`EditMessage`], and processes the buffer in the
background. Although this uses unsafe in both the ptr copy and the 2 mutable
buffers, it is still safe. This uses a channel to receive the messages in order.
Once received, it does the copy to insert / remove where the main thread stopped.
This *vastly* improves snappiness and feel and does not overlap in read / write
with the main thread, thus preventing any UB in writing to the same section of
the buffer
src/buffer.rs