Count the number of lines in a given text. Before calculation, the tab width and line length of the text are fetched, so that up-to-date values are used. Lines are counted as if the string was wrapped so that lines are never over linewidth characters long.
(self, s)
| 275 | editwin.write = mywrite |
| 276 | |
| 277 | def count_lines(self, s): |
| 278 | """Count the number of lines in a given text. |
| 279 | |
| 280 | Before calculation, the tab width and line length of the text are |
| 281 | fetched, so that up-to-date values are used. |
| 282 | |
| 283 | Lines are counted as if the string was wrapped so that lines are never |
| 284 | over linewidth characters long. |
| 285 | |
| 286 | Tabs are considered tabwidth characters long. |
| 287 | """ |
| 288 | return count_lines_with_wrapping(s, self.editwin.width) |
| 289 | |
| 290 | def squeeze_current_text(self): |
| 291 | """Squeeze the text block where the insertion cursor is. |