Euphoria
Ticket #120:
The scroll() routine in Unix does nothing.
-
Reported by
DerekParnell
Nov 21, 2009
The following code:
----
include std/graphics.e
integer keystroke, current_position
bk_color(15)
text_color(0)
clear_screen()
position(5,1)
puts(1, repeat('=', 80))
position(20,1)
puts(1, repeat('=', 80))
position(11,25)
puts(1, "╓────────────────────────────╖")
position(12,25)
puts(1, "║ Welcome To The SCROLL ZONE ║")
position(13,25)
puts(1, "╙────────────────────────────╜")
position(22,1)
puts(1, "Press 8 for up, 2 for down, or q to quit this program")
keystroke = get_key()
current_position = 11
while keystroke != 'q' do
if keystroke = '8' and current_position > 6 then
scroll(1,6,19)
current_position = current_position - 1
end if
if keystroke = '2' and current_position < 17 then
scroll(-1,6,19)
current_position = current_position + 1
end if
keystroke = get_key()
end while
clear_screen()
----
This works as expected in DOS, i.e., the text: "Welcome To The SCROLL ZONE" scroll up and down at the original column number - at least under DOSBOX on OSX and Windows it does.
This is not so in a native Unix terminal. The text is moved to column 1, and then scrolls up and down, leaving the original characters there. The only way to rid the screen of the original characters is to scroll over them.
Details
1. Comment by DerekParnell
Nov 22, 2009
I think I've fixed the scrolling on Unix consoles, but it needs confirmation by others.
The sample program uses unicode characters and there is still an issue with those. Here is an ASCII demo version of the program.
----
include std/graphics.e
include std/unicode.e
include std/sequence.e
integer keystroke, current_position
object unitext
bk_color(15)
text_color(0)
clear_screen()
position(5,1)
puts(1, repeat('=', 80))
position(20,1)
puts(1, repeat('=', 80))
position(11,25)
--unitext = toUTF( u"2554" & repeat_pattern(u"2550", 28) & u"2557", utf_16, utf_8)
--puts(1, unitext)
--puts(1, "╓────────────────────────────╖")
puts(1, "*")
text_color(6)
puts(1, "----------------------------")
text_color(0)
puts(1, "*")
position(12,25)
--unitext = toUTF( u"2551" & " Welcome To The SCROLL ZONE " & u"2551", utf_16, utf_8)
--puts(1, unitext)
--puts(1, "║ Welcome To The SCROLL ZONE ║")
puts(1, "|")
text_color(11)
bk_color(0)
puts(1, " Welcome To The SCROLL ZONE ")
bk_color(15)
text_color(0)
puts(1, "|")
position(13,25)
--unitext = toUTF( u"255A" & repeat_pattern(u"2550", 28) & u"255D", utf_16, utf_8)
--puts(1, unitext)
--puts(1, "╙────────────────────────────╜")
puts(1, "*")
text_color(6)
puts(1, "----------------------------")
text_color(0)
puts(1, "*")
position(22,1)
puts(1, "Press 8 for up, 2 for down, or q to quit this program")
keystroke = get_key()
current_position = 11
while keystroke != 'q' do
if keystroke = '8' and current_position > 6 then
scroll(1,6,19)
current_position = current_position - 1
end if
if keystroke = '2' and current_position < 17 then
scroll(-1,6,19)
current_position = current_position + 1
end if
keystroke = get_key()
end while
clear_screen()
----
2. Comment by jimcbrown
Nov 22, 2009
The ASCII version is also broken.
Now the scrolling area moves up and down correctly (i.e. the actual scrolling works) but the colors bleed through to the entire background, which goes from black to white as soon as you press 8 or 2.
3. Comment by DerekParnell
Nov 22, 2009
I'm a bit confused. Are you saying that before you press anything, that you have a black background? The demo program is supposed to be setting the background to white before it starts displaying any text.
4. Comment by jimcbrown
Nov 22, 2009
I think a few screen shots will clarify the situation.
http://malcom.unkmar.com/start.jpg
http://malcom.unkmar.com/up1.jpg
http://malcom.unkmar.com/down1.jpg
5. Comment by jimcbrown
Nov 22, 2009
I'm not seeing any change in behavior as of 3020.
I am sure I am using the correct eui, as well:
$ eui Euphoria Interpreter 4.0.0 development (r3020) for Linux Using System Memory
ERROR: Must specify the file to be interpreted on the command line
6. Comment by DerekParnell
Nov 22, 2009
This was working okay on Kubuntu but I've made some changes anyway. It seems like the clear_screen() is not using the current settings for FG and BG colors ... so I force them now. Also, I've changed the way BRIGHT colors get sent to the terminal, which should also now work for background colors.
Here is another demo program to show the color changes.
----
include std/graphics.e
text_color(BLACK)
bk_color(BRIGHT_WHITE)
clear_screen()
position(1,4)
text_color(BRIGHT_RED) bk_color(BRIGHT_WHITE) puts(1, "A")
text_color(BRIGHT_RED) bk_color(WHITE) puts(1, "A")
text_color(RED) bk_color(BRIGHT_WHITE) puts(1, "A")
text_color(RED) bk_color(WHITE) puts(1, "A")
bk_color(BRIGHT_RED) text_color(BRIGHT_WHITE) puts(1, "A")
bk_color(BRIGHT_RED) text_color(WHITE) puts(1, "A")
bk_color(RED) text_color(BRIGHT_WHITE) puts(1, "A")
bk_color(RED) text_color(WHITE) puts(1, "A")
position(3,23)
text_color(BRIGHT_BLUE) bk_color(YELLOW) puts(1, "B")
text_color(BRIGHT_BLUE) bk_color(BROWN) puts(1, "B")
text_color(BLUE) bk_color(YELLOW) puts(1, "B")
text_color(BLUE) bk_color(BROWN) puts(1, "B")
bk_color(BRIGHT_BLUE) text_color(YELLOW) puts(1, "B")
bk_color(BRIGHT_BLUE) text_color(BROWN) puts(1, "B")
bk_color(BLUE) text_color(YELLOW) puts(1, "B")
bk_color(BLUE) text_color(BROWN) puts(1, "B")
position(15,14)
text_color(GRAY) bk_color(BRIGHT_WHITE) puts(1, "C")
text_color(GRAY) bk_color(WHITE) puts(1, "C")
text_color(BLACK) bk_color(BRIGHT_WHITE) puts(1, "C")
text_color(BLACK) bk_color(WHITE) puts(1, "C")
bk_color(GRAY) text_color(BRIGHT_WHITE) puts(1, "C")
bk_color(GRAY) text_color(WHITE) puts(1, "C")
bk_color(BLACK) text_color(BRIGHT_WHITE) puts(1, "C")
bk_color(BLACK) text_color(WHITE) puts(1, "C")
position(5,67)
text_color(BRIGHT_MAGENTA) bk_color(BRIGHT_CYAN) puts(1, "D")
text_color(BRIGHT_MAGENTA) bk_color(CYAN) puts(1, "D")
text_color(MAGENTA) bk_color(BRIGHT_CYAN) puts(1, "D")
text_color(MAGENTA) bk_color(CYAN) puts(1, "D")
bk_color(BRIGHT_MAGENTA) text_color(BRIGHT_CYAN) puts(1, "D")
bk_color(BRIGHT_MAGENTA) text_color(CYAN) puts(1, "D")
bk_color(MAGENTA) text_color(BRIGHT_CYAN) puts(1, "D")
bk_color(MAGENTA) text_color(CYAN) puts(1, "D")
text_color(BLACK)
bk_color(BRIGHT_WHITE)
position(20,1)
----
7. Comment by DerekParnell
Nov 22, 2009
Really!???? That is weird. It's working fine on my linux (Kubuntu). What are you using?
8. Comment by jimcbrown
Nov 22, 2009
Gentoo - not sure what the official revision name is, but its the x86 2008.0 profile.
9. Comment by jimcbrown
Nov 22, 2009
I am aware that I am using a horribly out of date distro (2008.0 being ancient by Linux standards)
10. Comment by DerekParnell
Nov 22, 2009
Here are the screen shots of my system ...
http://derekparnell.id.au/before.png
http://derekparnell.id.au/up.png
http://derekparnell.id.au/down.png
and
http://derekparnell.id.au/colors.png
11. Comment by jimcbrown
Nov 22, 2009
Hmm. Is the default color of your terminal black-on-white (white background?) as it is with most xterms?
I set mine to white-on-black. If I use black-on-white, the problem isn't visible.
12. Comment by DerekParnell
Nov 22, 2009
Doesn't seem to matter what my default color scheme is. I changed it to and still got the same initial program screen
13. Comment by jimcbrown
Nov 22, 2009
I'm stumped.
Lets wait for the original poster to confirm this fix, if it works on Mac OS X then it's probably safe to call it fixed.
14. Comment by DerekParnell
Dec 31, 2009
No new information has come to light so for now this seems to have been fixed.