Wide characters, eg chinese/japanese/korean characters, are typically rendered wider than latin characters. In some applications (eg gnome terminal or osx terminal) and fonts (eg monaco) they are exactly double width. This is a start at making hledger aware of this. A register report containing wide characters (in descriptions, account names, or commodity symbols) should now align its columns correctly, when viewed with a suitable font and application.
		
			
				
	
	
		
			32 lines
		
	
	
		
			624 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			624 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
# alignment calculations should handle wide characters
 | 
						|
 | 
						|
# 1. register, account name
 | 
						|
hledger -f - register
 | 
						|
<<<
 | 
						|
1/1
 | 
						|
  知  1
 | 
						|
  b
 | 
						|
>>>
 | 
						|
2015/01/01                      知                               1             1
 | 
						|
                                b                               -1             0
 | 
						|
>>>=0
 | 
						|
 | 
						|
# # 2. balance, commodity symbol
 | 
						|
# hledger -f - balance
 | 
						|
# <<<
 | 
						|
# 1/1
 | 
						|
#   a   知1
 | 
						|
#   b   $-1
 | 
						|
# >>>
 | 
						|
#                  知1  a
 | 
						|
#                  $-1  b
 | 
						|
# --------------------
 | 
						|
#                  $-1
 | 
						|
#                  知1
 | 
						|
# >>>=0
 | 
						|
 | 
						|
# import Text.Data.ICU.Char
 | 
						|
# case property EastAsianWidth c of
 | 
						|
#   Wide -> 2
 | 
						|
#   _    -> 1
 |