Skip to content

Commit 28cca64

Browse files
Final fixes to cellrenderer with word wrap
1 parent e5925e1 commit 28cca64

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/robotide/editor/cellrenderer.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,20 @@ def GetBestSize(self, grid, attr, dc, row, col):
9393
return dc.GetTextExtent(" ") # self.default_width
9494

9595
w, h = dc.GetTextExtent(text)
96-
97-
if self.word_wrap:
9896
if self.auto_fit:
99-
col_width = min(w, self.max_width)
97+
col_width = min(w, self.max_width)
10098
else:
101-
col_width = min(w, self.default_width)
102-
suggest_width = grid.GetColSize(col)
99+
col_width = min(w, self.default_width)
100+
row_height = h
101+
if self.word_wrap:
102+
suggest_width = max(grid.GetColSize(col), col_width)
103103
text = self._wordwrap(text, suggest_width, dc, breakLongWords=False)
104104
w, h = dc.GetMultiLineTextExtent(text)
105105
row_height = h
106-
else:
107-
row_height = h
108-
if self.auto_fit:
109-
col_width = min(w, self.max_width)
110-
else:
111-
col_width = grid.GetColSize(col)
112-
106+
if self.auto_fit:
107+
col_width = min(w, col_width)
108+
else:
109+
col_width = min(w, self.default_width)
113110
# do not shrink col size (subtract col margin which is 10 pixels )
114111
col_width = max(grid.GetColSize(col) - 10, col_width)
115112
return wx.Size(col_width, row_height)

0 commit comments

Comments
 (0)