diff options
| author | Sam Nystrom <sam@samnystrom.dev> | 2023-06-23 01:21:22 -0400 |
|---|---|---|
| committer | Sam Nystrom <sam@samnystrom.dev> | 2023-06-23 01:22:30 -0400 |
| commit | bd7e80e0653f8851e9ca710561e1bdd1c90064fc (patch) | |
| tree | d55ddef9fd386072b61c8ed6508465ef00286b24 /main.ha | |
| parent | c89770e17a73040b14723e510d62a1527b75b130 (diff) | |
close subtitle file after parsing
Diffstat (limited to 'main.ha')
| -rw-r--r-- | main.ha | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -24,7 +24,6 @@ use fs; use os; use strconv; use strings; -use strio; use time; use unix::poll; use unix::tty; @@ -66,12 +65,13 @@ export fn main() void = { }; let subtitles = parse_srt(file); + io::close(file)!; defer free(subtitles); defer for (let i = 0z; i < len(subtitles); i += 1) { free_text(subtitles[i].text); }; - fmt::fprint(os::stdout_file, "\x1b[?25l")!; + fmt::fprint(os::stdout_file, "\x1b[?25l")!; // Hide the cursor defer fmt::fprint(os::stdout_file, "\x1b[?25h")!; let termios = tty::termios_query(os::stdin_file)!; defer tty::termios_restore(&termios); @@ -240,7 +240,7 @@ fn parse_srt(file: io::handle) []subtitle = { case state::TEXT => if (len(line) > 0) { io::writeall(&content, strings::toutf8(line))!; - strio::appendrune(&content, '\n')!; + io::writeall(&content, strings::toutf8("\n"))!; continue; }; |
