Hi,
I'm currently woking on a small spreadsheet in TM, and some of my column alignment is broken. I think it's due to accented letter. My text encoding is UTF-8.
I don't know if I'm doing something wrong or if it's a bug. But in both case, the mailing list is probably a good way to get more information.
As usual, thanks for your help.
Édouard
On 5. Jun 2007, at 23:56, Édouard Gilbert wrote:
I'm currently woking on a small spreadsheet in TM, and some of my column alignment is broken. I think it's due to accented letter. My text encoding is UTF-8.
I don't know if I'm doing something wrong or if it's a bug. But in both case, the mailing list is probably a good way to get more information.
Steps to reproduce the problem?
On 06.06.2007, at 17:22, Allan Odgaard wrote:
On 5. Jun 2007, at 23:56, Édouard Gilbert wrote:
I'm currently woking on a small spreadsheet in TM, and some of my column alignment is broken. I think it's due to accented letter. My text encoding is UTF-8.
I don't know if I'm doing something wrong or if it's a bug. But in both case, the mailing list is probably a good way to get more information.
Steps to reproduce the problem?
New Spreadsheet Example:
|mike| 1| 3| 0| |jörg| 4| 2| 0|
% D1 := SUM(B1:C1) % D2 := SUM(B2:C2)
press APPLE+R
and you will see
|mike | 1| 3|4.0| |jörg | 4| 2|6.0|
% D1 := SUM(B1:C1) % D2 := SUM(B2:C2)
The problem is the ljust method in spreadsheetTool.rb:158. It doesn't support utf-8 strings.
Suggestion: 158: row[i] = row[i] + " "*(columnWidths[i]-row[i].split(//u).size)
or define a own method for uft8_ljust.
Cheers,
Hans
On 06.06.2007, at 17:22, Allan Odgaard wrote:
On 5. Jun 2007, at 23:56, Édouard Gilbert wrote:
I'm currently woking on a small spreadsheet in TM, and some of my column alignment is broken. I think it's due to accented letter. My text encoding is UTF-8.
I don't know if I'm doing something wrong or if it's a bug. But in both case, the mailing list is probably a good way to get more information.
Steps to reproduce the problem?
Here's the clean way (hopefully) to support utf-8:
Replace class String in spreadsheetTool.rb with:
class String def number? self =~ /\A[+-]?\d*(.\d*)?\z/ end def length return self.split(//u).size end def ljust(times,pat=" ") return (times<=self.length) ? self.to_s : self.to_s + pat*(times- self.length) end def rjust(times,pat=" ") return (times<=self.length) ? self.to_s : pat*(times- self.length) + self.to_s end def center(times,pat=" ") off=times-self.length off2=(off/2).truncate return (times<=self.length) ? self.to_s : pat*off2 + self.to_s + pat*(off2+off%2) end end
Cheers,
Hans