/contrib/dialog/samples/editbox2

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 45 lines · 38 code · 4 blank · 3 comment · 0 complexity · ae33e383a52a817991f7c8c24bb605f0 MD5 · raw file

  1. #!/bin/sh
  2. # $Id: editbox2,v 1.7 2010/01/13 10:20:03 tom Exp $
  3. # example with extra- and help-buttons
  4. . ./setup-vars
  5. . ./setup-edit
  6. cat << EOF > $input
  7. Hi, this is an edit box. It can be used to edit text from a file.
  8. It's like a simple text editor, with these keys implemented:
  9. PGDN - Move down one page
  10. PGUP - Move up one page
  11. DOWN - Move down one line
  12. UP - Move up one line
  13. DELETE - Delete the current character
  14. BACKSPC - Delete the previous character
  15. Unlike Xdialog, it does not do these:
  16. CTRL C - Copy text
  17. CTRL V - Paste text
  18. Because dialog normally uses TAB for moving between fields,
  19. this editbox uses CTRL/V as a literal-next character. You
  20. can enter TAB characters by first pressing CTRL/V. This
  21. example contains a few tab characters.
  22. It supports the mouse - but only for positioning in the editbox,
  23. or for clicking on buttons. Your terminal (emulator) may support
  24. cut/paste.
  25. Try to input some text below:
  26. EOF
  27. $DIALOG --title "EDIT BOX" \
  28. --extra-button \
  29. --help-button \
  30. --fixed-font "$@" --editbox $input 0 0 2>$output
  31. retval=$?
  32. . ./report-edit