• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscapheguic翻訳omegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

シェルスクリプト言語xyzshのソースコード。


コミットメタ情報

リビジョンab78e2bcd178d9b394d41f63a4146ff966a562d9 (tree)
日時2013-02-01 13:50:51
作者ab25q <ab25cq@gmai...>
コミッターab25q

ログメッセージ

1.3.3

変更サマリ

差分

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -23,6 +23,18 @@
2323
2424 9. Modified completion working especially tilde completion..
2525
26+ 10. Fixed below bug.
27+
28+ > adfasfa | less
29+ no an error occures
30+
31+ |
32+ |
33+ v
34+
35+ > adfastfa | less
36+ adfastfa is not found
37+
2638 2013 20th January version 1.3.2
2739
2840 1. Added "strip" and "objinfo" inner command
--- a/help.xyzsh
+++ b/help.xyzsh
@@ -1931,6 +1931,10 @@ insert_text (text)
19311931 -
19321932 コンプレッション時のテキスト挿入。
19331933 -
1934+forced_update_display
1935+-
1936+テキスト削除やテキスト挿入をした後に呼び出すと画面が更新される。
1937+-
19341938 write_history (file name)
19351939 -
19361940 ヒストリをファイルに書き込む
@@ -1965,6 +1969,10 @@ insert_text (text)
19651969 -
19661970 add string to editing line on completion.
19671971 -
1972+forced_update_display
1973+-
1974+call this after "insert_text" or "delete_text" to update command line.
1975+-
19681976 write_history (file name)
19691977 -
19701978 write readline cmdline history to a file
--- a/src/ext/migemo.so.xyzsh
+++ b/src/ext/migemo.so.xyzsh
@@ -56,7 +56,7 @@ root::run(
5656 )
5757 )
5858
59- def is_all_ascii (
59+ def ascii_only (
6060 | length -byte | var -local LEN
6161
6262 LEN | -eq $(| length -utf8)
@@ -66,47 +66,59 @@ root::run(
6666 print $ARGV[0] | var -local inputing
6767 print $ARGV[1] | var -local editing_line
6868
69+ print 1 | var -local ALL_ASCII_ONLY
6970 | each (
70- if (inputing | =~ '.*\/[a-zA-Z]+$') (
71- | if(|=~ '.*\/[a-zA-Z]+[^a-zA-z/]+$') (
72- (inputing; |print) | common_head | var -local same_head
73-
74- same_head | var -local no_migemo_string
75- inputing | sub -no-regex $same_head '' | var -local migemo_string
76- ) else (
77- inputing | sub '(.*\/)[a-zA-Z]+$' '\1' | var -local no_migemo_string
78- inputing | sub '.*\/([a-zA-Z]+)$' '\1' | var -local migemo_string
71+ if(|ascii_only) (
72+ | if(| index $inputing | = 0\n) (
73+ | print
7974 )
80- ) elif (inputing | =~ '.*\/[^a-zA-Z]+[a-zA-Z]+$') (
81- inputing | sub '(.*\/[^a-zA-Z]+)[a-zA-Z]+$' '\1' | var -local no_migemo_string
82- inputing | sub '.*\/[^a-zA-Z]+([a-zA-Z]+)$' '\1' | var -local migemo_string
83- ) elif (inputing | =~ '[a-zA-Z]+$') (
84- | if(|=~ '[a-zA-Z]+[^a-zA-z/]+$') (
85- (inputing; |print) | common_head | var -local same_head
86-
87- same_head | var -local no_migemo_string
88- inputing | sub -no-regex $same_head '' | var -local migemo_string
75+ ) else (
76+ print 0 | var -local ALL_ASCII_ONLY
77+
78+ if (inputing | =~ '.*\/[a-zA-Z]+$') (
79+ | if(|=~ '.*\/[a-zA-Z]+[^a-zA-z/]+$') (
80+ (inputing; |print) | common_head | var -local same_head
81+
82+ same_head | var -local no_migemo_string
83+ inputing | sub -no-regex $same_head '' | var -local migemo_string
84+ ) else (
85+ inputing | sub '(.*\/)[a-zA-Z]+$' '\1' | var -local no_migemo_string
86+ inputing | sub '.*\/([a-zA-Z]+)$' '\1' | var -local migemo_string
87+ )
88+ ) elif (inputing | =~ '.*\/[^a-zA-Z]+[a-zA-Z]+$') (
89+ inputing | sub '(.*\/[^a-zA-Z]+)[a-zA-Z]+$' '\1' | var -local no_migemo_string
90+ inputing | sub '.*\/[^a-zA-Z]+([a-zA-Z]+)$' '\1' | var -local migemo_string
91+ ) elif (inputing | =~ '[a-zA-Z]+$') (
92+ | if(|=~ '[a-zA-Z]+[^a-zA-z/]+$') (
93+ (inputing; |print) | common_head | var -local same_head
94+
95+ same_head | var -local no_migemo_string
96+ inputing | sub -no-regex $same_head '' | var -local migemo_string
97+ ) else (
98+ print "" | var -local no_migemo_string
99+ inputing | var -local migemo_string
100+ )
101+ ) elif (inputing | =~ '[^a-zA-Z]+[a-zA-Z]+$') (
102+ inputing | sub '([^a-zA-Z]+)[a-zA-Z]+$' '\1' | var -local no_migemo_string
103+ inputing | sub '[^a-zA-Z]+([a-zA-Z]+)$' '\1' | var -local migemo_string
89104 ) else (
90105 print "" | var -local no_migemo_string
91- inputing | var -local migemo_string
106+ print "" | var -local migemo_string
92107 )
93- ) elif (inputing | =~ '[^a-zA-Z]+[a-zA-Z]+$') (
94- inputing | sub '([^a-zA-Z]+)[a-zA-Z]+$' '\1' | var -local no_migemo_string
95- inputing | sub '[^a-zA-Z]+([a-zA-Z]+)$' '\1' | var -local migemo_string
96- ) else (
97- print "" | var -local no_migemo_string
98- print "" | var -local migemo_string
99- )
100108
101- | if(| sub -no-regex $no_migemo_string '' | chomp | migemo::match $migemo_string | lines 0 | = 0\n) (
102- | print
109+ | if(| sub -no-regex $no_migemo_string '' | chomp | migemo::match $migemo_string | lines 0 | = 0\n) (
110+ | print
111+ )
103112 )
104113 ) | (| common_head | var -local COMMON_HEAD; | length -line-num | var -local NUM)
105114
106- if(COMMON_HEAD | chomp | -n && COMMON_HEAD | length | -gt $(inputing | length)) (
115+ if(ALL_ASCII_ONLY | = 0\n && COMMON_HEAD | chomp | -n && COMMON_HEAD | length | -gt $(inputing | length)) (
107116 rl::delete_text $(editing_line | rindex $inputing) $(rl::point)
108- rl::insert_text $COMMON_HEAD
109- if(NUM | chomp | -eq 1 && COMMON_HEAD| chomp | rows -1 | != /) ( rl::insert_text " " )
117+ if(NUM | chomp | -eq 1 && COMMON_HEAD| chomp | rows -1 | != /) (
118+ rl::insert_text $COMMON_HEAD" "
119+ ) else (
120+ rl::insert_text $COMMON_HEAD
121+ )
110122 )
111123 )
112124
@@ -145,7 +157,8 @@ root::run(
145157 )
146158 )
147159
148- if(MIGEMO_COMPLETION_AUTO_LOAD | = 1\n || readline "Do you want to use migemo completion which is Japanese ROMAJI completion?(y/n)" | chomp |=~ -ignore-case ^y) (
160+ if((defined MIGEMO_COMPLETION_AUTO_LOAD && MIGEMO_COMPLETION_AUTO_LOAD | = 1\n) || readline "Do you want to use migemo completion which is Japanese ROMAJI completion?(y/n)" | chomp |=~ -ignore-case ^y) (
149161 MigemoCompletion
162+ print "loaded migemo completion.\n"
150163 )
151164 )
--- a/src/readline.c
+++ b/src/readline.c
@@ -792,12 +792,19 @@ BOOL cmd_readline_point_move(sObject* nextin, sObject* nextout, sRunInfo* runinf
792792 return TRUE;
793793 }
794794
795+BOOL cmd_readline_forced_update_display(sObject* nextin, sObject* nextout, sRunInfo* runinfo)
796+{
797+ puts("");
798+ rl_forced_update_display();
799+ runinfo->mRCode = 0;
800+
801+ return TRUE;
802+}
803+
795804 BOOL cmd_readline_insert_text(sObject* nextin, sObject* nextout, sRunInfo* runinfo)
796805 {
797806 if(runinfo->mArgsNumRuntime == 2) {
798807 (void)rl_insert_text(runinfo->mArgsRuntime[1]);
799- puts("");
800- rl_forced_update_display();
801808
802809 runinfo->mRCode = 0;
803810 }
@@ -818,8 +825,6 @@ BOOL cmd_readline_delete_text(sObject* nextin, sObject* nextout, sRunInfo* runin
818825 if(rl_point < 0) {
819826 rl_point = 0;
820827 }
821- puts("");
822- rl_forced_update_display();
823828
824829 runinfo->mRCode = 0;
825830 }
--- a/src/run.c
+++ b/src/run.c
@@ -331,6 +331,24 @@ static BOOL wait_child_program(pid_t pid, pid_t nextin_reader_pid, int nextout2,
331331
332332 return FALSE;
333333 }
334+ /// exited normally ///
335+ else if(WIFEXITED(status)) {
336+ /// command not found ///
337+ if(WEXITSTATUS(status) == 127) {
338+ if(gAppType == kATConsoleApp) // && nextout2 == 1)
339+ {
340+ if(tcsetpgrp(0, getpgid(0)) < 0) {
341+ perror("tcsetpgrp(xyzsh)");
342+ exit(1);
343+ }
344+ }
345+
346+ char buf[BUFSIZ];
347+ snprintf(buf, BUFSIZ, "command not found");
348+ err_msg(buf, runinfo->mSName, runinfo->mSLine, program);
349+ return FALSE;
350+ }
351+ }
334352 else if(WIFSIGNALED(status)) { // a xyzsh external program which is not a last command can't be stopped by CTRL-Z
335353 err_msg("signal interrupt8", runinfo->mSName, runinfo->mSLine, program);
336354
--- a/src/uobject.c
+++ b/src/uobject.c
@@ -116,6 +116,7 @@ void uobject_root_init(sObject* self)
116116 uobject_put(self, "rl", readline);
117117
118118 uobject_put(readline, "file_name_completion_null_generator", NFUN_NEW_GC(cmd_readline_file_name_completion_null_generator, NULL, TRUE));
119+ uobject_put(readline, "forced_update_display", NFUN_NEW_GC(cmd_readline_forced_update_display, NULL, TRUE));
119120 uobject_put(readline, "insert_text", NFUN_NEW_GC(cmd_readline_insert_text, NULL, TRUE));
120121 uobject_put(readline, "delete_text", NFUN_NEW_GC(cmd_readline_delete_text, NULL, TRUE));
121122 uobject_put(readline, "clear_screen", NFUN_NEW_GC(cmd_readline_clear_screen, NULL, TRUE));
--- a/src/xyzsh/xyzsh.h
+++ b/src/xyzsh/xyzsh.h
@@ -567,6 +567,7 @@ BOOL cmd_objinfo(sObject* nextin, sObject* nextout, sRunInfo* runinfo);
567567 BOOL cmd_kanjicode(sObject* nextin, sObject* nextout, sRunInfo* runinfo);
568568 BOOL cmd_defined(sObject* nextin, sObject* nextout, sRunInfo* runinfo);
569569 BOOL cmd_funinfo(sObject* nextin, sObject* nextout, sRunInfo* runinfo);
570+BOOL cmd_readline_forced_update_display(sObject* nextin, sObject* nextout, sRunInfo* runinfo);
570571 BOOL cmd_readline_file_name_completion_null_generator(sObject* nextin, sObject* nextout, sRunInfo* runinfo);
571572 BOOL cmd_readline_replace_line(sObject* nextin, sObject* nextout, sRunInfo* runinfo);
572573 BOOL cmd_readline_point(sObject* nextin, sObject* nextout, sRunInfo* runinfo);