pos = mend
- def colourise(self):
+ def colourise(self, char_limit, url_cost):
self.cs = text.ColouredString("")
nchars = 0
- url_cost, char_limit = 23, 500 # FIXME: get this from the instance
for start, end, desc in self.regions:
region_len = end - start
if desc == 'u':
y += 1
return y
- def layout(self, width):
- self.colourise()
+ def layout(self, width, char_limit, url_cost):
+ self.colourise(char_limit, url_cost)
self.yx = [None] * (len(self.text) + 1)
self.yx[0] = 0, 0 # in case there's no text at all
self.lines = []
self.goal_column = None
self.mode = 'normal'
+ instance_data = self.cc.get("instance")
+ try:
+ self.char_limit = instance_data[
+ "configuration"]["statuses"]["max_characters"]
+ except KeyError:
+ self.char_limit = 500
+ try:
+ self.url_cost = instance_data[
+ "configuration"]["statuses"]["characters_reserved_per_url"]
+ except KeyError:
+ self.url_cost = 23
+
def render(self):
y = 0
y += 1
self.dtext = self.DisplayText(self.text)
- self.dtext.layout(self.cc.scr_w - 1)
+ self.dtext.layout(self.cc.scr_w - 1, self.char_limit, self.url_cost)
ytop = y