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

Scrolling and inserting/deleting lines #165

Open
Bill-Gray opened this issue Mar 13, 2024 · 0 comments
Open

Scrolling and inserting/deleting lines #165

Bill-Gray opened this issue Mar 13, 2024 · 0 comments

Comments

@Bill-Gray
Copy link
Contributor

Bill-Gray commented Mar 13, 2024

wsetscrreg( WINDOW *win, int top, int bottom) requires that the cursor be somewhere between top and bottom. I don't see why. I suspect it mattered once upon a time and no longer does. The actual scrolling just scrolls the region between top and bottom (stored in win->_tmarg and win->_bmarg), with no reference to the cursor location. ncurses ignores the cursor location for this function.

On a slightly related matter : wdeleteln() will delete the line under the cursor and move everything from there to the bottom of the scroll region (win->_bmarg) up one line. If the cursor is below the bottom margin of the scroll region, wdeleteln() erases the current line and does nothing else.

winsertln() will insert a blank line at the cursor position and push everything down to the bottom of the window (win->_maxy - 1). I think wdeleteln() is the one in error here (ncurses also seems to think that the deletion/insertion should go right down to the bottom of the window). Basically, the scrolling functions should always look at _bmarg and _tmarg and never at the cursor location. winsertln()/wdeleteln() should always look at the current cursor y value and the bottom of the window, and never at _bmarg or _tmarg. (Well, winsertln() already does this; only wdeleteln() requires tweaking. Fortunately, not much of it.)

I have written a small test program to exercise these functions that may be useful.

Bill-Gray added a commit to Bill-Gray/PDCursesMod that referenced this issue Mar 13, 2024
…egion. This appears to no longer be necessary. See wmcbrine/PDCurses#165 (and a couple of commits subsequent to this one.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant