Original date:2015-02-12 00:30:38 Edited by: katsmeow Subject: Re: wordwrap during console input

Greg, using

inputline = gets(0) 
return inputline 
the input line stops at the end of the first screen row at the right side. If column count is 80, i can enter the 80th character, but the cursor stays at the 80th column as well. This is using eui or euiw , version Euphoria-10-Feb-2013 (the last stable release i am aware of).

However, using
-- get user text typed or pasted to input region at bottom of console window 
-- test is echoed to screen as it's typed 
-- 4 lines max, and only [backspace] is working 
function get_text() 
sequence inputline = "" 
integer colflag = 0 
while 1 do 
integer n = get_key() 
if n != -1 then 
  if find(n,{10,13}) -- [enter] 
    then return inputline 
    else if equal(n,8) -- 8 = [backspace] 
                junk = get_position() 
                if not equal(junk[2],1) then 
                  puts(1,' ') 
                  inputline = inputline[1..$-1] 
                end if 
                if equal(junk[2],1) then 
		  puts(1,' ') 
		  inputline = inputline[1..$-1] 
                end if 
                inputline &= n 
                if (length(inputline) > (4*col_count)-2) then return inputline end if 
                junk = get_position() 
                if equal(junk[2],col_count) then colflag = 1 end if 
                if colflag then  
                  colflag = 0 
                end if 
         end if        
  end if 
end if   
end while 
return "" 
end function --get_text() 
-- cursor go left  = 1016384 
-- cursor go right = 1016416 
i can enter 4 screenlines 80 chars wide, and most likely as many screen lines as i want. But i also don't have mouse or cursor controls. I coded a backspace function, as you can see, and i should recode the if-stack as a case-stack. I'm not really looking for much as a gui (it's only an irc bot interface, not a real client), but i did expect as much as i find in a dos console window, like when doing a netstat or wget or dir or mogrify operation.


Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu