Exemple #1
0
        /// <summary>
        /// 引数と同じ内容で初期化する。lineの内容は破壊されない。
        /// 引数がnullのときは引数なしのコンストラクタと同じ結果になる。
        /// </summary>
        public void Load(GLine line, int cc)
        {
            if (line == null)            //これがnullになっているとしか思えないクラッシュレポートがあった。本来はないはずなんだが...
            {
                Clear(80);
                return;
            }

            Clear(line.Length);
            GWord w = line.FirstWord;

            Debug.Assert(line.Text.Length == _text.Length);
            Array.Copy(line.Text, 0, _text, 0, _text.Length);

            int n = 0;

            while (w != null)
            {
                int nextoffset = line.WordNextOffset(w);
                while (n < nextoffset)
                {
                    _decorations[n++] = w.Decoration;
                }
                w = w.Next;
            }

            _eolType = line.EOLType;
            ExpandBuffer(cc + 1);
            this.CaretColumn = cc;             //' 'で埋めることもあるのでプロパティセットを使う
        }
Exemple #2
0
        /// 引数と同じ内容で初期化する。lineの内容は破壊されない。
        /// 引数がnullのときは引数なしのコンストラクタと同じ結果になる。
        /// <summary>
        /// <ja>
        /// 引数と同じ内容で初期化します。
        /// </ja>
        /// <en>
        /// Initialize same as argument.
        /// </en>
        /// </summary>
        /// <param name="cc">
        /// <ja>
        /// 設定するキャレット位置
        /// </ja>
        /// <en>
        /// The caret position to set.
        /// </en>
        /// </param>
        /// <param name="line">
        /// <ja>コピー元となるGLineオブジェクト</ja>
        /// <en>GLine object that becomes copy origin</en>
        /// </param>
        /// <remarks>
        /// <ja>
        /// <paramref name="line"/>がnullのときには、引数なしのコンストラクタと同じ結果になります。
        /// </ja>
        /// <en>
        /// The same results with the constructor who doesn't have the argument when <paramref name="line"/> is null.
        /// </en>
        /// </remarks>
        public void Load(GLine line, int cc)
        {
            if (line == null)   //これがnullになっているとしか思えないクラッシュレポートがあった。本来はないはずなんだが...
            {
                Clear(80);
                return;
            }

            Clear(line.Length);
            GWord w = line.FirstWord;

            _text = line.DuplicateBuffer(_text);

            int n = 0;

            while (w != null)
            {
                int nextoffset = line.GetNextOffset(w);
                while (n < nextoffset)
                {
                    _attrs[n++] = new CharAttr(w.Decoration, w.CharGroup);
                }
                w = w.Next;
            }

            _eolType = line.EOLType;
            ExpandBuffer(cc + 1);
            this.CaretColumn = cc; //' 'で埋めることもあるのでプロパティセットを使う
        }
Exemple #3
0
 public void Load(char[] text, int cc)
 {
     _text        = text;
     _decorations = new TextDecoration[text.Length];
     _eolType     = EOLType.Continue;
     _caretColumn = cc;
 }
Exemple #4
0
        public static string GetToEndOfLine(string value, int position)
        {
            int     CurrentPosition = position;
            char    current         = value[CurrentPosition];
            EOLType end             = IsEndOfLine(value, CurrentPosition);

            while (CurrentPosition < value.Length && end == EOLType.No)
            {
                CurrentPosition++;
                end = IsEndOfLine(value, CurrentPosition);
            }
            return(value.Substring(position, CurrentPosition - position + (end == EOLType.Windows ? 2 : 1)));
        }
Exemple #5
0
        public static char[] eolChars(EOLType type)
        {
            switch (type)
            {
            case EOLType.Windows:
                return(new char[] { '\r', '\n' });

            case EOLType.Unix:
                return(new char[] { '\n' });

            case EOLType.Mac:
                return(new char[] { '\r' });
            }
            return(new char[] { });
        }
Exemple #6
0
 public OptionsGeneral(OptionsGeneral general)
 {
     m_loggerPriority           = general.m_loggerPriority;
     m_eolType                  = general.m_eolType;
     m_onDocumentSave           = general.m_onDocumentSave;
     m_onBuildProject           = general.m_onBuildProject;
     m_onRebuildProject         = general.m_onRebuildProject;
     m_onBuildSolution          = general.m_onBuildSolution;
     m_onrebuildSolution        = general.m_onrebuildSolution;
     m_handleNoneProjectFile    = general.m_handleNoneProjectFile;
     m_trackChanges             = general.m_trackChanges;
     m_autoFormatWhenKeyPressed = general.m_autoFormatWhenKeyPressed;
     m_autoFormatOptionsForC    = general.m_autoFormatOptionsForC;
     m_createDumpFileOnError    = general.m_createDumpFileOnError;
     m_dumpFilePath             = general.m_dumpFilePath;
 }
Exemple #7
0
 /// <summary>
 /// 全内容を破棄する
 /// </summary>
 public void Clear(int length)
 {
     if (length != _text.Length)
     {
         _decorations = new TextDecoration[length];
         _text        = new char[length];
     }
     else
     {
         for (int i = 0; i < _decorations.Length; i++)
         {
             _decorations[i] = null;
         }
         for (int i = 0; i < _text.Length; i++)
         {
             _text[i] = '\0';
         }
     }
     _caretColumn = 0;
     _eolType     = EOLType.Continue;
 }
Exemple #8
0
 // 全内容を破棄する
 /// <summary>
 /// <ja>
 /// 保持しているテキストをクリアします。
 /// </ja>
 /// <en>
 /// Clear the held text.
 /// </en>
 /// </summary>
 /// <param name="length"><ja>クリアする長さ</ja><en>Length to clear</en></param>
 public void Clear(int length)
 {
     if (_text == null || length != _text.Length)
     {
         _text  = new char[length];
         _attrs = new CharAttr[length];
     }
     else
     {
         for (int i = 0; i < _attrs.Length; i++)
         {
             _attrs[i] = new CharAttr(null, CharGroup.LatinHankaku);
         }
         for (int i = 0; i < _text.Length; i++)
         {
             _text[i] = '\0';
         }
     }
     _caretColumn = 0;
     _eolType     = EOLType.Continue;
 }
Exemple #9
0
        public static EOLType IsEndOfLine(string value, int position)
        {
            EOLType end = EOLType.No;
            char    n   = value[position];

            if (n == '\n')
            {
                end = EOLType.Nix;
            }
            else if (n == '\r')
            {
                if (value[position + 1] == '\n')
                {
                    end = EOLType.Windows;
                }
                else
                {
                    end = EOLType.Mac;
                }
            }
            return(end);
        }
Exemple #10
0
        public static System.String convert(System.String text, EOLType type)
        {
            if (string.IsNullOrEmpty(text))
            {
                return("");
            }

            var           anyEol  = eolChars(EOLType.Windows);
            var           newEol  = eolChars(type);
            StringBuilder builder = new StringBuilder();

            for (int searchIdx = 0; searchIdx < text.Length;)
            {
                var i = text.IndexOfAny(anyEol, searchIdx);
                // last line without eol
                if (i == -1)
                {
                    builder.Append(text.Substring(searchIdx));
                    searchIdx = text.Length;
                }
                else
                {
                    var shift = i - searchIdx;
                    builder.Append(text.Substring(searchIdx, shift));
                    var ommit = skip(text, i);
                    if (ommit > 0)
                    {
                        builder.Append(newEol);
                        searchIdx += ommit;
                    }
                    searchIdx += shift;
                }
            }

            return(builder.ToString());
        }
Exemple #11
0
 public void CarriageReturn()
 {
     _caretColumn = 0;
     _eolType     = EOLType.CR;
 }
Exemple #12
0
 public void Load(char[] text, int cc) {
     _text = text;
     _decorations = new TextDecoration[text.Length];
     _eolType = EOLType.Continue;
     _caretColumn = cc;
 }
Exemple #13
0
        /// 引数と同じ内容で初期化する。lineの内容は破壊されない。
        /// 引数がnullのときは引数なしのコンストラクタと同じ結果になる。
        /// <summary>
        /// <ja>
        /// 引数と同じ内容で初期化します。
        /// </ja>
        /// <en>
        /// Initialize same as argument.
        /// </en>
        /// </summary>
        /// <param name="cc">
        /// <ja>
        /// 設定するキャレット位置
        /// </ja>
        /// <en>
        /// The caret position to set.
        /// </en>
        /// </param>
        /// <param name="line">
        /// <ja>コピー元となるGLineオブジェクト</ja>
        /// <en>GLine object that becomes copy origin</en>
        /// </param>
        /// <remarks>
        /// <ja>
        /// <paramref name="line"/>がnullのときには、引数なしのコンストラクタと同じ結果になります。
        /// </ja>
        /// <en>
        /// The same results with the constructor who doesn't have the argument when <paramref name="line"/> is null. 
        /// </en>
        /// </remarks>
        public void Load(GLine line, int cc) {
            if (line == null) { //これがnullになっているとしか思えないクラッシュレポートがあった。本来はないはずなんだが...
                Clear(80);
                return;
            }

            Clear(line.Length);
            GWord w = line.FirstWord;
            _text = line.DuplicateBuffer(_text);

            int n = 0;
            while (w != null) {
                int nextoffset = line.GetNextOffset(w);
                while (n < nextoffset) {
                    _attrs[n++] = new CharAttr(w.Decoration, w.CharGroup);
                }
                w = w.Next;
            }

            _eolType = line.EOLType;
            ExpandBuffer(cc + 1);
            this.CaretColumn = cc; //' 'で埋めることもあるのでプロパティセットを使う
        }
Exemple #14
0
 // 全内容を破棄する
 /// <summary>
 /// <ja>
 /// 保持しているテキストをクリアします。
 /// </ja>
 /// <en>
 /// Clear the held text.
 /// </en>
 /// </summary>
 /// <param name="length"><ja>クリアする長さ</ja><en>Length to clear</en></param>
 public void Clear(int length) {
     if (_text == null || length != _text.Length) {
         _text = new char[length];
         _attrs = new CharAttr[length];
     }
     else {
         for (int i = 0; i < _attrs.Length; i++) {
             _attrs[i] = new CharAttr(null, CharGroup.LatinHankaku);
         }
         for (int i = 0; i < _text.Length; i++) {
             _text[i] = '\0';
         }
     }
     _caretColumn = 0;
     _eolType = EOLType.Continue;
 }
Exemple #15
0
 /// <summary>
 /// <ja>
 /// キャリッジリターンを挿入します。
 /// </ja>
 /// <en>
 /// Insert the carriage return.
 /// </en>
 /// </summary>
 public void CarriageReturn() {
     _caretColumn = 0;
     _eolType = EOLType.CR;
 }
Exemple #16
0
 /// <summary>
 /// �S��e��j������
 /// </summary>
 public void Clear(int length)
 {
     if(length!=_text.Length) {
         _decorations = new TextDecoration[length];
         _text = new char[length];
     }
     else {
         for(int i=0; i<_decorations.Length; i++) _decorations[i] = null;
         for(int i=0; i<_text.Length;        i++) _text[i] = '\0';
     }
     _caretColumn = 0;
     _eolType = EOLType.Continue;
 }
Exemple #17
0
        /// <summary>
        /// �����Ɠ�����e�ŏ���������Bline�̓�e�͔j�󂳂�Ȃ��B
        /// ������null�̂Ƃ��͈����Ȃ��̃R���X�g���N�^�Ɠ������ʂɂȂ�B
        /// </summary>
        public void Load(GLine line, int cc)
        {
            if(line==null) { //���ꂪnull�ɂȂ��Ă���Ƃ����v���Ȃ��N���b�V�����|�[�g���������B�{���͂Ȃ��͂��Ȃ񂾂�...
                Clear(80);
                return;
            }

            Clear(line.Length);
            GWord w = line.FirstWord;
            Debug.Assert(line.Text.Length==_text.Length);
            Array.Copy(line.Text, 0, _text, 0, _text.Length);

            int n = 0;
            while(w != null) {
                int nextoffset = line.WordNextOffset(w);
                while(n < nextoffset)
                    _decorations[n++] = w.Decoration;
                w = w.Next;
            }

            _eolType = line.EOLType;
            ExpandBuffer(cc+1);
            this.CaretColumn = cc; //' '�Ŗ��߂邱�Ƃ����̂Ńv���p�e�B�Z�b�g��g��
        }
Exemple #18
0
        /// �����Ɠ�����e�ŏ���������Bline�̓�e�͔j�󂳂�Ȃ��B
        /// ������null�̂Ƃ��͈����Ȃ��̃R���X�g���N�^�Ɠ������ʂɂȂ�B
        /// <summary>
        /// <ja>
        /// �����Ɠ�����e�ŏ��������܂��B
        /// </ja>
        /// <en>
        /// Initialize same as argument.
        /// </en>
        /// </summary>
        /// <param name="cc">
        /// <ja>
        /// �ݒ肷��L�����b�g�ʒu
        /// </ja>
        /// <en>
        /// The caret position to set.
        /// </en>
        /// </param>
        /// <param name="line">
        /// <ja>�R�s�[���ƂȂ�GLine�I�u�W�F�N�g</ja>
        /// <en>GLine object that becomes copy origin</en>
        /// </param>
        /// <remarks>
        /// <ja>
        /// <paramref name="line"/>��null�̂Ƃ��ɂ́A�����Ȃ��̃R���X�g���N�^�Ɠ������ʂɂȂ�܂��B
        /// </ja>
        /// <en>
        /// The same results with the constructor who doesn't have the argument when <paramref name="line"/> is null. 
        /// </en>
        /// </remarks>
        public void Load(GLine line, int cc)
        {
            if (line == null) { //���ꂪnull�ɂȂ��Ă���Ƃ����v���Ȃ��N���b�V�����|�[�g���������B�{���͂Ȃ��͂��Ȃ񂾂�...
                Clear(80);
                return;
            }

            Clear(line.Length);
            GWord w = line.FirstWord;
            _text = line.DuplicateBuffer(_text);

            int n = 0;
            while (w != null) {
                int nextoffset = line.GetNextOffset(w);
                while (n < nextoffset) {
                    _attrs[n++] = new CharAttr(w.Decoration, w.CharGroup);
                }
                w = w.Next;
            }

            _eolType = line.EOLType;
            ExpandBuffer(cc + 1);
            this.CaretColumn = cc; //' '�Ŗ��߂邱�Ƃ����̂Ńv���p�e�B�Z�b�g��g��
        }