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

Add the Common Lisp example using ncurses/croatoan
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
(Add the Common Lisp example using ncurses/croatoan)
Line 17:
 
[[Category:Terminal control]]
 
=={{header|Common Lisp}}==
==={{header|ncurses}}===
To interface ncurses from Lisp, the ''[https://www.cliki.net/croatoan croatoan]'' library is used.
<lang lisp>;; Load the library from the quicklisp repository
(ql:quickload "croatoan")
(in-package :croatoan)
 
(defun field-input-with-wrapping (row column input-length)
(with-screen (scr :input-echoing nil :cursor-visible t :enable-colors t :enable-function-keys t :input-blocking t)
(let ((field (make-instance 'field :position (list row column) :width input-length :max-buffer-length 30 :window scr)))
(setf (style field)
(list :background (list :simple-char #\.)))
(bind field #\newline 'accept)
(edit field)
(clear scr)
(refresh scr)
;; return the value of the field as a string
(value field))))
 
;; call the routine
(field-input-with-wrapping 2 4 8)</lang>
 
=={{header|Go}}==
69

edits