Get scroll_window working
This commit is contained in:
parent
bacca88213
commit
0a2455c8be
@ -246,7 +246,7 @@ def update_at_commands() -> None:
|
||||
os.remove(dest)
|
||||
with open(dest, 'w') as f:
|
||||
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:
|
||||
|
||||
@ -69,7 +69,7 @@ using this option means that you will not be notified of failures.
|
||||
window.screen.reverse_scroll(int(abs(amt)), True)
|
||||
else:
|
||||
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)
|
||||
unit = 'line'
|
||||
direction = 'up' if amt < 0 else 'down'
|
||||
|
||||
@ -19,21 +19,21 @@ func parse_scroll_amount(amt string) ([]interface{}, error) {
|
||||
var mult float64 = 1
|
||||
if strings.HasSuffix(amt, "-") && !unscroll {
|
||||
mult = -1
|
||||
q, err := strconv.ParseFloat(strings.TrimRight(amt, "+-plu"), 64)
|
||||
if err != nil {
|
||||
return ans, err
|
||||
}
|
||||
if !pages && q != float64(int(q)) {
|
||||
return ans, fmt.Errorf("The number must be an integer")
|
||||
}
|
||||
ans[0] = q * mult
|
||||
if pages {
|
||||
ans[1] = "p"
|
||||
} else if unscroll {
|
||||
ans[1] = "u"
|
||||
} else {
|
||||
ans[1] = "l"
|
||||
}
|
||||
}
|
||||
q, err := strconv.ParseFloat(strings.TrimRight(amt, "+-plu"), 64)
|
||||
if err != nil {
|
||||
return ans, err
|
||||
}
|
||||
if !pages && q != float64(int(q)) {
|
||||
return ans, fmt.Errorf("The number must be an integer")
|
||||
}
|
||||
ans[0] = q * mult
|
||||
if pages {
|
||||
ans[1] = "p"
|
||||
} else if unscroll {
|
||||
ans[1] = "u"
|
||||
} else {
|
||||
ans[1] = "l"
|
||||
}
|
||||
}
|
||||
return ans, nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user