Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrollView/RichLog: Page Up / Page Down off by one with horizontal scrollbar #4914

Closed
xavierog opened this issue Aug 21, 2024 · 4 comments · Fixed by #4916
Closed

ScrollView/RichLog: Page Up / Page Down off by one with horizontal scrollbar #4914

xavierog opened this issue Aug 21, 2024 · 4 comments · Fixed by #4916
Labels
bug Something isn't working

Comments

@xavierog
Copy link
Contributor

I noticed this issue while using the RichLog widget but it may actually stem from ScrollView.

Assuming a 25-line high RichLog widget:

  • When there is a horizontal scrollbar, Page Up and Page Down move e.g. from lines 1-25 to lines 26-50, which is the expected behaviour.
    This can be confirmed by running the MRE below this way: SUFFIX= ./richlogtest.py
  • When there is a horizontal scrollbar, Page Up and Page Down move e.g. from lines 1-24 to lines 26-49, thus hiding line 25, hence this report.
    This can be confirmed by running the MRE below this way: ./richlogtest.py

MRE:

#!/usr/bin/env python3
import os
from textual.app import App
from textual.widgets import RichLog

class RichLogTest(App):
	def compose(self):
		ri = RichLog(auto_scroll=False)
		suffix = os.environ.get('SUFFIX', 'A'*1000)
		for i in range(1, 1000):
			ri.write(f"This is line number {i} {suffix}")
		yield ri

if __name__ == "__main__":
	app = RichLogTest()
	app.run()

Textual Diagnostics

Versions

Name Value
Textual 0.76.0
Rich 13.7.1

Python

Name Value
Version 3.12.5
Implementation CPython
Compiler GCC 14.2.0
Executable /path/to/venv/bin/python3

Operating System

Name Value
System Linux
Release 6.10.4-amd64
Version #1 SMP PREEMPT_DYNAMIC Debian 6.10.4-1 (2024-08-12)

Terminal

Name Value
Terminal Application tmux (3.4)
TERM tmux-256color
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=196, height=25
legacy_windows False
min_width 1
max_width 196
is_terminal False
encoding utf-8
max_height 25
justify None
overflow None
no_wrap False
highlight None
markup None
height None
Copy link

github-actions bot commented Aug 21, 2024

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@TomJGooding
Copy link
Contributor

TomJGooding commented Aug 21, 2024

I think this is the expected behaviour, otherwise the RichLog size would need to grow?

EDIT: Sorry never mind, I should have read the issue more carefully. Currently page down will "skip" the line obscured by the horizontal scrollbar.

@willmcgugan willmcgugan added the bug Something isn't working label Aug 21, 2024
@willmcgugan
Copy link
Collaborator

Confirmed. It actually goes all the way back to widget.py, so this would impact anything that scrolls.

Fortunately looks like an easy fix.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants