Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
register: wide-character-aware layout (#242)
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.
- Loading branch information
1 parent
09430f0
commit 5b5e5ee
Showing
4 changed files
with
153 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 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 |