liftoff / GateOne

Gate One is an HTML5-powered terminal emulator and SSH client
http://liftoffsoftware.com/Products/GateOne
Other
6.27k stars 923 forks source link

bugs with perl Curses applications that use 256color xterm emulation #246

Open steverader opened 11 years ago

steverader commented 11 years ago

My email (an MH/nmh interface really) and to-do list mgmt (a Taskwarrior interface) are both home made perl scripts that use perl-Curses and thus xterm 256 colorization escape sequences. They do not work well with GateOne: there are colorization problems, terminal location addressing problems and cursor placement bugs. I'm wondering if you all would be willing to these bugs?? I'd try myself, but i'm a C and perl guy--not python. :) I am, however, willing to provide simple perl scripts which show up the bugs.

steve

director of computing physics department university of wisconsin http://www.physics.wisc.edu/resources/computing/

liftoff commented 11 years ago

If you could post the scripts somewhere and a screenshot demonstrating the problem I'll fix it. There's not much use of 256 colors out in the wild so there's probably just a bug in the terminal emulation that I missed due to lack of good test cases.

For reference, Gate One has a "tests" directory that runs through all the 256 color sequences along with all the permutations thereof in conjunction with other text renditions. Even weirder things like "outline" and "left bar" are covered. All those tests passed the last time I checked so I suspect your problem has to do with a different sort of terminal emulation bug.

Once I get my hands on your scripts I will know for sure what's going on.

steverader commented 11 years ago

Hi Dan,

Thanks for the offer!!!!

Here's a perl curses script and two screen shots, the first shows the expected output (in an xterm) and the second demonstrates GateOne rendering problems which I hope you can easily reproduce.

Let me know what else I can do to help!?

cheers,

steve

On Mon, May 6 2013 at 9:10am PDT, Dan McDougall notifications@github.com wrote:

If you could post the scripts somewhere and a screenshot demonstrating the problem I'll fix it. There's not much use of 256 colors out in the wild so there's probably just a bug in the terminal emulation that I missed due to lack of good test cases.

For reference, Gate One has a "tests" directory that runs through all the 256 color sequences along with all the permutations thereof in conjunction with other text renditions. Even weirder things like "outline" and "left bar" are covered. All those tests passed the last time I checked so I suspect your problem has to do with a different sort of terminal emulation bug.

Once I get my hands on your scripts I will know for sure what's going on.


Reply to this email directly or view it on GitHub: https://github.com/liftoff/GateOne/issues/246#issuecomment-17491133

!/usr/bin/perl -w

#

invoke using...

xterm -geom 90x50 +sb -title vit_test -e ./layout

#

use strict; use Curses;

$ENV{'TERM'} = 'xterm-256color';

my $COLOR_DEFAULT = 0; my $COLOR_HEADER = 1; my $COLOR_ERRORS = 2; my $COLOR_SCROLLBAR = 3; my $COLOR_LISTING_PRIO_NONE_PRIMARY = 10; my $COLOR_LISTING_PRIO_NONE_SECONDARY = 11; my $COLOR_LISTING_CURRENT = 12; my $COLOR_LISTING_PRIO_H_PRIMARY = 13; my $COLOR_LISTING_PRIO_H_SECONDARY = 14;

initscr(); curs_set(0); noecho(); start_color(); use_default_colors();

init_pair($COLOR_DEFAULT,16,231); # black on white init_pair($COLOR_HEADER,16,231); # black on medium gray init_pair($COLOR_ERRORS,231,1); # red on white init_pair($COLOR_SCROLLBAR,16,248); # dark gray init_pair($COLOR_LISTING_CURRENT,231,68); # white on gtk+ blue init_pair($COLOR_LISTING_PRIO_NONE_PRIMARY,16,231); # black on white init_pair($COLOR_LISTING_PRIO_NONE_SECONDARY,16,255); # black on light gray init_pair($COLOR_LISTING_PRIO_H_PRIMARY,4,15); # blue on white init_pair($COLOR_LISTING_PRIO_H_SECONDARY,4,255); # blue on light gray

my $HEADER_SIZE = 2; my $REPORT_LINES = $LINES - $HEADER_SIZE - 1; my $REPORT_COLS = $COLS-2;

my $header_win = newwin(2, $COLS, 0, 0); my $report_win = newwin($REPORT_LINES+$HEADER_SIZE, $REPORT_COLS+2, 2, 1); my $prompt_win = newwin(1, $COLS, $LINES-1, 0);

my @report; while() { chop $; push(@report,$); }

$report_win->attron(A_BOLD); $report_win->attron(A_UNDERLINE); $report_win->addstr(0,0,"ID Proj Prio Age Description "); $report_win->attroff(A_UNDERLINE); $report_win->attroff(A_BOLD);

"report" (default task report output)...

for my $i (1 .. $REPORT_LINES) { my $color = $COLOR_LISTING_PRIO_NONE_PRIMARY; if ( $i % 2 == 0 ) { if ( $i < 6 ) { $color = $COLOR_LISTING_PRIO_H_PRIMARY; } } else { if ( $i < 6 ) { $color = $COLOR_LISTING_PRIO_H_SECONDARY; } else { $color = $COLOR_LISTING_PRIO_NONE_SECONDARY; } } if ( $i > $#report ) { $report_win->attron(COLOR_PAIR($COLOR_DEFAULT)); $report_win->addstr($i,0,'~'); $report_win->attroff(COLOR_PAIR($COLOR_DEFAULT)); next; } $report_win->attron(COLOR_PAIR($color)); my $l = sprintf("%-${REPORT_COLS}.${REPORT_COLS}s",$report[$i]); $report_win->addstr($i,0,$l); $report_win->attroff(COLOR_PAIR($color)); } $report_win->attron(COLOR_PAIR($COLOR_LISTING_CURRENT)); my $l = sprintf("%-${REPORT_COLS}.${REPORT_COLS}s",$report[8]); $report_win->addstr(10,0,$l); $report_win->attroff(COLOR_PAIR($COLOR_LISTING_CURRENT)); $report_win->refresh();

scrollbar...

if ( $#report > $REPORT_LINES ) { $report_win->attron(COLOR_PAIR($COLOR_SCROLLBAR)); for my $i (1 .. 6) { $report_win->addstr($i, $REPORT_COLS+1, ' '); } $report_win->attroff(COLOR_PAIR($COLOR_SCROLLBAR)); $report_win->refresh(); }

header...

&draw_line($header_win,$COLOR_HEADER,0,'task ls','50 tasks pending'); &draw_line($header_win,$COLOR_HEADER,1,'convergence in 5 mths','1023 tasks completed');

prompt...

&draw_line($prompt_win,$COLOR_DEFAULT,0,':command prompt','Top ',1); $prompt_win->refresh();

exit...

$report_win->getch(); endwin();

exit;

--

sub drawline { my ($win,$color,$row,$lhs,$rhs) = @; my $pad = ' ' x $COLS; $win->attron(COLOR_PAIR($color)); if ( $win == $header_win ) { $win->attron(A_BOLD); } $win->addstr($row, 0, $pad); $win->addstr($row, 0, $lhs); $win->addstr($row, $COLS - length($rhs), $rhs); if ( $win == $header_win ) { $win->attroff(A_BOLD); } $win->attroff(COLOR_PAIR($color)); $win->refresh(); }

DATA 26 H 2mo Stiff common weather dust egg thought short drive 30 H 8wk Change picture touch use sense out rough spell 37 H 5d Song study rule run sing 20 H 11mo Cry cheap think control sense 18 H 6mo Automatic ice climb reward trousers detail 24 H 3mo Keep angle while feel observation cook live 21 3mo Learn leaf female punishment sister earth come have 25 2mo Organization know observation see buy 29 8wk Error in heart with gold nose idea 27 8wk Need spell attraction now step 31 2wk Reason dress as chalk necessary sense send 35 8d Adjustment needle sticky fish about 36 8d Visit parcel out be pocket believe 39 2d Stick cough knowledge have moon 38 2d Stop do wake mist paste doubt sea like 40 1d Study morning hurt reading wave 41 9h Play healthy trade disappear cut 10 cheap 1.5y Roll forget crush error the 19 cheap 6mo Brick rail person because glove from 17 from 7mo Digestion foolish bark wrong question 16 from 7mo Pull disease attention danger bit explain change 15 from 7mo Tray stone south stop jewel together where name 22 from 3mo Find basin ink be smooth hate brown 23 from 3mo Ring vessel discovery bite stocking stone 32 from 10d Ear produce learn help wound profit horse 34 from 10d Office group hunt punishment arch shout see grass 33 from 10d Wash mine visit swim swim roll 9 loud 1.5y Hope push complete visit may floor 28 loud 8wk Committee be old sink wash 6 natural 1.9y Spell distribution small ride become 11 natural 1.1y Disappear meet think flat star quick 12 natural 1.1y Level steam jump drink breath put 13 natural 11mo Industry push news eat circle open thick 3 potato 1.9y Answer brush right narrow hunt 7 potato 1.9y Dead mouth butter disgust brush when 2 potato 1.9y Dear kill private help snow sister 4 potato 1.9y Shirt tell hope explain electric or 1 potato 1.9y Through spend carry motion ever be jump break 8 potato 1.9y War answer question give sweet 14 potato 9mo Growth do north blade representative 5 wise 1.9y News island drive open fact private animal

steverader commented 11 years ago

Looks like the github mail gateway mangles MIME attachments so I'm attaching them here. The script, unmangled, can be found at http://www.hep.wisc.edu/~rader/vit-layout-test

xtermplusperlcursesscreenshot gateoneplusperlcursesproblemscreenshot

Sorry about that. Thanks for your efforts. Getting this working will be awesome.