better window adjustment for find feature
This commit is contained in:
parent
22715b739f
commit
79c43b7416
1 changed files with 2 additions and 5 deletions
|
|
@ -340,12 +340,9 @@ def editor(stdscr, filename, mouse=None, terminal_tilegrid=None): # pylint: dis
|
||||||
if line.find(user_response) != -1:
|
if line.find(user_response) != -1:
|
||||||
found = True
|
found = True
|
||||||
user_message = f"Found '{user_response}' in line {r + cursor.row + 2}"
|
user_message = f"Found '{user_response}' in line {r + cursor.row + 2}"
|
||||||
#cursor.row = r + cursor.row + 1
|
cursor.row = clamp(r + cursor.row + 1, 0, len(buffer) - 1)
|
||||||
|
window.row = clamp(cursor.row - window.n_rows // 2, 0, len(buffer) - window.n_rows)
|
||||||
cursor.col = line.find(user_response) - 1
|
cursor.col = line.find(user_response) - 1
|
||||||
for _ in range(r + 1):
|
|
||||||
cursor.down(buffer)
|
|
||||||
window.down(buffer, cursor)
|
|
||||||
window.horizontal_scroll(cursor)
|
|
||||||
right(window, buffer, cursor)
|
right(window, buffer, cursor)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue