about summary refs log tree commit diff stats
path: root/500fake-screen.mu
Commit message (Expand)AuthorAgeFilesLines
* allow drawing all pixelsKartik K. Agaram2021-04-171-3/+2
* shell: horline working nowKartik K. Agaram2021-04-151-1/+9
* shell: don't lose pixel graphics when moving cursorKartik K. Agaram2021-04-141-0/+1
* shell: pixel graphicsKartik K. Agaram2021-04-131-0/+431
ame the previous revision' href='/akspecs/aerc/blame/contrib/hldiff?h=0.4.0&id=0647ea64839df5ceecf3a71f672f05a589fd1409'>^
6b7da37 ^
6e61f58 ^








ea4fe71 ^


6e61f58 ^

5ea5f91 ^
6e61f58 ^










1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
                   










                            


                                                  


                                             
                                                  








                                                              


                                                  

                                          
                                        










                                                                                      
# vim: set ft=awk :
BEGIN {
	bright = "\x1B[1m"
	red = "\x1B[31m"
	green = "\x1B[32m"
	cyan = "\x1B[36m"
	reset = "\x1B[0m"

	hit_diff = 0
}
{
	if (hit_diff == 0) {
		# Strip carriage returns from line
		gsub(/\r/, "", $0)

		if ($0 ~ /^diff /) {
			hit_diff = 1;
			print bright $0 reset
		} else if ($0 ~ /^.*\|.*(\+|-)/) {
			left = substr($0, 0, index($0, "|")-1)
			right = substr($0, index($0, "|"))
			gsub(/-+/, red "&" reset, right)
			gsub(/\++/, green "&" reset, right)
			print left right
		} else {
			print $0
		}
	} else {
		# Strip carriage returns from line
		gsub(/\r/, "", $0)

		if ($0 ~ /^-/) {
			print red $0 reset
		} else if ($0 ~ /^\+/) {
			print green $0 reset
		} else if ($0 ~ /^ /) {
			print $0
		} else if ($0 ~ /^@@ (-[0-9]+,[0-9]+ \+[0-9]+,[0-9]+) @@.*/) {
			sub(/^@@ (-[0-9]+,[0-9]+ \+[0-9]+,[0-9]+) @@/, cyan "&" reset)
			print $0
		} else {
			print bright $0 reset
		}
	}
}