| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -474,10 +474,7 @@ def get_shell_line_y_coords(self): | |||
| 474 | 474 | index = text.index("@0,0") | |
| 475 | 475 | if index.split('.', 1)[1] != '0': | |
| 476 | 476 | index = text.index(f"{index} +1line linestart") | |
| 477 | - while True: | ||
| 478 | - lineinfo = text.dlineinfo(index) | ||
| 479 | - if lineinfo is None: | ||
| 480 | - break | ||
| 477 | + while (lineinfo := text.dlineinfo(index)) is not None: | ||
| 481 | 478 | y_coords.append(lineinfo[1]) | |
| 482 | 479 | index = text.index(f"{index} +1line") | |
| 483 | 480 | return y_coords | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -179,14 +179,10 @@ def find_good_parse_start(self, is_char_in_string): | |||
| 179 | 179 | # Peeking back worked; look forward until _synchre no longer | |
| 180 | 180 | # matches. | |
| 181 | 181 | i = pos + 1 | |
| 182 | - while 1: | ||
| 183 | - m = _synchre(code, i) | ||
| 184 | - if m: | ||
| 185 | - s, i = m.span() | ||
| 186 | - if not is_char_in_string(s): | ||
| 187 | - pos = s | ||
| 188 | - else: | ||
| 189 | - break | ||
| 182 | + while (m := _synchre(code, i)): | ||
| 183 | + s, i = m.span() | ||
| 184 | + if not is_char_in_string(s): | ||
| 185 | + pos = s | ||
| 190 | 186 | return pos | |
| 191 | 187 | ||
| 192 | 188 | def set_lo(self, lo): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -158,11 +158,8 @@ def replace_all(self, event=None): | |||
| 158 | 158 | first = last = None | |
| 159 | 159 | # XXX ought to replace circular instead of top-to-bottom when wrapping | |
| 160 | 160 | text.undo_block_start() | |
| 161 | - while True: | ||
| 162 | - res = self.engine.search_forward(text, prog, line, col, | ||
| 163 | - wrap=False, ok=ok) | ||
| 164 | - if not res: | ||
| 165 | - break | ||
| 161 | + while (res := self.engine.search_forward( | ||
| 162 | + text, prog, line, col, wrap=False, ok=ok)): | ||
| 166 | 163 | line, m = res | |
| 167 | 164 | chars = text.get("%d.0" % line, "%d.0" % (line+1)) | |
| 168 | 165 | orig = m.group() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -482,9 +482,7 @@ def read(self, size=-1): | |||
| 482 | 482 | result = self._line_buffer | |
| 483 | 483 | self._line_buffer = '' | |
| 484 | 484 | if size < 0: | |
| 485 | - while True: | ||
| 486 | - line = self.shell.readline() | ||
| 487 | - if not line: break | ||
| 485 | + while (line := self.shell.readline()): | ||
| 488 | 486 | result += line | |
| 489 | 487 | else: | |
| 490 | 488 | while len(result) < size: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -471,10 +471,7 @@ def update_sidebar(self): | |||
| 471 | 471 | index = text.index("@0,0") | |
| 472 | 472 | if index.split('.', 1)[1] != '0': | |
| 473 | 473 | index = text.index(f'{index}+1line linestart') | |
| 474 | - while True: | ||
| 475 | - lineinfo = text.dlineinfo(index) | ||
| 476 | - if lineinfo is None: | ||
| 477 | - break | ||
| 474 | + while (lineinfo := text.dlineinfo(index)) is not None: | ||
| 478 | 475 | y = lineinfo[1] | |
| 479 | 476 | prev_newline_tagnames = text_tagnames(f"{index} linestart -1c") | |
| 480 | 477 | prompt = ( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments