Re: wordwrap during console input

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 
--trace(1) 
integer n = get_key() 
if n != -1 then 
  if find(n,{10,13}) -- [enter] 
    then return inputline 
    else if equal(n,8) -- 8 = [backspace] 
           then  
                junk = get_position() 
                if not equal(junk[2],1) then 
                  position(junk[1],junk[2]-1) 
                  puts(1,' ') 
                  position(junk[1],junk[2]-1) 
                  inputline = inputline[1..$-1] 
                end if 
                if equal(junk[2],1) then 
		  position(junk[1]-1,col_count) 
		  puts(1,' ') 
		  position(junk[1]-1,col_count) 
		  inputline = inputline[1..$-1] 
                end if 
                 
           else  
                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 
                position(row_count-3,1) 
                puts(1,inputline) 
                if colflag then  
                  position(junk[1]+1,1) 
                  colflag = 0 
                end if 
         end if        
  end if 
end if   
sleep(0) 
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 also coded a backspace function (ASerpa's Bug Ticket #915), 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.

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu