summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2006-03-21 10:10:43 +0000
committerAkira TAGOH <akira@tagoh.org>2006-03-21 10:10:43 +0000
commita0c4ea09653df8275fee98f18c789e882be5118b (patch)
tree550da676dad12c2cf0d962a226888465b8629fe5 /lib
parent2013cb70feab6d959089405d0cb643a4cb51cdb6 (diff)
* lib/hg_init.ps (executive): take care of the real /undefinedfilename
from interactive shell. load/save history. * libretto/operator.c (_libretto_operator_op_private_hg_loadhistory): implemented. (_libretto_operator_op_private_hg_savehistory): implemented. (_libretto_operator_op_private_hg_statementedit): fixed a memory leak and detect EOL. * hieroglyph/hglineedit.c (hg_line_edit_load_history): new function. (hg_line_edit_save_history): new function.
Diffstat (limited to 'lib')
-rw-r--r--lib/hg_init.ps35
1 files changed, 27 insertions, 8 deletions
diff --git a/lib/hg_init.ps b/lib/hg_init.ps
index 4c5d7d8..b2c2391 100644
--- a/lib/hg_init.ps
+++ b/lib/hg_init.ps
@@ -84,16 +84,33 @@ true .setglobal
/executive {
{
{
- systemdict /.statementedit known {
- % this is a workaround to get libedit working
- % with keep the prompt during deletion of the previous character.
- .promptmsg .statementedit cvx exec
- } {
- prompt (%statementedit) (r) file cvx exec
- } ifelse
+ {
+ systemdict /.statementedit known {
+ % this is a workaround to get libedit working
+ % with keep the prompt during deletion of the previous character.
+
+ % stacking null is actually meaningless.
+ % but it needs to keep the same depth of stack with (%statementedit) stuff.
+ .promptmsg null exch .statementedit exch pop
+ } {
+ prompt (%statementedit) (r) file
+ } ifelse
+ } stopped {
+ % need to detect an empty line separately to take care of /undefinedfilename.
+ $error /newerror get {
+ $error /errorname get /undefinedfilename eq {
+ pop pop .clearerror exit
+ } {
+ % we don't care of this error here.
+ stop
+ } ifelse
+ } if
+ } if
+ dup type /filetype eq {
+ cvx exec
+ } if
} stopped {
$error /newerror get {
- $error /errorname get /undefinedfilename eq {pop pop .clearerror exit} if
errordict /handleerror get exec
.clearerror
} if
@@ -245,5 +262,7 @@ end
% if JOBSERVER isn't true, it means one gives the initializer to libretto_vm_startjob().
% so no need to read PS from stdin.
serverdict /JOBSERVER get {
+ (.hghistory) .loadhistory
.startjobserver executive
+ (.hghistory) .savehistory
} if