14c8945a0SNathan Whitehorn#!/bin/sh 2*a96ef450SBaptiste Daroussin# $Id: editbox2,v 1.8 2020/11/26 00:03:58 tom Exp $ 34c8945a0SNathan Whitehorn# example with extra- and help-buttons 44c8945a0SNathan Whitehorn 54c8945a0SNathan Whitehorn. ./setup-vars 64c8945a0SNathan Whitehorn 74c8945a0SNathan Whitehorn. ./setup-edit 84c8945a0SNathan Whitehorn 94c8945a0SNathan Whitehorncat << EOF > $input 104c8945a0SNathan WhitehornHi, this is an edit box. It can be used to edit text from a file. 114c8945a0SNathan Whitehorn 124c8945a0SNathan WhitehornIt's like a simple text editor, with these keys implemented: 134c8945a0SNathan Whitehorn 144c8945a0SNathan WhitehornPGDN - Move down one page 154c8945a0SNathan WhitehornPGUP - Move up one page 164c8945a0SNathan WhitehornDOWN - Move down one line 174c8945a0SNathan WhitehornUP - Move up one line 184c8945a0SNathan WhitehornDELETE - Delete the current character 194c8945a0SNathan WhitehornBACKSPC - Delete the previous character 204c8945a0SNathan Whitehorn 214c8945a0SNathan WhitehornUnlike Xdialog, it does not do these: 224c8945a0SNathan Whitehorn 234c8945a0SNathan WhitehornCTRL C - Copy text 244c8945a0SNathan WhitehornCTRL V - Paste text 254c8945a0SNathan Whitehorn 264c8945a0SNathan WhitehornBecause dialog normally uses TAB for moving between fields, 274c8945a0SNathan Whitehornthis editbox uses CTRL/V as a literal-next character. You 284c8945a0SNathan Whitehorncan enter TAB characters by first pressing CTRL/V. This 294c8945a0SNathan Whitehornexample contains a few tab characters. 304c8945a0SNathan Whitehorn 314c8945a0SNathan WhitehornIt supports the mouse - but only for positioning in the editbox, 324c8945a0SNathan Whitehornor for clicking on buttons. Your terminal (emulator) may support 334c8945a0SNathan Whitehorncut/paste. 344c8945a0SNathan Whitehorn 354c8945a0SNathan WhitehornTry to input some text below: 364c8945a0SNathan Whitehorn 374c8945a0SNathan WhitehornEOF 384c8945a0SNathan Whitehorn 394c8945a0SNathan Whitehorn$DIALOG --title "EDIT BOX" \ 404c8945a0SNathan Whitehorn --extra-button \ 414c8945a0SNathan Whitehorn --help-button \ 424c8945a0SNathan Whitehorn --fixed-font "$@" --editbox $input 0 0 2>$output 43*a96ef450SBaptiste Daroussinreturncode=$? 444c8945a0SNathan Whitehorn 454c8945a0SNathan Whitehorn. ./report-edit 46