예제 #1
0
 void CheckTxt(ssText t)
 {
     if (t == null)
     {
         throw new ssException("no current file");
     }
 }
예제 #2
0
 void CheckRange(ssText t, ssRange r)
 {
     if (!t.Contains(r))
     {
         throw new ssException("address range");
     }
 }
예제 #3
0
        //ssTrans seqRoot;

        public void InitAllSeqs()
        {
            for (ssText tt = txts; tt != null; tt = tt.Nxt)
            {
                tt.TLog.InitSeq();
            }
        }
예제 #4
0
 public void SyncFormToTextAll()
 {
     for (ssText t = txts; t != null; t = t.Nxt)
     {
         t.SyncFormToText();
     }
 }
예제 #5
0
 void DoTextMaint(ssText t)
 {
     if (t.DoMaint())
     {
         MsgLn("Maintenance done on '" + t.FileName() + "'");
     }
 }
예제 #6
0
        public void MoveCopy(char cmd, ssAddress dst)
        {
            dst.rng.l = dst.rng.r;
            if (txt == dst.txt && txt.dot.Overlaps(dst.rng))
            {
                throw new ssException("addresses overlap");
            }
            string  s    = txt.ToString();
            ssTrans t1   = new ssTrans(ssTrans.Type.insert, 0, dst.rng, s, null);
            ssText  txt1 = dst.txt;
            ssTrans t2   = null;
            ssText  txt2 = null;

            if (cmd == 'm')
            {
                t2         = new ssTrans(ssTrans.Type.delete, 0, txt.dot, null, null);
                txt2       = txt;
                t1.rng.len = s.Length;
                if (t2.rng.l < t1.rng.l)
                {
                    ssTrans x = t1;
                    t1 = t2;
                    t2 = x;
                    ssText txtx = txt1;
                    txt1 = txt2;
                    txt2 = txtx;
                }
            }
            txt1.TLog.PushTrans(t1);
            if (t2 != null)
            {
                txt2.TLog.PushTrans(t2);
            }
        }
예제 #7
0
 void CheckRange(ssText t, int i)
 {
     if (!t.Contains(i))
     {
         throw new ssException("address range");
     }
 }
예제 #8
0
파일: ssEd.cs 프로젝트: collumww/ssconV3
        public bool DeleteText(ssText dtxt, bool formsToo)
        {
            if (!dtxt.DoubleCheck())
            {
                Err("changed file \"" + dtxt.FileName() + "\"");
                return(false);
            }

            /*/win remove for non-Windowed version
             * if (formsToo) dtxt.DeleteAllForms();
             * // remove for non-Windowed version */
            ssText p = null, t = txts;

            while (t != null && t != dtxt)
            {
                p = t; t = t.Nxt;
            }
            if (t == null)
            {
                return(true);
            }
            if (p == null)
            {
                txts = t.Nxt;
            }
            else
            {
                p.Nxt = t.Nxt;
            }
            //ssTrans.VoidTrans(tlog.Ts, dtxt);
            //ssTrans.VoidTrans(seqRoot.nxt, dtxt);
            prvtxt = txt;
            txt    = null;
            return(true);
        }
예제 #9
0
 void ResetAffected()
 {
     for (ssText t = txts; t != null; t = t.Nxt)
     {
         t.cmdaffected = false;
         t.InvalidateMarks();
     }
 }
예제 #10
0
 void Commit()
 {
     for (ssText t = txts; t != null; t = t.Nxt)
     {
         if (!t.TLog.getnewtrans)
         {
             t.TLog.Commit();
         }
     }
 }
예제 #11
0
파일: ssEd.cs 프로젝트: collumww/ssV3
 public void NewTrans()
 {
     for (ssText t = txts; t != null; t = t.Nxt)
     {
         t.TLog.InitTrans();
     }
     one        = 1;
     zero       = 0;
     alphaUpper = 0;
     alphaLower = 0;
 }
예제 #12
0
파일: ssEd.cs 프로젝트: collumww/ssV3
        public void NewText()
        {
            ssText t = new ssText(this, "", null, NewName(), defs.encoding);

            AddText(t);
            //win Remove for non-windowed version
            t.AddForm(new ssForm(this, t));
            t.Frm.Show();
            // Remove for non-windowed version */
            MsgLn(t.MenuLine());
        }
예제 #13
0
파일: ssTransLog.cs 프로젝트: collumww/ssV3
 public ssTransLog(ssEd e, ssText t)
 {
     ts             = null;
     log            = true;
     ed             = e;
     txt            = t;
     seqRoot        = new ssTrans(ssTrans.Type.delete, 0, t.dot, null, null);
     adjEdge        = new ssRange(0, 0);
     getnewtrans    = true;
     canconsolidate = true;
     savepoint      = 0;
     olddot         = new ssRange();
     rex            = new Regex(@"[\w\s]");
 }
예제 #14
0
 void UpdateAffected()
 {
     for (ssText t = txts; t != null; t = t.Nxt)
     {
         if (t.cmdaffected)
         {
             t.InvalidateMarksAndChange(-1);
             ////win Remove for non-windowed version
             //for (ssForm f = t.Frms; f != null; f = f.Nxt) {
             //    f.AdjOrigin();
             //    }
             //// Remove for non-windowed version */
             DoTextMaint(t);
         }
     }
 }
예제 #15
0
파일: ssEd.cs 프로젝트: collumww/ssconV3
        public bool DeleteAllTexts()
        {
            bool all = true;

            for (ssText t = Txts; t != null; t = t.Nxt)
            {
                /*/win remove for non-windowed version
                 * if (t != Log)
                 * // remove for non-windowed version */
                all &= t.DoubleCheck();
            }
            if (!all)
            {
                Err("changed file(s)");
            }
            return(all);
        }
예제 #16
0
파일: ssEd.cs 프로젝트: collumww/ssconV3
        public void NextText()
        {
            if (txts == null || txt == null)
            {
                return;
            }
            ssText t = txt.Nxt;

            if (t == null)
            {
                t = txts;
            }

            /*/win remove for non-windowed version
             * if (t.Frm == null)
             *  // remove for non-windowed version */
            MsgLn(t.MenuLine());
            WakeUpText(t);
        }
예제 #17
0
파일: ssEd.cs 프로젝트: collumww/ssV3
 public void ProcessArgs()
 {
     for (int i = startWith; i < args.Length; i++)
     {
         try {
             string arg = args[i];
             string pth = Path.GetDirectoryName(arg);
             if (pth == "")
             {
                 pth = ".";
             }
             string   fnm = Path.GetFileName(arg);
             string[] fs  = Directory.GetFiles(pth, fnm);
             if (fs.Length == 0)
             {
                 if (arg.IndexOf('*') == -1 && arg.IndexOf('?') == -1)
                 {
                     ssText t = new ssText(this, "", null, arg, defs.encoding);
                     AddText(t);
                     MsgLn("arg: could not find '" + arg + "', new file");
                 }
                 else
                 {
                     Err("arg: could not find '" + arg + "'");
                 }
             }
             else
             {
                 AddTexts(fs, false);
             }
         }
         catch (Exception ex) {
             Err("arg: " + ex.Message);
         }
     }
     //win Remove for non-windowed version
     if (txt != null)
     {
         txt.AddForm(new ssForm(this, txt));
         txt.Frm.Show();
     }
     // Remove for non-windowed version */
 }
예제 #18
0
파일: ssEd.cs 프로젝트: collumww/ssV3
 public void WakeUpText(ssText t)
 {
     if (t == null)
     {
         return;
     }
     prvtxt = txt;
     //win remove for non-windowed version
     if (t.Frm != null)
     {
         t.Activate();
     }
     else
     // remove for non-windowed version */
     {
         txt = t;
         //win remove for non-windowed version
         log.Activate();
         // remove for non-windowed version */
     }
 }
예제 #19
0
파일: ssEd.cs 프로젝트: collumww/ssconV3
        public void WakeUpText(ssText t)
        {
            if (t == null)
            {
                return;
            }
            prvtxt = txt;

            /*/win remove for non-windowed version
             * if (t.Frm != null) {
             *  t.Activate();
             *  }
             * else
             * // remove for non-windowed version */
            {
                txt = t;

                /*/win remove for non-windowed version
                 * log.Activate();
                 * // remove for non-windowed version */
            }
        }
예제 #20
0
파일: ssEd.cs 프로젝트: collumww/ssV3
 public void AddTexts(string[] fs, bool withforms)
 {
     foreach (string f in fs)
     {
         Encoding enc = defs.encoding;
         string   dta = WinRead(f, ref enc);
         if (dta == null)
         {
             dta = "";
         }
         ssText t = new ssText(this, dta, null, f, enc);
         AddText(t);  // t becomes the current text, that is, txt.
         if (withforms)
         {
             txt = t;
             //win Remove for non-windowed version
             t.AddForm(new ssForm(this, t));
             t.Frm.Show();
             // Remove for non-windowed version */
         }
         MsgLn(t.MenuLine());
     }
 }
예제 #21
0
        TList FindText(bool rgx, string pat, bool matching, bool unique)
        {
            TList l  = new TList(null, new ssRange(), null);
            TList lt = l;

            if (pat == null)
            {
                return(new TList(txt, txt.dot, null));
            }
            for (ssText t = txts; t != null; t = t.Nxt)
            {
                bool m = rgx ? Regex.IsMatch(t.MenuLine(), pat, defs.senseCase ? RegexOptions.None : RegexOptions.IgnoreCase) : pat == t.FileName();
                if (matching && m || !matching && !m)
                {
                    lt.nxt = new TList(t, t.dot, null);
                    lt     = lt.nxt;
                }
            }
            if (unique && l.nxt != null && l.nxt.nxt != null)
            {
                throw new ssException("non-unique match for \"" + pat + "\"");
            }
            return(l.nxt);
        }
예제 #22
0
파일: ssEd.cs 프로젝트: collumww/ssV3
 public void AddText(ssText t)
 {
     t.Nxt  = txts;
     prvtxt = txt;
     txts   = txt = t;
 }
예제 #23
0
파일: ssFormMenu.cs 프로젝트: collumww/ssV3
        ContextMenu BuildMenu()
        {
            MenuItem    mich = null;
            ContextMenu m    = new ContextMenu();

            MenuItem mi = new MenuItem("All");

            mi.Click += new System.EventHandler(MenuSelectAll);
            m.MenuItems.Add(mi);
            m.MenuItems.Add("Cut", new System.EventHandler(MenuCut));
            m.MenuItems.Add("Snarf", new System.EventHandler(MenuSnarf));
            m.MenuItems.Add("Paste", new System.EventHandler(MenuPaste));
            m.MenuItems.Add("Undo", new System.EventHandler(MenuUndo));
            if (txt == ed.Log)
            {
                m.MenuItems.Add("Exec", new System.EventHandler(MenuExec));
            }
            m.MenuItems.Add("Case", new System.EventHandler(MenuToggleIgnoreCase)).Checked = ed.defs.senseCase;
            m.MenuItems.Add("Look", new System.EventHandler(MenuLook));
            m.MenuItems.Add("/" + Regex.Escape(ed.LastPat), new System.EventHandler(MenuSearch));

            mi          = new MenuItem("New");
            mi.BarBreak = true;
            mi.Click   += new System.EventHandler(MenuNew);
            m.MenuItems.Add(mi);
            m.MenuItems.Add("Open", new System.EventHandler(MenuOpen));
            m.MenuItems.Add("Close", new System.EventHandler(MenuClose));
            m.MenuItems.Add("Xerox", new System.EventHandler(MenuXerox));
            m.MenuItems.Add("Write", new System.EventHandler(MenuWrite));
            m.MenuItems.Add("Write As...", new System.EventHandler(MenuWriteAs));
            m.MenuItems.Add(ed.Log.FileName(), new System.EventHandler(ed.Log.MenuClick));
            ssText t = ed.Txts;

            while (t != null)
            {
                m.MenuItems.Add(t.MenuLine(), new System.EventHandler(t.MenuClick));
                t = t.Nxt;
            }

            mi          = new MenuItem("Fonts");
            mi.BarBreak = true;
            for (int i = 0; i < layout.fontCnt; i++)
            {
                mich = new MenuItem(layout.fontNm[i]);
                if (i == layout.fontNum)
                {
                    mich.Checked = true;
                    mich.Click  += new System.EventHandler(MenuSetFont);
                }
                else
                {
                    mich.Click += new System.EventHandler(MenuChooseFont);
                }
                mi.MenuItems.Add(mich);
            }
            m.MenuItems.Add(mi);

            m.MenuItems.Add("Wrap", new System.EventHandler(MenuToggleWrap)).Checked         = wrap;
            m.MenuItems.Add("Indent", new System.EventHandler(MenuToggleAutoIndent)).Checked = layout.autoIndent;
            m.MenuItems.Add("Prog", new System.EventHandler(MenuToggleProgramming)).Checked  = layout.programming;
            m.MenuItems.Add("Tabs", new System.EventHandler(MenuToggleExpTabs)).Checked      = !layout.expTabs;

            mi = new MenuItem("Events");
            evd.InitEventSetEnum();
            while (true)
            {
                string es = evd.NextEventSet();
                if (es == null)
                {
                    break;
                }
                mich         = new MenuItem(es);
                mich.Click  += new System.EventHandler(MenuSetEventSet);
                mich.Checked = es == layout.eventset;
                mi.MenuItems.Add(mich);
            }
            m.MenuItems.Add(mi);

            mi           = new MenuItem("Encoding");
            mich         = new MenuItem(Encoding.ASCII.EncodingName);
            mich.Checked = txt.encoding.EncodingName == mich.Text;
            mich.Click  += new System.EventHandler(MenuSetEncoding);
            mi.MenuItems.Add(mich);
            mich         = new MenuItem(Encoding.Unicode.EncodingName);
            mich.Checked = txt.encoding.EncodingName == mich.Text;
            mich.Click  += new System.EventHandler(MenuSetEncoding);
            mi.MenuItems.Add(mich);
            mich         = new MenuItem(Encoding.UTF32.EncodingName);
            mich.Checked = txt.encoding.EncodingName == mich.Text;
            mich.Click  += new System.EventHandler(MenuSetEncoding);
            mi.MenuItems.Add(mich);
            mich         = new MenuItem(Encoding.UTF8.EncodingName);
            mich.Checked = txt.encoding.EncodingName == mich.Text;
            mich.Click  += new System.EventHandler(MenuSetEncoding);
            mi.MenuItems.Add(mich);
            mich         = new MenuItem(Encoding.UTF7.EncodingName);
            mich.Checked = txt.encoding.EncodingName == mich.Text;
            mich.Click  += new System.EventHandler(MenuSetEncoding);
            mi.MenuItems.Add(mich);

            m.MenuItems.Add(mi);

            return(m);
        }
예제 #24
0
        ssAddress xAddr(ATree a)
        {
            if (a == null)
            {
                return(null);
            }
            ssText atxt = txt;

            if (a.fnm != null)
            {
                TList fs = FindText(true, a.fnm, true, true);
                if (fs == null)
                {
                    throw new ssException("file search");
                }
                atxt = fs.t;
            }
            switch (a.op)
            {
            case '#':
                CheckTxt(atxt);
                CheckRange(atxt, a.n);
                return(new ssAddress(a.n, a.n, atxt));

            case '0':
                CheckTxt(atxt);
                ssRange r = atxt.FindLine(0, a.n, 1);
                return(new ssAddress(r, atxt));

            case '.':
                CheckTxt(atxt);
                return(new ssAddress(atxt.dot, atxt));

            case '\'':
                CheckTxt(atxt);
                return(new ssAddress(atxt.mark, atxt));

            case '$':
                CheckTxt(atxt);
                return(new ssAddress(atxt.Length, atxt.Length, atxt));

            case '/':
                CheckTxt(atxt);
                return(Search(new ssAddress(atxt.dot, atxt), a.s, true));

            case '?':
                CheckTxt(atxt);
                return(Search(new ssAddress(atxt.dot, atxt), a.s, false));

            case ',':
            case ';':
                ssAddress al = xAddr(a.l);
                if (a.op == ';')
                {
                    txt     = al.txt;
                    txt.dot = al.rng;
                }
                ssAddress ar = xAddr(a.r);
                if (al.txt != ar.txt || ar.rng.l < al.rng.l)
                {
                    throw new ssException("addresses out of order");
                }
                al.rng.r = ar.rng.r;
                return(al);

            case '+':
            case '-':
                al = xAddr(a.l);
                al = xRelAddr(al, a.op, a.r);
                return(al);

            default:
                throw new ssException("address");
            }
        }
예제 #25
0
 ssText TxtIfNull(ssText t)
 {
     return(t == null ? txt : t);
 }
예제 #26
0
 ssText NullIfTxt(ssText t)
 {
     return(t == txt ? null : t);
 }
예제 #27
0
 public ssAddress(int l, int r, ssText t) {
     rng = new ssRange(l, r);
     txt = t;
     }
예제 #28
0
 public ssAddress(ssRange r, ssText t) {
     rng = r;
     txt = t;
     }
예제 #29
0
        void xCmd(CTree t)
        {
            ssRange levdot = new ssRange();

            if (t == null)
            {
                return;
            }
            ssAddress ad = xAddr(t.ad);
            ssAddress a  = xAddr(t.a);

            if (txt != null)
            {
                levdot = txt.dot;
            }
            if (a != null)
            {
                if (a.txt == null)
                {
                    a.txt = txt;
                }
                else
                {
                    prvtxt = txt;
                    txt    = a.txt;
                }
                txt.dot = a.rng;
            }
            switch (t.cmd)
            {
            case 'p':
                Print();
                break;

            case '=':
                MsgLn(AddressStr());
                break;

            case 'n':
                //MsgLn("working directory '" + Environment.CurrentDirectory + "'");
                for (ssText txt = txts; txt != null; txt = txt.Nxt)
                {
                    MsgLn(txt.MenuLine());
                }
                break;

            case 'a':
                if (swallowing)
                {
                    return;
                }
                txt.dot = txt.dot.To(txt.dot.r);
                if (t.subs != null)
                {
                    Insert(DoSubs("", t.subs));
                }
                else
                {
                    Insert(t.s);
                }
                break;

            case 'i':
                if (swallowing)
                {
                    return;
                }
                txt.dot = txt.dot.To(txt.dot.l);
                if (t.subs != null)
                {
                    Insert(DoSubs("", t.subs));
                }
                else
                {
                    Insert(t.s);
                }
                break;

            case 'c':
                if (swallowing)
                {
                    return;
                }
                if (t.subs != null)
                {
                    Change(DoSubs(txt.ToString(), t.subs));
                }
                else
                {
                    Change(t.s);
                }
                break;

            case 't':
            case 'm':
                MoveCopy(t.cmd, ad);
                break;

            case 'x':
                if (t.sub.nxt.cmd == noCmd)
                {
                    t.sub.nxt.cmd = 'p';
                }
                RegexOptions opts = RegexOptions.Multiline;
                if (!defs.senseCase)
                {
                    opts |= RegexOptions.IgnoreCase;
                }
                MatchCollection ms   = Regex.Matches(txt.ToString(), t.s, opts);
                ssRange         strt = txt.dot;
                foreach (Match m in ms)
                {
                    txt.dot.l   = strt.l + m.Index;
                    txt.dot.len = m.Length;
                    xCmd(t.sub);
                }
                break;

            case 'y':
                if (t.sub.nxt.cmd == noCmd)
                {
                    t.sub.nxt.cmd = 'p';
                }
                opts = RegexOptions.Multiline;
                if (!defs.senseCase)
                {
                    opts |= RegexOptions.IgnoreCase;
                }
                ms   = Regex.Matches(txt.ToString(), t.s, opts);
                strt = txt.dot;
                int l = strt.l;
                foreach (Match m in ms)
                {
                    txt.dot.l = l;
                    txt.dot.r = m.Index + strt.l;
                    xCmd(t.sub);
                    l = strt.l + m.Index + m.Length;
                }
                txt.dot.l = l;
                txt.dot.r = strt.r;
                xCmd(t.sub);
                break;

            case 'X':
            case 'Y':
                t.txts = FindText(true, t.s, t.cmd == 'X', false);
                if (t.txts == null)
                {
                    throw new ssException("file search");
                }
                for (TList tl = t.txts; tl != null; tl = tl.nxt)
                {
                    txt = tl.t;
                    xCmd(t.sub);
                }
                break;

            case 'g':
                opts = RegexOptions.Multiline;
                if (!defs.senseCase)
                {
                    opts |= RegexOptions.IgnoreCase;
                }
                if (Regex.IsMatch(txt.ToString(), t.s, opts))
                {
                    xCmd(t.sub);
                }
                break;

            case 'v':
                opts = RegexOptions.Multiline;
                if (!defs.senseCase)
                {
                    opts |= RegexOptions.IgnoreCase;
                }
                if (!Regex.IsMatch(txt.ToString(), t.s, opts))
                {
                    xCmd(t.sub);
                }
                break;

            case 's':
                opts = RegexOptions.Multiline;
                if (!defs.senseCase)
                {
                    opts |= RegexOptions.IgnoreCase;
                }
                ms   = Regex.Matches(txt.ToString(), t.s, opts);
                strt = txt.dot;
                int cnt = 0;
                foreach (Match m in ms)
                {
                    cnt++;
                    txt.dot.l   = strt.l + m.Index;
                    txt.dot.len = m.Length;
                    if (t.opt == 'g' || cnt == t.n)
                    {
                        if (t.subs != null)
                        {
                            Change(DoSubs(m.ToString(), t.subs));
                        }
                        else
                        {
                            Change(t.rep);
                        }
                    }
                }
                break;

            case 'D':
                TList ts = null;
                if (t.fs == null)
                {
                    if (txt == null)
                    {
                        throw new ssException("no current file");
                    }
                    else
                    {
                        DeleteText(txt, true);
                    }
                }
                else
                {
                    for (SList f = t.fs; f != null; f = f.nxt)
                    {
                        ts = FindText(true, f.s, true, false);
                        if (ts == null)
                        {
                            throw new ssException("warning: no such file '" + f.s + "'");
                        }
                        else
                        {
                            while (ts != null)
                            {
                                DeleteText(ts.t, true);
                                ts = ts.nxt;
                            }
                        }
                    }
                }
                break;

            case 'B':
                if (t.fs != null)
                {
                    AddTexts(SListToArray(t.fs), false);
                }
                else
                {
                    NewText();
                }
                break;

            case 'b':
                bool fnd = false;
                for (SList f = t.fs; f != null; f = f.nxt)
                {
                    ts = FindText(false, f.s, true, true);
                    if (ts != null)
                    {
                        fnd = true; txt = ts.t; break;
                    }
                }
                if (!fnd)
                {
                    throw new ssException("not in menu: \"" + SListJoin(t.fs) + "\"");
                }
                MsgLn(txt.MenuLine());
                WakeUpText(txt);
                break;

            case 'f':
                if (t.fs == null)
                {
                    Msg(txt.MenuLine());
                }
                else
                {
                    Rename(t.fs.s);
                }
                break;

            case 'e':
                if (txt == null)
                {
                    throw new ssException("no current file");
                }
                if (t.fs == null)
                {
                    t.s = txt.Nm;
                }
                else
                {
                    t.s = t.fs.s;
                }
                Encoding enc  = defs.encoding;
                string   fdta = WinRead(t.s, ref enc);
                if (fdta != null)
                {
                    txt.encoding = enc;
                    Rename(t.s);
                    txt.dot.l = 0;
                    txt.dot.r = txt.Length;
                    Change(fdta);
                    txt.dot.To(0);
                    PostEdDot();
                }
                break;

            case 'r':
                if (t.fs == null)
                {
                    t.s = txt.Nm;
                }
                else
                {
                    t.s = t.fs.s;
                }
                enc  = defs.encoding;
                fdta = WinRead(t.s, ref enc);
                if (fdta != null)
                {
                    txt.encoding = enc;
                    Change(fdta);
                    PostEdDot();
                }
                break;

            case 'w':
                if (txt == null)
                {
                    throw new ssException("no current file");
                }
                string s;
                if (t.fs == null)
                {
                    t.s = txt.Nm; s = txt.FileName();
                }
                else
                {
                    t.s = t.fs.s; s = t.fs.s;
                }
                ssRange r = txt.dot;
                if (t.a == null)
                {
                    r.l = 0; r.r = txt.Length;
                }
                string dta = txt.ToString(r.l, r.len);
                string lbl = File.Exists(t.s) ? "" : " (new file) ";
                if (WinWrite(t.s, dta, txt.encoding))
                {
                    if (dta.Length == txt.Length)
                    {
                        txt.TLog.RecordSave();
                    }
                    MsgLn(s + ":" + lbl + "#" + dta.Length.ToString());
                }
                PostEdDot();
                break;

            case 'd':
                Delete();
                break;

            case 'k':
                txt.mark = txt.dot;
                if (a == null)
                {
                    PostEdDot();
                }
                break;

            case 'h':
                ShowHex(txt.ToString());
                break;

            case '!':
                Msg(ShellCmd(t.s, null));
                break;

            case '<':
                Change(ShellCmd(t.s, null));
                break;

            case '>':
                Msg(ShellCmd(t.s, txt.ToString()));
                break;

            case '|':
                Change(ShellCmd(t.s, txt.ToString()));
                break;

            case 'q':
                /*/win Remove for non-windowed version
                 * log.Frm.UpdateDefs();
                 * // */
                defs.SaveDefs(false);
                if (DeleteAllTexts())
                {
                    Environment.Exit(0);
                }
                break;

            case 'Q':
                /*/win Remove for non-windowed version
                 * log.Frm.UpdateDefs();
                 * // */
                defs.SaveDefs(true);
                if (DeleteAllTexts())
                {
                    Environment.Exit(0);
                }
                break;

            case 'H':
                ShowHelp();
                break;

            case 'u':
                Undo(t.n);
                break;

            case '\0':      // end of text
                break;

            case listHead:       // head of sub lists
                break;

            case '{':
                xCmd(t.sub.nxt);      // The head of the sub tree is just another '{', so skip it.
                break;

            case noCmd:
                if (a == null)
                {
                    xNoCmd();
                }
                break;

            case 'T':
                /*/win  remove for non-windowed version
                 * txt.Frm.ChangeTab(t.n);
                 * //  remove for non-windowed version */
                break;

            case 'L':
                /*/win remove for non-windowed version
                *  txt.ChangeEoln(t.s);
                *  //  remove for non-windowed version */
                break;

            case 'F':
                /*/win remove for non-windowed version
                *  txt.FixLineLen(t.n);
                *  //  remove for non-windowed version */
                break;

            case 'C':
                switch (t.opt)
                {
                case 's':
                    defs.senseCase = true;
                    break;

                case 'i':
                    defs.senseCase = false;
                    break;

                default:
                    CultureInfo ci = Thread.CurrentThread.CurrentCulture;
                    TextInfo    ti = ci.TextInfo;
                    s = txt.ToString();
                    switch (t.opt)
                    {
                    case 'u':
                        Change(ti.ToUpper(s));
                        break;

                    case 't':
                        Change(ti.ToTitleCase(s));
                        break;

                    case 'l':
                        Change(ti.ToLower(s));
                        break;
                    }
                    break;
                }
                break;

            case 'E':
                if (txt == null)
                {
                    defs.encoding = decodeEncoding(t.opt);

                    /*/win remove for non-windowing version
                     * log.encoding = defs.encoding;
                     * //   remove for non-windowing version */
                }
                else
                {
                    txt.encoding = decodeEncoding(t.opt);
                }
                break;

            default:
                throw new ssException("unknown command");
            }
            if (a != null)
            {
                PostEdDot();
            }
            if (txt != null && t.nxt != null)
            {
                txt.dot = levdot;
            }
            xCmd(t.nxt);
        }
예제 #30
0
 public TList(ssText tt, ssRange r, TList nn)
 {
     t = tt; nxt = nn; dot = r;
 }