mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
AutoComplete improvements.
Autocomplete does syntax highlighting, showing symbol type. Public symbols are inverted. Dictionary words are black. AutoComplete window stays where you move it. Location persistent after reboot. F11 and F12 can be used to jump to src code.
This commit is contained in:
parent
7bc3d73320
commit
c6d687e1cd
10 changed files with 1162 additions and 1108 deletions
Binary file not shown.
Binary file not shown.
|
@ -2,13 +2,21 @@ $FG,5$$TX+CX,"AutoComplete is in StandBy"$$FG$
|
|||
|
||||
$FG,4$$TX+CX+L+PU+UL,"System Keys Quick Guide",A="::/Doc/HelpIndex.DD"$$FG$
|
||||
$FG,4$$TX+CX,"(Works Everywhere)"$$FG$
|
||||
$FG,2$ <SPACE> $FG$Left-Click
|
||||
$FG,2$ <ENTER> $FG$Right-Click
|
||||
$FG,2$ <F1> $FG$Help
|
||||
$FG,2$ <CTRL-m> $FG$Personal Menu
|
||||
$FG,2$ <ESC> $FG$Save & Exit
|
||||
$FG,2$<SHIFT-ESC> $FG$Abort & Exit
|
||||
$FG,2$ <WINDOWS> $FG$Pull-Down Menu
|
||||
$FG,2$ <SPACE> $FG$ Left-Click
|
||||
$FG,2$ <ENTER> $FG$ Right-Click
|
||||
$FG,2$ <F1> $FG$ Help
|
||||
$FG,2$ <CTRL-m> $FG$ Personal Menu
|
||||
$FG,2$ <ESC> $FG$ Save & Exit
|
||||
$FG,2$<SHIFT-ESC> $FG$ Abort & Exit
|
||||
$FG,2$ <WINDOWS> $FG$Pull-Down Menu
|
||||
$FG,2$<ALT-SHIFT-N>$FG$Close AC
|
||||
$FG,2$ <CTRL-D>$FG$ File Manager
|
||||
$FG,2$ <CTRL-F>$FG$ Find
|
||||
$FG,2$ <ALT-M>$FG$ Max Window
|
||||
$FG,2$ <ALT-H>$FG$ Horz Tile
|
||||
$FG,2$ <ALT-V>$FG$ Vert Tile
|
||||
$FG,2$ <CTRL-L>$FG$ Text Menu
|
||||
$FG,2$<CTRL-ALT-N>$FG$ Close AC
|
||||
|
||||
$FG,4$$TX+CX+L+PU+UL,"Tongues",A="::/Zenith/God/HSNotes.DD"$$FG$
|
||||
$FG,4$$TX+CX,"(Works Everywhere)"$$FG$
|
||||
|
|
BIN
src/Kernel.BIN.C
BIN
src/Kernel.BIN.C
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -1493,10 +1493,12 @@ public class CWinMgrGlobals
|
|||
|
||||
#help_index "AutoComplete"
|
||||
#define ACf_INIT_IN_PROGRESS 0
|
||||
#define AC_FILLINS_NUM 10
|
||||
#define ACf_LAST_WAS_KEYMAP 1
|
||||
|
||||
#define AC_FILLINS_NUM 12
|
||||
public class CAutoCompleteGlobals
|
||||
{
|
||||
I64 num_words;
|
||||
I64 col,row,old_col,old_row,num_words;
|
||||
CHashTable *hash_table;
|
||||
U8 *cur_word;
|
||||
I64 flags;
|
||||
|
|
Binary file not shown.
|
@ -127,6 +127,8 @@ public U0 ACInit(U8 *mask=NULL)
|
|||
ACMainFileListTraverse(mask);
|
||||
|
||||
ACDWordsLoad;
|
||||
RegDefault("AutoComplete", "ac.col = TEXT_COLS-30;ac.row = 15;");
|
||||
RegExe("AutoComplete");
|
||||
LBtr(&ac.flags,ACf_INIT_IN_PROGRESS);
|
||||
LBts(&sys_run_level,RLf_AUTO_COMPLETE);
|
||||
AutoComplete(ON);
|
||||
|
|
|
@ -4,12 +4,12 @@ U0 ACDDictWordsAdd(U8 *st)
|
|||
I64 i;
|
||||
U8 *ptr;
|
||||
if (st && *st && (ptr=ACDWordPtAt(st))) {
|
||||
for (i=0;i<ACD_FILLINS_NUM;i++) {
|
||||
for (i = 0; i < ACD_FILLINS_NUM; i++) {
|
||||
if (*ptr++!=ACD_WORD_CHAR)
|
||||
break;
|
||||
if (i) '\n';
|
||||
acd.fillins[i]=ptr-1;
|
||||
"$$GREEN$$'%d'$$FG$$ %-23ts",i,ptr;
|
||||
"$$GREEN$$'%d'$$FG$$ $$BLACK$$%-23ts$$FG$$",i,ptr;
|
||||
ptr+=StrLen(ptr)+3;
|
||||
}
|
||||
acd.num_fillins=i;
|
||||
|
@ -89,6 +89,17 @@ U0 ACPutChoices(CDoc *focus_l,CDocEntry *doc_e,CTask *focus_task,
|
|||
F64 timeout_time=tS+0.5;
|
||||
CHashSrcSym *tmph;
|
||||
|
||||
if (LBtr(&ac.flags, ACf_LAST_WAS_KEYMAP))
|
||||
{
|
||||
ac.col = ac.old_col;
|
||||
ac.row = ac.old_row;
|
||||
}
|
||||
else
|
||||
{
|
||||
ac.col = Fs->win_left;
|
||||
ac.row = Fs->win_top;
|
||||
}
|
||||
|
||||
src=DocScanLine(focus_l,doc_e,&data_col);
|
||||
DocUnlock(focus_l);
|
||||
i=StrLen(src);
|
||||
|
@ -115,20 +126,21 @@ U0 ACPutChoices(CDoc *focus_l,CDocEntry *doc_e,CTask *focus_task,
|
|||
tmpw=tmpw->next;
|
||||
}
|
||||
}
|
||||
ACDocReset(51,13);
|
||||
ACDocReset(ac.col, ac.row);
|
||||
if (ac.cur_word && *ac.cur_word) {
|
||||
"$$PURPLE$$Word:%s$$FG$$\n",ac.cur_word;
|
||||
for (i=0;i<ac.num_fillins;i++) {
|
||||
st=ac.fillin_matches[i]->str;
|
||||
"$$GREEN$$F%02d$$FG$$ ",i+1;
|
||||
"$$GREEN$$F%02d$$FG$$$$HL$$ ",i+1;
|
||||
if (TaskValidate(focus_task) &&
|
||||
(tmph=HashFind(st,focus_task->hash_table,HTG_SRC_SYM)) &&
|
||||
tmph->src_link) {
|
||||
if (tmph->type&HTF_PUBLIC)
|
||||
"$$RED$$";
|
||||
"$$TX+UL+L+PU,\"%$$Q\",A=\"%s\"$$$$FG$$\n",st,tmph->src_link;
|
||||
"$$IV$$";
|
||||
"$$TX+UL+L+PU,\"%$$Q\",A=\"%s\"$$$$IV,0$$\n",st,tmph->src_link;
|
||||
} else
|
||||
"%s\n",st;
|
||||
"$$HL,0$$";
|
||||
}
|
||||
if (acd.has_words)
|
||||
ACDDictWordsAdd(ac.cur_word);
|
||||
|
@ -173,8 +185,11 @@ U0 ACTaskCtrl(I64 sc,I64 last_sc,
|
|||
WinZBufUpdate;
|
||||
} else {
|
||||
if (sc!=last_sc) {
|
||||
Bts(&ac.flags, ACf_LAST_WAS_KEYMAP);
|
||||
ac.old_col = ac.col;
|
||||
ac.old_row = ac.row;
|
||||
if (sc&SCF_ALT) {
|
||||
ACDocReset(27,3);
|
||||
ACDocReset(TEXT_COLS-50,3);
|
||||
if (TaskValidate(original_focus_task) &&
|
||||
!Bt(&original_focus_task->win_inhibit,WIf_SELF_KEY_DESC))
|
||||
KeyMapFamily(original_focus_task,0,
|
||||
|
@ -183,7 +198,7 @@ U0 ACTaskCtrl(I64 sc,I64 last_sc,
|
|||
ToBool(!(sc&SCF_SHIFT)),ToBool(sc&SCF_SHIFT));
|
||||
} else if (TaskValidate(original_focus_task) &&
|
||||
!Bt(&original_focus_task->win_inhibit,WIf_SELF_KEY_DESC)) {
|
||||
ACDocReset(27,3);
|
||||
ACDocReset(TEXT_COLS-50,3);
|
||||
KeyMapFamily(original_focus_task,SCF_CTRL,
|
||||
ToBool(!(sc&SCF_SHIFT)),ToBool(sc&SCF_SHIFT));
|
||||
}
|
||||
|
@ -196,9 +211,12 @@ U0 ACTaskCtrl(I64 sc,I64 last_sc,
|
|||
U0 ACTaskAlt(I64 sc,I64 last_sc,
|
||||
CTask *,CTask *original_focus_task)
|
||||
{
|
||||
if (sc!=last_sc && TaskValidate(original_focus_task) &&
|
||||
!Bt(&original_focus_task->win_inhibit,WIf_SELF_KEY_DESC)) {
|
||||
ACDocReset(27,3);
|
||||
if (sc!=last_sc && TaskValidate(original_focus_task) &&!Bt(&original_focus_task->win_inhibit,WIf_SELF_KEY_DESC)) {
|
||||
Bts(&ac.flags, ACf_LAST_WAS_KEYMAP);
|
||||
ac.old_col = ac.col;
|
||||
ac.old_row = ac.row;
|
||||
|
||||
ACDocReset(TEXT_COLS-50,3);
|
||||
KeyMapFamily(original_focus_task,SCF_ALT,
|
||||
ToBool(!(sc&SCF_SHIFT)),ToBool(sc&SCF_SHIFT));
|
||||
}
|
||||
|
@ -209,6 +227,7 @@ U0 ACTaskAlt(I64 sc,I64 last_sc,
|
|||
U0 ACTaskEndCB()
|
||||
{
|
||||
ac.task=NULL;
|
||||
RegWrite("AutoComplete", "ac.col=%d;ac.row=%d;",ac.col, ac.row);
|
||||
Exit;
|
||||
}
|
||||
|
||||
|
@ -220,7 +239,7 @@ U0 ACTask(I64)
|
|||
Fs->task_end_cb=&ACTaskEndCB;
|
||||
DocTermNew;
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
WinHorz(51,Fs->win_right);
|
||||
ACDocReset(ac.col,ac.row);
|
||||
LBts(&Fs->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
Fs->win_inhibit=WIG_NO_FOCUS_TASK_DEFAULT;
|
||||
Free(ac.cur_word);
|
||||
|
@ -276,7 +295,6 @@ public Bool AutoComplete(Bool val=OFF)
|
|||
if (Bt(&sys_run_level,RLf_AUTO_COMPLETE))
|
||||
old_val=TRUE;
|
||||
Kill(ac.task);
|
||||
DeathWait(&ac.task);
|
||||
}
|
||||
}
|
||||
return old_val;
|
||||
|
|
|
@ -212,6 +212,8 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case SC_F11:
|
||||
case SC_F12:
|
||||
case SC_F1...SC_F10:
|
||||
if (sc&SCF_CTRL) {
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
|
@ -221,11 +223,25 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
|||
KeyDescSet("Edit/Autocomplete Sym");
|
||||
} else {
|
||||
DocUnlock(doc);
|
||||
if (AutoComplete(ON)) {
|
||||
if (AutoComplete(ON))
|
||||
{
|
||||
if (sc&SCF_SHIFT)
|
||||
ACMan(sc.u8[0]-SC_F1+1,Fs);
|
||||
else
|
||||
ACFillIn(sc.u8[0]-SC_F1+1);
|
||||
{
|
||||
if (sc.u8[0] == SC_F11)
|
||||
ACMan(11, Fs);
|
||||
else if(sc.u8[0] == SC_F12)
|
||||
ACMan(12, Fs);
|
||||
else
|
||||
ACMan(sc.u8[0]-SC_F1 + 1, Fs);
|
||||
}
|
||||
else {
|
||||
if (sc.u8[0] == SC_F11)
|
||||
ACFillIn(11);
|
||||
else if(sc.u8[0] == SC_F12)
|
||||
ACFillIn(12);
|
||||
else
|
||||
ACFillIn(sc.u8[0] - SC_F1 + 1);
|
||||
}
|
||||
}
|
||||
DocLock(doc);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue