[TxMt] [SpreadSheet] Accented letter breaks alignment
Hans-Jörg Bibiko
bibiko at eva.mpg.de
Wed Jun 6 18:21:05 UTC 2007
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
More information about the textmate
mailing list