Get scroll_window working

This commit is contained in:
Kovid Goyal 2022-08-31 20:58:22 +05:30
parent bacca88213
commit 0a2455c8be
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 17 additions and 17 deletions

View File

@ -246,7 +246,7 @@ def update_at_commands() -> None:
os.remove(dest) os.remove(dest)
with open(dest, 'w') as f: with open(dest, 'w') as f:
f.write(code) f.write(code)
print('\x1b[31mTODO\x1b[m: test send_text, env, scroll_window', file=sys.stderr) print('\x1b[31mTODO\x1b[m: test send_text, env', file=sys.stderr)
def main() -> None: def main() -> None:

View File

@ -69,7 +69,7 @@ using this option means that you will not be notified of failures.
window.screen.reverse_scroll(int(abs(amt)), True) window.screen.reverse_scroll(int(abs(amt)), True)
else: else:
unit = 'page' if unit == 'p' else 'line' unit = 'page' if unit == 'p' else 'line'
if unit == 'page' and not amt.is_integer(): if unit == 'page' and not isinstance(amt, int) and not amt.is_integer():
amt = round(window.screen.lines * amt) amt = round(window.screen.lines * amt)
unit = 'line' unit = 'line'
direction = 'up' if amt < 0 else 'down' direction = 'up' if amt < 0 else 'down'

View File

@ -19,6 +19,7 @@ func parse_scroll_amount(amt string) ([]interface{}, error) {
var mult float64 = 1 var mult float64 = 1
if strings.HasSuffix(amt, "-") && !unscroll { if strings.HasSuffix(amt, "-") && !unscroll {
mult = -1 mult = -1
}
q, err := strconv.ParseFloat(strings.TrimRight(amt, "+-plu"), 64) q, err := strconv.ParseFloat(strings.TrimRight(amt, "+-plu"), 64)
if err != nil { if err != nil {
return ans, err return ans, err
@ -35,6 +36,5 @@ func parse_scroll_amount(amt string) ([]interface{}, error) {
ans[1] = "l" ans[1] = "l"
} }
} }
}
return ans, nil return ans, nil
} }