+ if self.visible_width:
+ if self.marked_pos < self.offset:
+ self.offset = self.marked_pos
+ if self.marked_pos >= self.offset + self.visible_width:
+ if self.marked_pos == len(self.text):
+ self.offset = self.marked_pos - self.visible_width
+ else:
+ self.offset = self.marked_pos - self.visible_width + 1
+ if self.offset > 0 and self.offset + self.visible_width > len(self.text):
+ self.offset = max(0, len(self.text) - self.visible_width)
+
+ def insertChar(self, ch, pos, owr):
+ if owr or self.overwrite:
+ self.text = self.text[0:pos] + ch + self.text[pos + 1:]
+ elif self.fixed_size:
+ self.text = self.text[0:pos] + ch + self.text[pos:-1]
+ else:
+ self.text = self.text[0:pos] + ch + self.text[pos:]