ed

[hare] The standard editor
Log | Files | Refs | README | LICENSE

util.ha (395B)


      1 use fmt;
      2 
      3 fn cmd_dumpbuffer(s: *Session, cmd: *Command) (void | Error) = {
      4 	return dumpbuffer(s.buf);
      5 };
      6 
      7 fn dumpbuffer(buf: *Buffer) void = {
      8 	for (let n = 1z; n < len(buf.lines); n += 1) {
      9 		fmt::printfln("{}\t{}", n, buf.lines[n].text)!;
     10 	};
     11 };
     12 
     13 fn debug(fmtstr: str, args: fmt::field...) void = {
     14 	fmt::error("\x1b[31mdebug: ")!;
     15 	fmt::errorf(fmtstr, args...)!;
     16 	fmt::errorln("\x1b[m")!;
     17 };