pub fn new(file: File, encoding: Encoding, offset: usize) -> Result<Self, Box<dyn Error>> {
        let contents = AsyncBuffer::new(&file)?;
        if contents.is_empty() {
            eprintln!("heh does not support editing empty files");
            process::exit(1);
        } else if offset >= contents.len() {
            eprintln!(
                "The specified offset ({offset}) is too large! (must be less than {})",
                contents.len()
            );
            process::exit(1);
        }

        let mut labels = LabelHandler::new(&contents, offset);
        let clipboard = Clipboard::new().ok();
        if clipboard.is_none() {
            labels.notification = String::from("Can't find clipboard!");
        }

        let display = ScreenHandler::new()?;

        let app = Self {
            data: Data {
                file,
                contents,
                encoding,
                dirty: false,
                start_address: (offset / display.comp_layouts.bytes_per_line)
                    * display.comp_layouts.bytes_per_line,
                offset,
                nibble: Nibble::Beginning,
                last_click: Window::Unhandled,
                drag_enabled: false,
                last_drag: None,
                drag_nibble: None,
                clipboard,
                editor: Editor::Hex,
                actions: vec![],
                search_term: String::new(),
                search_offsets: Vec::new(),
            },
            display,
            labels,
            key_handler: Box::from(Editor::Hex),
        };

        Ok(app)
    }
Creates a new application, focusing the Hex editor and starting with an offset of 0 by
default. This is called once at the beginning of the program.

# Errors

This errors out if the file specified is empty.
src/app.rs