diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-05-29 15:56:24 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-05-29 15:56:24 -0700 |
commit | ff2ee758185781080490851ae7d9e87ec17d851e (patch) | |
tree | 78e9099dffa81ee57e1997d6f24bf1f58c3f17ae /apps/browse.mu | |
parent | 2fb656b4f466f85437c268da9e05b270d020b964 (diff) | |
download | mu-ff2ee758185781080490851ae7d9e87ec17d851e.tar.gz |
6433 - render newlines correctly
There were three confounding issues to get past before this seemed to be working right: - row/col count from 1 rather than 0 - I was thinking in decimal rather than hex - print-byte buffers to stdout, but print-string does not. I didn't think this mattered, but it does matter to flush the current line before moving cursor again. Only one of these issues was a bug in the code. The first two were bugs in my mental model that necessitated no changes to code to be corrected.
Diffstat (limited to 'apps/browse.mu')
-rw-r--r-- | apps/browse.mu | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/browse.mu b/apps/browse.mu index bb3c1a1c..222ac5cd 100644 --- a/apps/browse.mu +++ b/apps/browse.mu @@ -33,10 +33,13 @@ $line-loop: { var c/eax: byte <- read-byte-buffered in compare c, 0xffffffff # EOF marker break-if-= $line-loop + compare c, 0xa # newline + break-if-= # no need to print newlines print-byte c col <- increment loop } + flush-stdout row <- increment loop } |