~sircmpwn/most

ca83eeb650cd7fbc2dcba5bfc7a732dd8b3d6350 — Drew DeVault 5 months ago 65ccf31
Implement action_top
1 files changed, 16 insertions(+), 0 deletions(-)

M cmd/most/main.ha
M cmd/most/main.ha => cmd/most/main.ha +16 -0
@@ 126,6 126,10 @@ fn run(conf: *config, in: io::handle) (void | vt::error) = {
				action_up(&state)?;
			case ' ' =>
				action_pgdown(&state)?;
			case 'g' =>
				action_top(&state)?;
			case 'G' =>
				action_bottom(&state)?;
			case =>
				yield;
			};


@@ 263,3 267,15 @@ fn action_pgdown(state: *state) (void | vt::error) = {
fn action_pgup(state: *state) (void | vt::error) = {
	scrollup(state, state.rows - 1)?;
};

fn action_top(state: *state) (void | vt::error) = {
	state.off = io::seek(state.in, 0, io::whence::SET)?;
	state.eof = false;
	delete(state.lines[..]);
	vt::clear(state.term)?;
	drawlines(state)?;
};

fn action_bottom(state: *state) (void | vt::error) = {
	abort(); // TODO
};