Terminal control/Restricted width positional input/No wrapping: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
|||
Line 406: | Line 406: | ||
Text(0, Str); |
Text(0, Str); |
||
]</lang> |
]</lang> |
||
=={{header|Yabasic}}== |
|||
<lang Yabasic>// Rosetta Code problem: http://rosettacode.org/wiki/Restricted_width_positional_input/No_wrapping |
|||
// by Galileo, 04/2022 |
|||
clear screen |
|||
sub getInput$(r, c, long) |
|||
local text$, c$ |
|||
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 |
|||
if len(text$) < long text$ = text$ + c$ |
|||
end if |
|||
print at(c, r) text$; |
|||
loop |
|||
return text$ |
|||
end sub |
|||
text$ = getInput$(3, 5, 8) |
|||
print at(1, 23) "You entered: ", text$</lang> |