Terminal control/Restricted width positional input/With wrapping: Difference between revisions

m (added highlighting and whitespace.)
Line 433:
var res = input.call(3, 5, 8)
System.print(res)</lang>
 
=={{header|Yabasic}}==
<lang Yabasic>// Rosetta Code problem: http://rosettacode.org/wiki/Restricted_width_positional_input/With_wrapping
// by Galileo, 04/2022
 
clear screen
 
sub getInput$(r, c, long)
local text$, c$, ini, lt
c = c - 1
r = r - 1
print at(c, r);
do
c$ = inkey$
if c$ = "enter" break
if c$ = "backspace" then
text$ = left$(text$, len(text$) - 1)
print "\b ";
else
text$ = text$ + c$
end if
lt = len(text$)
if lt > long then ini = lt - long + 1 else ini = 1 end if
print at(c, r) mid$(text$, ini, long);
loop
return text$
end sub
 
text$ = getInput$(3, 5, 8)
print at(1, 23) "You entered: ", text$</lang>
672

edits