Column Skipping

View: New views
6 Messages — Rating Filter:   Alert me  

Column Skipping

by MTK358 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to make an ncurses command line text editor, but the problem is that for some reason the cursor skips a column near the right edge of the terminal. This for some reason only happens when I refresh the statusbar WINDOW in the beginning.

[code]
/*
ncurses Column Skipping Test

Arrow keys to move cursor, q to quit

Compile:

gcc editortest.c -lncurses -o editortest
*/

#include <ncurses.h>

void clear_bar(WINDOW* bar) {
        wclear(bar);
        int i;
        for(i=0;i<COLS;i++) waddch(bar, ' ');
        wmove(bar, 0, 0);
}

int main(int argc, char** args)
{
        WINDOW* titlebar;
        WINDOW* statusbar;
        WINDOW* textarea;

        initscr();
        raw();
        refresh();

        titlebar  = newwin(1, COLS, 0, 0);
        statusbar = newwin(1, COLS, LINES-1, 0);
        textarea  = newwin(LINES-2, COLS, 1, 0);

        keypad(textarea, TRUE);

        wattron(titlebar, A_REVERSE);
        wattron(statusbar, A_REVERSE);

        clear_bar(titlebar);
        clear_bar(statusbar);
        wclear(textarea);

        wprintw(titlebar, "Titlebar");
        wprintw(statusbar, "Statusbar");
        wprintw(textarea, "Test");
        wmove(textarea, 0, 0);

        wrefresh(statusbar); //The cursor will NOT skip a column near the right edge when you comment out this line (???)
        wrefresh(titlebar);
        wrefresh(textarea);

        unsigned long row = 0, col = 0;
        while(1) {
                int c = wgetch(textarea);

                if(c == KEY_UP) row--;
                if(c == KEY_DOWN) row++;
                if(c == KEY_LEFT) col--;
                if(c == KEY_RIGHT) col++;
                if(c == 'q') break;

                wclear(textarea);
                wprintw(textarea, "Test");
                wmove(textarea, row, col);
                wrefresh(textarea);
        }

        endwin();
        return 0;
}
[/code]

Re: Column Skipping

by Thomas Dickey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 10 Sep 2009, MTK358 wrote:

>
> I am trying to make an ncurses command line text editor, but the problem is
> that for some reason the cursor skips a column near the right edge of the
> terminal. This for some reason only happens when I refresh the statusbar
> WINDOW in the beginning.

What's the actual terminal emulator, and what's $TERM ?

(some differ with wrapping behavior - for instance, using PuTTY with
TERM=xterm can produce interesting effects).

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Parent Message unknown Re: Re: Column Skipping

by MTK358 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> What's the actual terminal emulator

GNOME Terminal 2.26.3.1



_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Re: Re: Column Skipping

by Thomas Dickey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 10 Sep 2009, Michael Kirsch wrote:

>> What's the actual terminal emulator
>
> GNOME Terminal 2.26.3.1

I see a jump in gnome (2.26.2) terminal from column 77 to 79.

None of the other terminals at hand do this (xterm, rxvt, pterm, konsole,
linux).

As far as ncurses is concerned, there aren't any boundaries at that point.
Wrapping differences would be on column 80 versus column 1.

It seems it's another item to add to the catalog of gnome-terminal bugs.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Re: Re: Column Skipping

by MTK358 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-09-10 at 20:31 -0400, Thomas Dickey wrote:

> On Thu, 10 Sep 2009, Michael Kirsch wrote:
>
> >> What's the actual terminal emulator
> >
> > GNOME Terminal 2.26.3.1
>
> I see a jump in gnome (2.26.2) terminal from column 77 to 79.
>
> None of the other terminals at hand do this (xterm, rxvt, pterm, konsole,
> linux).

At least that's good, but I don't have any other terminal to try it on.
I can't even use the Ctrl+Alt+F# terminals because of the stupid nVidia
driver.



_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Re: Re: Column Skipping

by Thomas Dickey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 10 Sep 2009, Michael Kirsch wrote:

> On Thu, 2009-09-10 at 20:31 -0400, Thomas Dickey wrote:
>> On Thu, 10 Sep 2009, Michael Kirsch wrote:
>>
>>>> What's the actual terminal emulator
>>>
>>> GNOME Terminal 2.26.3.1
>>
>> I see a jump in gnome (2.26.2) terminal from column 77 to 79.
>>
>> None of the other terminals at hand do this (xterm, rxvt, pterm, konsole,
>> linux).
>
> At least that's good, but I don't have any other terminal to try it on.
> I can't even use the Ctrl+Alt+F# terminals because of the stupid nVidia
> driver.

xterm and rxvt are relatively easy to compile or install (relative to
gnome-terminal).

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses