Newsgroups: comp.unix.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!news.den.mmc.com!emf780.den.mmc.com!ross From: ross@emf780.den.mmc.com (Perry R. Ross) Subject: Re: Strange curses problem Message-ID: <1991Jun25.215845.1869@den.mmc.com> Summary: Cursor motion optimization? Keywords: curses bug? Sender: news@den.mmc.com (News) Nntp-Posting-Host: emf780.den.mmc.com Organization: Martin Marietta Astronautics, Denver References: <883@spam.ua.oz> Distribution: na Date: Tue, 25 Jun 1991 21:58:45 GMT Lines: 54 In article <883@spam.ua.oz> dcook@spam.ua.oz (David Cook) writes: > [... deleted ...] >Hello, > Here is a section of code I've been having trouble with, >in a program which uses curses. >(the problem is the same on SunOS 4.1.1/SPARC and OSx5.1/Pyramid 98xx, >using standard cc on both machines, ucb universe on the Pyramid - >the program works ok in att universe on the Pyramid ) > >The problem is, I am trying to display the array 'abroll' on the >screen, in a 6 row by 12 column format, evenly spaced. >The current behaviour is to print the first number in each column >in the correct place, and the other 5 appear around column 78 of the >same line as the first number . If I remove the commented out section >of code, below, the program works. I hesitate to post at all, since my experience with curses is (thankfully) in the past. But, since you say you haven't gotten anything from the "experts", here goes (now watch the "experts" leap up and flame me :) My guess is that you are a victim of "cursor motion optimization", which tries to minimize the number of characters that need to be sent to your terminal to accomplish a cursor motion. For example, if the cursor only needs to go down one line and back two columns, curses will send the "down line" character and two "backspace" characters. When the cursor has to go a long way, however, it is more efficient to just use the absolute cursor position sequence. Your commented code appears to force absolute cursor positioning by making the cursor move a long way. The culprit here might be a bad termcap entry (or terminfo for newer stuff -- I haven't used terminfo but I think the man page refers back to the termcap capability names). I would check the sequence for :do, :le, :nd, and :up, which all move the cursor one line/column, also :ch, which sets the cursor column without affecting the row (again, convert these to terminfo names if that's what you're using). If that checks out, see if :pt appears in your entry, and try deleting it. It tells curses that your terminal has hardware tabs, which curses may try to use to move the cursor. I have seen :pt on a terminal that doesn't do tabs (or doesn't do them right or needs to be setup via the :is or :if capability) shift all your text to column 79. Hope this helps! >Could someone out there _please_ reduce my frustration, and >see the error that I'm missing (apart from the obvious one of >using curses in the first place :-) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Bingo. :) -- -- Perry R. Ross (303)977-4371 | DISCLAIMER: Martin Marietta usually doesn't -- -- ross@emf780.den.mmc.com | have a very high opinion of my opinions. -- ------------------------------------------------------------------------------- -- "USER": a term computer professionals use when they mean "idiot". -- -- Dave Barry --