netbsd-curses icon indicating copy to clipboard operation
netbsd-curses copied to clipboard

wgetscrreg is not defined

Open firasuke opened this issue 1 year ago • 10 comments

I wonder if there's a function similar to wgetscrreg in netbsd-curses. Do note that wsetscrreg is already defined in netbsd-curses.

firasuke avatar Nov 10 '24 07:11 firasuke

as the setter part is already there, it shouldn't be too hard to add. though first i'd check the netbsd-src repo if it was already added upstream, if not send them a PR (or patch via ML). that way it will land in this repo automatically the next time i start backporting (which is quite some effort each time which i'm not seeing myself doing in the near future - the porting itself isn't the worst part, but ironing out new bugs and incompatibilities with the terminfo db is - that's why sabotage itself still uses 0.3.1). if they already have the code we may add it directly without a complete backport.

rofl0r avatar Nov 10 '24 15:11 rofl0r

as the setter part is already there, it shouldn't be too hard to add. though first i'd check the netbsd-src repo if it was already added upstream, if not send them a PR (or patch via ML). that way it will land in this repo automatically the next time i start backporting (which is quite some effort each time which i'm not seeing myself doing in the near future - the porting itself isn't the worst part, but ironing out new bugs and incompatibilities with the terminfo db is - that's why sabotage itself still uses 0.3.1). if they already have the code we may add it directly without a complete backport.

Thank you for your work on netbsd-curses.

I have prepared a PR to upstream with the following changes to curses.h:

int	 wgetscrreg(const WINDOW *, int *, int *);

Will report back in case it gets merged.

firasuke avatar Nov 10 '24 19:11 firasuke

maybe you should've put curses into the title: http://mail-index.netbsd.org/netbsd-bugs/2024/11/10/msg086293.html

I have prepared a PR to upstream with the following changes to curses.h: int wgetscrreg(const WINDOW *, int *, int *);

that's not enough, you also need to implement the actual function.

rofl0r avatar Nov 24 '24 11:11 rofl0r

that's not enough, you also need to implement the actual function.

Oh it is not implemented indeed.

Looking at curses.h provided by ncurses:

#define wgetscrreg(win,t,b)	(NCURSES_OK_ADDR(win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)

I wonder how it would be implemented in NetBSD curses..

firasuke avatar Nov 24 '24 12:11 firasuke

I wonder how it would be implemented in NetBSD curses..

basically the reversal of the existing wsetscrreg function.

let's say, without having looked at it, that wset... does: window->scrreg = param1; then wget... should do *param1 = window->scrreg;

rofl0r avatar Nov 24 '24 19:11 rofl0r

It should be fixed by now, can you please backport the fix so I can test and report back?

  • https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=58823
  • https://github.com/NetBSD/src/commit/8e0f2fc543b19ab70058f17a9a4e744c6a5ef36a
  • https://github.com/NetBSD/src/commit/797cba546a0a65a2e6bc49adfd549785705e384a

firasuke avatar Dec 05 '24 19:12 firasuke

try this patch https://0x0.st/X769.patch which contains the essence of the commit.

a proper version of this will land once i get around to do the next full backport session.

rofl0r avatar Dec 06 '24 01:12 rofl0r

try this patch https://0x0.st/X769.patch which contains the essence of the commit.

a proper version of this will land once i get around to do the next full backport session.

I can confirm that the patch you provided works. I can now build mtm and use it as intended under netbsd-curses.

Thanks!

firasuke avatar Dec 06 '24 11:12 firasuke

cool. you should give brett lymn a heads-up that it fixes your issue, since he's waiting for a reply.

rofl0r avatar Dec 06 '24 11:12 rofl0r

cool. you should give brett lymn a heads-up that it fixes your issue, since he's waiting for a reply.

Already did. Feel free to close this issue.

Thanks for your time!

firasuke avatar Dec 07 '24 09:12 firasuke