Permalink
Browse files

Fixed column displayed in status bar.

  • Loading branch information...
1 parent 169c640 commit c143e6c89caf135a12a21a27388330451e339b50 @dgrunwald dgrunwald committed Sep 28, 2010
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditViewContent.cs
@@ -6,6 +6,7 @@
using System.Linq;
using System.Text;
using System.Windows.Threading;
+using ICSharpCode.AvalonEdit.AddIn.Options;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Utils;
@@ -182,7 +183,17 @@ public override INavigationPoint BuildNavPoint()
void CaretChanged(object sender, EventArgs e)
{
NavigationService.Log(this.BuildNavPoint());
- WorkbenchSingleton.StatusBar.SetCaretPosition(this.Column, this.Line, this.Column);
+ var document = codeEditor.Document;
+ int lineOffset = document.GetLineByNumber(this.Line).Offset;
+ int chOffset = this.Column;
+ int col = 1;
+ for (int i = 1; i < chOffset; i++) {
+ if (document.GetCharAt(lineOffset + i - 1) == '\t')
+ col += CodeEditorOptions.Instance.IndentationSize;
+ else
+ col += 1;
+ }
+ WorkbenchSingleton.StatusBar.SetCaretPosition(col, this.Line, chOffset);
}
public override bool IsReadOnly {

0 comments on commit c143e6c

Please sign in to comment.