|
|
@ -112,12 +112,22 @@ namespace ICSharpCode.SharpDevelop.Editor.AvalonEdit |
|
|
|
|
|
|
|
|
|
|
|
public int PositionToOffset(int line, int column) |
|
|
|
public int PositionToOffset(int line, int column) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return document.GetOffset(new TextLocation(line, column)); |
|
|
|
try { |
|
|
|
|
|
|
|
return document.GetOffset(new TextLocation(line, column)); |
|
|
|
|
|
|
|
} catch (ArgumentOutOfRangeException e) { |
|
|
|
|
|
|
|
// for UDC: re-throw exception so that stack trace identifies the caller (instead of the adapter)
|
|
|
|
|
|
|
|
throw new ArgumentOutOfRangeException(e.ParamName, e.ActualValue, e.Message); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Location OffsetToPosition(int offset) |
|
|
|
public Location OffsetToPosition(int offset) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return ToLocation(document.GetLocation(offset)); |
|
|
|
try { |
|
|
|
|
|
|
|
return ToLocation(document.GetLocation(offset)); |
|
|
|
|
|
|
|
} catch (ArgumentOutOfRangeException e) { |
|
|
|
|
|
|
|
// for UDC: re-throw exception so that stack trace identifies the caller (instead of the adapter)
|
|
|
|
|
|
|
|
throw new ArgumentOutOfRangeException(e.ParamName, e.ActualValue, e.Message); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static Location ToLocation(TextLocation position) |
|
|
|
public static Location ToLocation(TextLocation position) |
|
|
|