index = text.index("@0,0")
if index.split('.', 1)[1] != '0':
index = text.index(f"{index} +1line linestart")
- while True:
- lineinfo = text.dlineinfo(index)
- if lineinfo is None:
- break
+ while (lineinfo := text.dlineinfo(index)) is not None:
y_coords.append(lineinfo[1])
index = text.index(f"{index} +1line")
return y_coords
# Peeking back worked; look forward until _synchre no longer
# matches.
i = pos + 1
- while 1:
- m = _synchre(code, i)
- if m:
- s, i = m.span()
- if not is_char_in_string(s):
- pos = s
- else:
- break
+ while (m := _synchre(code, i)):
+ s, i = m.span()
+ if not is_char_in_string(s):
+ pos = s
return pos
def set_lo(self, lo):
first = last = None
# XXX ought to replace circular instead of top-to-bottom when wrapping
text.undo_block_start()
- while True:
- res = self.engine.search_forward(text, prog, line, col,
- wrap=False, ok=ok)
- if not res:
- break
+ while (res := self.engine.search_forward(
+ text, prog, line, col, wrap=False, ok=ok)):
line, m = res
chars = text.get("%d.0" % line, "%d.0" % (line+1))
orig = m.group()
result = self._line_buffer
self._line_buffer = ''
if size < 0:
- while True:
- line = self.shell.readline()
- if not line: break
+ while (line := self.shell.readline()):
result += line
else:
while len(result) < size:
index = text.index("@0,0")
if index.split('.', 1)[1] != '0':
index = text.index(f'{index}+1line linestart')
- while True:
- lineinfo = text.dlineinfo(index)
- if lineinfo is None:
- break
+ while (lineinfo := text.dlineinfo(index)) is not None:
y = lineinfo[1]
prev_newline_tagnames = text_tagnames(f"{index} linestart -1c")
prompt = (