Пример #1
0
static string process_input(string str){
    int x;

    if( (x = query_ed_mode()) == -1 ) return str;
    if( str && str[0..0] == "!" && strlen(str) > 1 ) return str[1..];
    if( !x ){
        str = ed_cmd(str);
        message("editor", str, this_object());
        if( query_ed_mode() == -1 ){
            if( functionp(EditCallback) ) evaluate(EditCallback);
            EditCallback = 0;
            return "";
        }
        return "";
    }
    else str = ed_cmd(str);
    message("editor", str, this_object());
    return "";
}
Пример #2
0
void init_edit(HWND hwnd) {
    struct strl *e;
    int n = 0;

    makefonts();

    e = editfiles;
    if (e)
    {
        do {
            char buff[MAX_PATH];
            int line_nr;
            getfile(buff, e->str, &line_nr);

            if (n == 0)
            {
                if (0 == set_currentdir(buff))
                    GetCurrentDirectory(256, currentdir);
                //dbg_printf("currentdir <%s> <%s>", currentdir, buff);
            }

            if (LoadFile(buff))
            {
                ed_cmd(EK_INIT, 0, 0, 0);
                if (line_nr) {
                    ed_cmd(EK_GOTOLINE,line_nr-1);
                    //ed_cmd(EK_MARK,lpos,imin(lpos+1,nextline(lpos,1)));
                }
            }
            e=e->next;
            ++n;
        } while (e);
        edp = ed0;
    }

    SetCurrentDirectory(strcpy(projectdir, currentdir));

    settitle();
}
Пример #3
0
void hscroll(DWORD wP) {
    int n,k,d;
    if (edp==NULL) return;
    switch (LOWORD(wP)) {
    case SB_LINELEFT:  n=-1; goto h1;
    case SB_LINERIGHT: n=1;  goto h1;
    case SB_PAGELEFT:  n=-8; goto h1;
    case SB_PAGERIGHT: n=8;  goto h1;
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        if (0 == (d=SB_DIV-sbx)) return;
        k=HIWORD(wP); n=((lmax-pgx)*k+d-1)/d-clft;
    h1:
        clft=imax(0,clft+n);
        curx=iminmax(curx,clft,pgx+clft);
        upd=1;
        ed_cmd(EK_SETVAR);
    }
}
Пример #4
0
void vscroll(DWORD wP) {
    int n,k,v,d,p;
    if (edp==NULL) return;
    p=4; v=0; if (winflg&1) v=pgy+1;
    switch (LOWORD(wP)) {
    case SB_LINEUP:      n=-1; goto s1;
    case SB_LINEDOWN:    n=1;  goto s1;
    case SB_PAGEUP:      n=-p; goto s1;
    case SB_PAGEDOWN:    n=p;  goto s1;
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        if (0==(d=SB_DIV-sby)) return;
        k=HIWORD(wP); n=((tlin-v)*k+d-1)/d-plin;
    s1:
        n=imin(n,tlin-plin-v);
        movpage(n);
        cury=iminmax(cury-n,0,pgy);
        ed_cmd(EK_SETVAR);
    }
}
Пример #5
0
varargs void eventEdit(string file, function callback){
    EditCallback = callback;
#ifdef __DSLIB__
    if(this_object()->GetCharmode()){
        this_object()->erase_prompt();
        this_object()->CancelCharmode();
        this_object()->SetProperty("was_charmode", 1);
    }
    else this_object()->CancelCharmode();
#endif
#if efun_defined(remove_get_char)
    //remove_get_char(this_object());
#endif
#if efun_defined(remove_charmode)
    //remove_charmode(this_object());
#endif
    //this_object()->SetNoEcho(0);
    ed_start(file, !creatorp());
    if( !creatorp() || file_size(file) < 1 ) ed_cmd("$a");
}
Пример #6
0
/*---------------------------------------------------------------*/
void do_mouse(HWND hwnd, DWORD wParam, DWORD lParam, int msg) {

    int o,x,y,n,i;
    static int mox,moy;
    static char mf2;
    static char lf2;

#ifdef NOCAPT
    static char wmf;
    static int  mux,muy;
#endif

    switch (msg) {
    case WM_MOUSEMOVE: //move
        if ((wParam & MK_RBUTTON)!=0) {
#ifdef NOCAPT
            mox=(short)LOWORD(lParam);
            moy=(short)HIWORD(lParam);
            if (wmf==0) {
                wmf=1,mux=mox,muy=moy;
                return;
            }
            MoveWindow(hwnd,wx0+mox-mux,wy0+moy-muy,wxl,wyl,TRUE);
#endif
            return;
        }

        if (clickflag) return;

        if ((wParam & MK_LBUTTON)==0 || edp==NULL) {
            mox=(short)LOWORD(lParam);
            moy=(short)HIWORD(lParam);
            getmouxy(mox,moy,&x,&y);
            if (edp==NULL) i=1;
            else i=inmark(x+clft,y);
            SetCursor(i?pointC:hCurs);
            return;
        }

        if (lf2==0) return;
#ifndef MV_DandD
mm3:
#endif
        if (drag) {
            setdragc(2+(0!=(GetAsyncKeyState(VK_CONTROL)&0x8000)));
        }
        n=((wParam & MK_SHIFT)!=0 || 0==moumrk);
        if (n==0) { mf2=0; goto mm1; }
        if (mf2) goto mm1;
        mf2=1;
        goto mm2;



    case WM_LBUTTONDBLCLK:
        lf2=0;
        if (edp) {
            o=getkword(fpos, tmpbuff);
            if (tmpbuff[0]) {
                ed_cmd(EK_MARK,o, o+strlen(tmpbuff));
                return;
            }
        }
        goto drag_cancel;

    case WM_LBUTTONDOWN:
        lf2=1;
        resetmsg(hwnd);
        if (clickflag && --clickflag) return;

//#ifndef MV_DandD
        SetCapture(hwnd);
//#endif
        n=2;
mm1:
        mox=(short)LOWORD(lParam);
        moy=(short)HIWORD(lParam);
mm2:
        if (edp==NULL) return;

        o=getmoupos(mox,moy);

        if (o) {
            settimer(hwnd,o,SCROLL_INTERVAL);
            return;
        }

        ed_cmd(EK_SETVAR);
        getmouxy(mox,moy,&x,&y);

        if (n==2 && inmark(x+clft,y)) {
#ifndef MV_DandD
            drag=1;
            goto mm3;
#else
            char *get_block(void);
            char *get_vblock(void);
            char *p,*q; int n;
            p=vmark ? get_vblock() : get_block();
            if (p!=NULL) {
                q = m_alloc(entab (NULL, p, n=strlen(p), tabs)+1);
                q[entab (q, p, n, tabs)]=0;
                i=do_drag(q),
                m_free(q);
                m_free(p);
                if (i==1) ed_cmd(KEY_DELETE);
            }
            return;
#endif
        }

        if (drag && linmrk && vmark==0 && fixline(*ma) != fixline(*me))
            curx=0;

        if (drag && n!=2 && dragmove<2) dragmove++;

        if (n==2)    unmark();
        if (drag==0) setvmark(n==1);
        return;


    case WM_LBUTTONUP:
        lf2=0;
        if (dragmove==2) {
            ed_cmd(drag==3 ? EK_DRAG_COPY : EK_DRAG_MOVE);
            SetCursor(hCurs);
        } else
        if (drag) unmark();
drag_cancel:
        mf2=drag=dragmove=0;
        settimer(hwnd,0,0);

#ifndef MV_DandD
        ReleaseCapture();
#endif
        return;


    case WM_RBUTTONDOWN:
#if 0
        if (NULL!=ShortCut) {
        POINT pt;
        GetCursorPos(&pt);
        TrackPopupMenu(ShortCut,TPM_CENTERALIGN|TPM_RIGHTBUTTON,
                pt.x, pt.y ,0,hwnd,NULL
                );
        return;
        }
#endif

#ifdef NOCAPT
        SetCapture(hwnd);
        mox=(short)LOWORD(lParam);
        moy=(short)HIWORD(lParam);
        wmf=1,mux=mox,muy=moy;
#endif
        return;

    case WM_RBUTTONUP:
#ifdef NOCAPT
        wmf=0;
        if (NULL==ShortCut)
            ReleaseCapture();
#endif
        return;
    }
}
Пример #7
0
LRESULT CALLBACK EditProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){

    char bstr[MAX_PATH];
    char *p,c;
    int i,k,n,o,r,f;
    POINT pt;
    struct edvars *ev;

    r = 0;

    //if (domove(GetParent(hwnd),message,wParam,lParam)) return 0;

    switch (message) {
    case WM_COPYDATA:
        if (0x4F4E4242 == ((PCOPYDATASTRUCT)lParam)->dwData)
        {
            char buff[MAX_PATH];
            int line_nr;
            const char *file = (const char*)((PCOPYDATASTRUCT)lParam)->lpData;
            getfile(buff, file, &line_nr);
            set_currentdir(buff);
            LoadFile(buff);
            if (line_nr) {
                ed_cmd(EK_GOTOLINE,line_nr-1);
                //ed_cmd(EK_MARK,lpos,imin(lpos+1,nextline(lpos,1)));
            }

            r = TRUE;
            goto p0r;
        }

        return bbn_receive_data(hwnd, lParam);

    default:
        if (bb_broadcast_msg == message && message)
        {
            if (bb_register(hwnd) && bb_getstyle(hwnd))
               goto reconfig1;
            return 0;
        }
        break;

    case BB_RECONFIGURE:
        if (bb_getstyle(hwnd))
            goto reconfig1;
        return 0;


    reconfig1:
        bb_close_dlg();
        makedlgfont();

    reconfig:
        zy0 = title_h + FRM-1;
        setsize(hwnd);
        new_back();
        InvalidateRect(hwnd, NULL, FALSE);
        return 0;

    case BB_SETSTYLESTRUCT:
    {
        StyleStruct *d = (StyleStruct *)wParam;
        StyleStruct *s = (StyleStruct *)lParam;
        memset(d, 0, sizeof *d);
        memcpy(d, s, sizeof *d);
        break;
    }

    case BB_SETSTYLE:
    {
        char *d = (char *)wParam;
        char *s = (char *)lParam;
        strcpy(d, s);
        break;
    }

    case WM_CREATE:
        zy0 = title_h + FRM-1;
        setsize(ewnd=hwnd);
        dragC  = LoadCursor(hInst,MAKEINTRESOURCE(101));
        dragCp = LoadCursor(hInst,MAKEINTRESOURCE(102));
        pointC = hCurs = LoadCursor(NULL,IDC_ARROW);
        init_edit(hwnd);
        DragAcceptFiles(hwnd,TRUE);
        if (false == bb_register(hwnd) || false == bb_getstyle(hwnd))
            readstyle(defstyle);
        goto reconfig1;


    case WM_DROPFILES: {
        POINT pt;
        HDROP hDrop = (HDROP)wParam; int n,f;
        ev=edp;
        f=0;

        GetCursorPos(&pt);
        if (GetAsyncKeyState(VK_CONTROL)<0) f=1;
        if (GetAsyncKeyState(VK_SHIFT)<0)   f=2;
        if (f) ScreenToClient(hwnd,&pt);

        for (i=-1, k=0; i<k; i++)
        {
            n=DragQueryFile (hDrop, i, p=bstr, 255);
            if (i<0)
            {
                k=n;
            }
            else
            if (f==0)
            {
                LoadFile(p);
            }
            else
            if (f==2)
            {
                if (readstyle(p))
                {
                    CopyFile(p, defstyle, FALSE);
                }
                break;
            }
            else
            {
                if (i == 0 && -1 == getmoupos(pt.x ,pt.y))
                    break;

                ed_cmd(EK_SETVAR);
                ed_cmd(EK_INSERT, p);
                ed_cmd(KEY_RET);
            }
        }
        DragFinish(hDrop);
        SetForegroundWindow(hwnd);
        if (f==0) goto showf;
        if (f==2) goto reconfig1;
        goto p0;
        }

    case WM_QUERYENDSESSION:
        return (1 == QueryDiscard(hwnd,1));

    case WM_ENDSESSION:
    {
        //void savecfg(void); savecfg();
        return 0;
    }

    case WM_DESTROY:
        exit_edit();
        DragAcceptFiles(hwnd,FALSE);
        bb_unregister(hwnd);
        PostQuitMessage(0);
        return 0 ;


    case WM_ACTIVATE:
        i=LOWORD(wParam);
        if (i==WA_ACTIVE)
            clickflag=0;

        return 0;

    case WM_ACTIVATEAPP:
        if (wParam) {
            clickflag=2;
        }
        return 0;

    case WM_LBUTTONDOWN:
    case WM_RBUTTONDOWN:
        if (alt_f) alt_f=2;

    case WM_MOUSEMOVE:
#if 0
    {
        static int wm;
        i = (short)HIWORD(lParam)/2;
        n = wm;
        wm = i;
        wParam = MAKELPARAM(0,(n-i)*30);
        goto mwhl;

    }
#endif
    case WM_LBUTTONDBLCLK:
    case WM_LBUTTONUP:
    case WM_RBUTTONUP:
    case WM_MBUTTONUP:
    case WM_MBUTTONDOWN:

        if (drag==0 && domove (hwnd, message, wParam, lParam))
            return 0;

        do_mouse(hwnd, wParam, lParam, message);

        if (message==WM_MOUSEMOVE && 0==(wParam & (MK_LBUTTON | MK_RBUTTON)))
            return 0;

        goto p0;

    case WM_TIMER:

        if (wParam==2) {
            resetmsg(hwnd);
            goto p0;
        }

        if (wParam==4) {
            mousewheelaccu=0;
        t0:
            KillTimer(hwnd, wParam);
            return 0;
        }

        GetCursorPos(&pt);
        ScreenToClient(hwnd,&pt);
        o=getmoupos(pt.x ,pt.y);
        if (o!=tcmd) {
            settimer(hwnd, o, SCROLL_INTERVAL);
            return 0;
        }

        if (tcmd==0) goto t0;
        c=ltup; ltup=0;
        ed_cmd(tcmd);
        ed_cmd(tcmd);
        upd=1;
        ltup=c;
        k=GetAsyncKeyState(VK_SHIFT)&0x8000;
        domarking(k!=0 || (0==moumrk && 0==drag));
        goto p0;


    case WM_SIZE:
        if (SIZE_MINIMIZED == wParam)
            return 0;

        if (edp) upd=1;
        ed_cmd(EK_SIZE);
        new_back();

    case WM_MOVE:
        setsize(hwnd);
        goto p0;

/*
   case WM_WINDOWPOSCHANGED:
        ewx0 = ((LPWINDOWPOS) lParam)->x;
        ewy0 = ((LPWINDOWPOS) lParam)->y;
        ewxl = ((LPWINDOWPOS) lParam)->cx;
        ewyl = ((LPWINDOWPOS) lParam)->cy;
        cfg_f |= 1;
        break; //process wm_move/wm_size

    case WM_WINDOWPOSCHANGING:
        SnapWindowToEdge((WINDOWPOS*)lParam, 10, 0);
        setsize(hwnd);
        return 0;
*/

    case WM_VSCROLL:
        vscroll(wParam);
        goto p0;

    case WM_HSCROLL:
        hscroll(wParam);
        goto p0;

    case WM_SETFOCUS:
        k_alt = 0>GetAsyncKeyState(VK_MENU);
        k_shft= 0>GetAsyncKeyState(VK_SHIFT);
        k_ctrl= 0>GetAsyncKeyState(VK_CONTROL);
        CreateCaret(hwnd,NULL,My_CaretSize,zy);
        caret=1;
        checkftime(hwnd);
        goto f1;

    case WM_KILLFOCUS:
        DestroyCaret();
        caret=0;
    f1:
        if (edp) upd=1;
        goto p0;

p0:
        r=0;
p0r:
        set_update(hwnd);
        return r;


    case WM_ERASEBKGND:
        return 1;

    case WM_PAINT:
        paint_window (hwnd);
        return 0;


    case WM_COMMAND:
        switch (LOWORD(wParam)) {

        case CMD_HELP:
#if 0
            bbnote_help();
            return 0;
#else
            if (fileexist(set_my_path(bstr, "bbnote.txt")))
                LoadFile(bstr);
            else if (fileexist(set_my_path(bstr, "docs/bbnote.txt")))
                LoadFile(bstr);
            goto p0;
#endif


        case CMD_EXIT:
            goto quit;

        case CMD_MENU_2:
        filemenu:
            if (ed0)
            {
                struct edvars *e = ed0;
                struct strl   *s = NULL;
                while (e)
                {
                    char temp[MAX_PATH];
                    sprintf(temp, "&%s", fname(e->sfilename));
                    appendstr(&s, temp);
                    e = e->next;
                }
                bb_file_menu (hwnd, lParam, s);
            }
            return 0;

        case CMD_MENU_1:
            bb_menu(hwnd, lParam);
            return 0;

        case CMD_COLOR:
            goto reconfig;

        case CMD_UPD:
            settitle();
            if (edp) upd=1;
            goto p0;


        case CMD_ZOOM:
    zoom:
            ShowWindow(hwnd, IsZoomed(hwnd) ? SW_SHOWNORMAL : SW_MAXIMIZE);
            return 0;

        case CMD_SEARCH:
        search:
            if (edp) bb_search_dialog(hwnd);
            return 0;

        case CMD_CLOSE:
        closefile:
            if (edp)
            {
                if (1 != QueryDiscard_1(hwnd, 1)) goto p0;
                if (ed0->next==NULL)
                {
                    extern HWND mwnd;
                    SendMessage(mwnd, WM_KEYDOWN, VK_ESCAPE, 0);
                    //DestroyWindow(mwnd);
                }
                CloseFile();
            }
            goto p0;

        case CMD_OPEN:
        openfile:
            ev=edp;
            DoFileOpenSave(hwnd, 0);
showf:
            if (ev==NULL || ev->next)
            {
                edp = ev ? ev->next : ed0;
                settitle();
            }
            goto p0;

        case CMD_RELOAD:
        reload:
            if (edp) f_reload(1);
            goto p0;


        case CMD_LIST:
            lParam = 2;
            goto filemenu;

        case CMD_NEW:
        newfile:
            NewFile();
            goto p0;

        case CMD_SAVE:
        savefile:
            if (edp) DoFileOpenSave(hwnd, 2);
            goto p0;

        case CMD_SAVEAS:
            if (edp!=NULL) DoFileOpenSave(hwnd, 1);
            break;

        case CMD_SAVEALL:
        //saveall:
            return QueryDiscard(hwnd, 0);

        case CMD_UNDO:
            ed_cmd(KEY_C_Z);
            goto p0;

        case CMD_REDO:
            ed_cmd(KEY_CS_Z);
            goto p0;

        case CMD_ABOUT:
            oyncan_msgbox(
              VERSION_STRING
              "\n"
              "\nediting with style"
              "\n04/2003 by grischka"
              "\n"
              "\[email protected]"
              , NULL, 1);
              return 0;


        case CMD_OPTIONS:
            goto config;

        case CMD_INFO:
            resetmsg(hwnd);
            p=(char*)lParam;
            if (p[0]==1) p++;
            else infoflg=1,infotimer=SetTimer(hwnd,2,666,NULL);
            strcpy(infomsg,p);
            if (edp) upd=1;
            goto p0;


        case CMD_FILECHG:
        {
            struct edvars *p=edp;
            edp=(struct edvars*)lParam;
            settitle();
            set_update(hwnd);
            f_reload(0);
            edp=p;
            settitle();
            goto p0;
        }

        default:
            i = LOWORD(wParam);
            if (i>=CMD_FILE && i< CMD_FILE_M)
            {
                struct edvars *p=ed0;
                i-=CMD_FILE;
                for (;i && p!=NULL; p=p->next,i--);
                if (p) {
                    //edp = p; settitle();
                    insfile(p);
                    goto p0;
                }
                return 0;
            }
            break;

        }
        break;

quit:
    if (1 == QueryDiscard(hwnd, 1))
        DestroyWindow(hwnd);
    return 0;

    case WM_SYSKEYDOWN:
        f=3; goto k1;

    case WM_SYSKEYUP:
        f=2; goto k1;

    case WM_KEYUP:
        if (wParam==VK_CONTROL && drag==3)  setdragc(2);
        f=0; goto k1;

    case WM_KEYDOWN:
        if (wParam==VK_CONTROL && drag==2)  setdragc(3);
        if (wParam==VK_SCROLL) { scroll_lock^=1; goto p0; }

        f=1; k1:

        n=LOWORD(wParam);

#if 0
        sprintf(bstr,"key %d  stat %d",n,f);
        if (n!=VK_MENU) MessageBox(NULL, bstr, "", MB_OK|MB_TOPMOST|MB_SETFOREGROUND);
#endif
        n=trans_keys(n, f);
        //if (0==n) goto p0;
        if (0==n) return 0;

        if (n>=2110 && n<=2117) {
        vmark=k_alt!=0;
        domarking(1);
        ed_cmd(n-100);
        domarking(1);
        goto p0;
        }

        switch (n) {

        case KEY_F8: return 0;
        case KEY_A_RIGHT:
        case KEY_F6:   nextfile(); goto p0;
        case KEY_A_LEFT:
        case KEY_C_F6: prevfile(); goto p0;

        case KEY_F10:  goto zoom;
        case KEY_F3:
        case KEY_C_F:  goto search;
        case KEY_C_F4: goto closefile;
        case KEY_C_O:  goto openfile;
        //case KEY_A_F3: goto reload;
        case KEY_C_N:  goto newfile;
        case KEY_C_L:  lParam = 0; goto filemenu;

        case KEY_F4:
            QueryDiscard(hwnd, 0);
            bb_reconfig();
            return 0;

        case KEY_S_F4:
            if (IDOK == oyncan_msgbox("Do you want to write all files?", "", 1+8))
                QueryDiscard(hwnd, 4);
            return 0;


        case KEY_C_S:  goto savefile;
        case KEY_A_F4: goto quit;

        case KEY_A_F2:
config:
            n = tabs;
            bb_config_dialog(hwnd);
            if (n!=tabs) goto reload;
            return 0;

        case KEY_ESC:
            if (drag==0) goto quit;
            dragmove=0;
            do_mouse(hwnd, 0,0,WM_LBUTTONUP);
            goto p0;

        case KEY_UP:
        case KEY_DOWN:
            if (scroll_lock) n+=200;
            goto defkey;

        case KEY_LEFT:
        case KEY_RIGHT:
            if (scroll_lock) n=(n^1)+204;
            goto defkey;
        }

    defkey:
        domarking(0);
        ed_cmd(n);
        i=n;
        if (i!=KEY_C_A
         && i!=KEY_C_U
         && i!=KEY_C_7
         && i!=KEY_C_8
         && i!=KEY_C_9
         && i!=KEY_C_0
         && i!=KEY_TAB
         && i!=KEY_S_TAB
         )
            unmark();
        goto p0;


    case WM_MOUSEWHEEL:
        i = mousewheelaccu + mousewheelfac * (short)HIWORD(wParam);
        while (i < -300)
            ed_cmd(KEY_C_DOWN), i+=600;
        while (i >  300)
            ed_cmd(KEY_C_UP),   i-=600;

        mousewheelaccu=i;
        unmark();
        SetTimer(hwnd, 4, 200, NULL);
        goto p0;


    case WM_NCPAINT:
        return 0;


    case WM_CHAR:
        n = LOWORD(wParam);
        if (n<32||n==127) return 0;

        resetmsg(hwnd);
        ed_cmd(EK_CHAR, n);
        goto p0;



    case CMD_GOTOLINE:
        ed_cmd(EK_GOTOLINE,wParam-1);
        ed_cmd(EK_MARK,lpos,imin(lpos+1,nextline(lpos,1)));
        lmf=2;
        goto p0;

    case CMD_LOADFILE:
        r=LoadFile((char*)wParam);
        goto p0r;

    case CMD_NSEARCH:
        resetmsg(hwnd);
        if (wParam&8) {
            ed_cmd(EK_REPLACE,(char *)lParam);
            if (wParam&1)
               ed_cmd(EK_GOTO,fpos+strlen((char*)lParam));
            goto p0;
        }
        unmark();
        if (wParam!=0) {
            struct sea *s=(struct sea *)lParam;
            struct edvars *ev0;

            for (ev0=edp;;) {
                r=ed_search(s);
                if (r || 0==(s->sf&128)) break;
                s->sf &= ~4;
                if (s->sf & 1) {
                    if (edp->next==NULL) break;
                    nextfile();
                    s->from=0;
                    continue;
                }
                if (s->sf & 2) {
                    if (edp==ed0) break;
                    prevfile();
                    s->from=flen;
                    continue;
                }}
            if (r<=0) {
                edp=ev0;
                settitle();
            } else {
               ed_cmd(KEY_HOME);
               ed_cmd(EK_MARK,s->a,s->e);
               ed_cmd(EK_GOTO,s->a);
            }
        }
        goto p0r;

    }
    return DefWindowProc (hwnd, message, wParam, lParam) ;
}