File: area_windows.go

package info (click to toggle)
golang-github-atomicgo-cursor 0.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: makefile: 2
file content (21 lines) | stat: -rw-r--r-- 410 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//go:build windows
// +build windows

package cursor

import (
	"fmt"
)

// writeArea is a helper for platform dependant output.
// For Windows newlines '\n' in the content are replaced by '\r\n'
func (area *Area) writeArea(content string) {
	last := ' '
	for _, r := range content {
		if r == '\n' && last != '\r' {
			fmt.Fprint(area.writer, "\r\n")
			continue
		}
		fmt.Fprint(area.writer, string(r))
	}
}