int IVsTextLines.ReleaseLineDataEx(LINEDATAEX[] pLineData) { return VSConstants.E_NOTIMPL; }
int IVsTextImage.ReleaseLine(LINEDATAEX[] pLineData) { if (null == pLineData || 0 == pLineData.Length) return VSConstants.E_INVALIDARG; //clear the Line Data object pLineData[0].iLength = 0; Marshal.FreeCoTaskMem(pLineData[0].pszText); pLineData[0].iEolType = EOLTYPE.eolNONE; pLineData[0].pAttributes = IntPtr.Zero; pLineData[0].dwFlags = (ushort)LINEDATAEXFLAGS.ldfDefault; pLineData[0].dwReserved = 0; pLineData[0].pAtomicTextChain = IntPtr.Zero; return VSConstants.S_OK; }
int IVsTextLines.GetLineDataEx(uint dwFlags, int iLine, int iStartIndex, int iEndIndex, LINEDATAEX[] pLineData, MARKERDATA[] pMarkerData ) { return VSConstants.E_NOTIMPL; }
// return the type of new line to use that matches the one at the given line. public string GetNewLine(int line) { string eol = "\r\n"; // "\x000D\x000A" LINEDATAEX[] ld = new LINEDATAEX[1]; NativeMethods.ThrowOnFailure(this.textLines.GetLineDataEx(0, line, 0, 0, ld, null)); uint iEolType = (uint)ld[0].iEolType; if (iEolType == (uint)EOLTYPE.eolUNI_LINESEP) { if (this.textLines is IVsTextLines2) { IVsTextLines2 textLines2 = (IVsTextLines2)this.textLines; int hr = textLines2.GetEolTypeEx(ld, out iEolType); if (NativeMethods.Failed(hr)) { #if LANGTRACE Trace.WriteLine("Ignoring actual EOL type and continuing"); #endif iEolType = (uint)EOLTYPE.eolUNI_LINESEP; } } } switch (iEolType) { case (uint)EOLTYPE.eolCR: eol = "\r"; // "\x000D" break; case (uint)EOLTYPE.eolLF: eol = "\n"; // "\x000A" break; case (uint)EOLTYPE.eolUNI_LINESEP: eol = "\u2028"; break; case (uint)EOLTYPE.eolUNI_PARASEP: eol = "\u2029"; break; case (uint)_EOLTYPE2.eolUNI_NEL: eol = "\u0085"; break; } NativeMethods.ThrowOnFailure(this.textLines.ReleaseLineDataEx(ld)); return eol; }
int IVsTextImage.GetLine(uint grfGet, int iLine, int iStartIndex, int iEndIndex, LINEDATAEX[] pLineData ) { if (null == pLineData || 0 == pLineData.Length) return VSConstants.E_INVALIDARG; //first initialize the Line Data object pLineData[0].iLength = 0; pLineData[0].pszText = IntPtr.Zero; pLineData[0].iEolType = EOLTYPE.eolCR; pLineData[0].pAttributes = IntPtr.Zero; pLineData[0].dwFlags = (ushort)LINEDATAEXFLAGS.ldfDefault; pLineData[0].dwReserved = 0; pLineData[0].pAtomicTextChain = IntPtr.Zero; int lineCount = editorControl.RichTextBoxControl.Lines.Length; if ((iLine < 0) || (iLine >= lineCount) || (iStartIndex < 0) || (iEndIndex < 0) || (iStartIndex > iEndIndex)) { return VSConstants.E_INVALIDARG; } string lineText = editorControl.RichTextBoxControl.Lines[iLine]; // If the line is empty then do not attempt to calculate the span in the normal way; just return. if (string.IsNullOrEmpty(lineText) && iStartIndex == 0 && iEndIndex == 0) return VSConstants.S_OK; int lineLength = lineText.Length; //Error if startIndex is greater than the line length if (iStartIndex >= lineLength || iEndIndex >= lineLength) return VSConstants.E_INVALIDARG; int spanLength = iEndIndex - iStartIndex + 1; //Error in arguments if the span length is greater than the line length if (spanLength > lineLength) return VSConstants.E_INVALIDARG; //If we are looking for a subset of the line i.e. a line span if (0 != (grfGet & (uint)GLDE_FLAGS.gldeSubset)) { pLineData[0].iLength = spanLength; string spanText = lineText.Substring(iStartIndex, spanLength); pLineData[0].pszText = new IntPtr(); pLineData[0].pszText = Marshal.StringToCoTaskMemAuto(spanText); } //else we need to return the complete line else { pLineData[0].iLength = lineLength; pLineData[0].pszText = new IntPtr(); pLineData[0].pszText = Marshal.StringToCoTaskMemAuto(lineText); } return VSConstants.S_OK; }
public int ReleaseLineDataEx(LINEDATAEX[] pLineData) { throw new Exception("The method or operation is not implemented."); }
public int GetLineDataEx(uint dwFlags, int iLine, int iStartIndex, int iEndIndex, LINEDATAEX[] pLineData, MARKERDATA[] pMarkerData) { throw new Exception("The method or operation is not implemented."); }
public int ReleaseLineDataEx(LINEDATAEX[] pLineData) { return VSConstants.S_OK; }
public int GetLineDataEx(uint dwFlags, int iLine, int iStartIndex, int iEndIndex, LINEDATAEX[] pLineData, MARKERDATA[] pMarkerData) { return VSConstants.S_OK; }
public int GetLineDataEx(uint dwFlags, int iLine, int iStartIndex, int iEndIndex, LINEDATAEX[] pLineData, MARKERDATA[] pMarkerData) { throw new NotImplementedException(); }
public int ReleaseLineDataEx(LINEDATAEX[] pLineData) { throw new NotImplementedException(); }
public int ReleaseLineDataEx(LINEDATAEX[] pLineData) { return _textBuffer.ReleaseLineDataEx(pLineData); }
public int GetLineDataEx(uint dwFlags, int iLine, int iStartIndex, int iEndIndex, LINEDATAEX[] pLineData, MARKERDATA[] pMarkerData) { return _textBuffer.GetLineDataEx(dwFlags, iLine, iStartIndex, iEndIndex, pLineData, pMarkerData); }
int IVsTextImage.GetLine(uint grfGet, int iLine, int iStartIndex, int iEndIndex, LINEDATAEX[] pLineData ) { //if (null == pLineData || 0 == pLineData.Length) // return VSConstants.E_INVALIDARG; ////first intialize the Line Data object //pLineData[0].iLength = 0; //pLineData[0].pszText = IntPtr.Zero; //pLineData[0].iEolType = EOLTYPE.eolCR; //pLineData[0].pAttributes = IntPtr.Zero; //pLineData[0].dwFlags = (ushort)LINEDATAEXFLAGS.ldfDefault; //pLineData[0].dwReserved = 0; //pLineData[0].pAtomicTextChain = IntPtr.Zero; //int lineCount = editorControl.RichTextBoxControl.Lines.Length; //if ((iLine < 0) || (iLine >= lineCount) || (iStartIndex < 0) || (iEndIndex < 0) || // (iStartIndex > iEndIndex)) //{ // return VSConstants.E_INVALIDARG; //} //string lineText = editorControl.RichTextBoxControl.Lines[iLine]; //// TODO fix //int lineLength = 0; //lineText.Length; //Error if startIndex is greater than the line length //if (iStartIndex >= lineLength || iEndIndex >= lineLength) // return VSConstants.E_INVALIDARG; //int spanLength = iEndIndex - iStartIndex + 1; ////Error in arguments if the span length is greater than the line length //if (spanLength > lineLength) // return VSConstants.E_INVALIDARG; ////If we are looking for a subset of the line i.e. a line span //if (0 != (grfGet & (uint)GLDE_FLAGS.gldeSubset)) //{ // pLineData[0].iLength = spanLength; // string spanText = lineText.Substring(iStartIndex, spanLength); // pLineData[0].pszText = new IntPtr(); // pLineData[0].pszText = Marshal.StringToCoTaskMemAuto(spanText); //} ////else we need to return the complete line //else //{ // pLineData[0].iLength = lineLength; // pLineData[0].pszText = new IntPtr(); // pLineData[0].pszText = Marshal.StringToCoTaskMemAuto(lineText); //} return VSConstants.S_OK; }