##// END OF EJS Templates
color: add support for terminfo-based attributes and color...
color: add support for terminfo-based attributes and color Using terminfo instead of hard-coding ECMA-48 control sequences provides a greater assurance that the terminal codes are correct for the current terminal type; not everything supports the ANSI escape codes. It also allows us to use a wider range of colors when a terminal emulator supports it (such as 16- or 256-color xterm), and a few more non-color attributes, such as the ever-popular blink.

File last commit:

r12458:9446bd05 default
r13987:e0f07847 default
Show More
test-mactext.t
40 lines | 1.0 KiB | text/troff | Tads3Lexer
$ cat > unix2mac.py <<EOF
> import sys
>
> for path in sys.argv[1:]:
> data = file(path, 'rb').read()
> data = data.replace('\n', '\r')
> file(path, 'wb').write(data)
> EOF
$ cat > print.py <<EOF
> import sys
> print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
> EOF
$ hg init
$ echo '[hooks]' >> .hg/hgrc
$ echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
$ echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
$ cat .hg/hgrc
[hooks]
pretxncommit.cr = python:hgext.win32text.forbidcr
pretxnchangegroup.cr = python:hgext.win32text.forbidcr
$ echo
$ echo hello > f
$ hg add f
$ hg ci -m 1
$ echo
$ python unix2mac.py f
$ hg ci -m 2
Attempt to commit or push text file(s) using CR line endings
in dea860dc51ec: f
transaction abort!
rollback completed
abort: pretxncommit.cr hook failed
[255]
$ hg cat f | python print.py
hello<LF>
$ cat f | python print.py
hello<CR>