Skip to content

Commit

Permalink
Fix line threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
sboulema committed Mar 9, 2024
1 parent b5ce4c7 commit a0651b0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CodeNav.Shared/Helpers/DocumentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static async Task<int> GetNumberOfLines()
try
{
var documentView = await VS.Documents.GetActiveDocumentViewAsync();
return documentView?.TextView?.TextViewLines?.Count ?? 0;
return documentView?.TextBuffer?.CurrentSnapshot?.AsText().Lines.Count ?? 0;
}
catch (Exception)
{
Expand Down
48 changes: 35 additions & 13 deletions CodeNav.Shared/Menus/ItemContextMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,41 @@
<ResourceDictionary Source="../Styles/BookmarkButtonStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>

<ContextMenu x:Key="ItemContextMenu" IsOpen="{Binding Path=ContextMenuIsOpen, Mode=TwoWay}">

<MenuItem Header="Go to Definition" Command="{Binding Path=GoToDefinitionCommand}">
<ContextMenu
x:Key="ItemContextMenu"
IsOpen="{Binding Path=ContextMenuIsOpen, Mode=TwoWay}">

<MenuItem
Header="Go to Definition"
Command="{Binding Path=GoToDefinitionCommand}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.GoToDefinition}" />
</MenuItem.Icon>
</MenuItem>

<MenuItem Header="Go to End" Command="{Binding Path=GoToEndCommand}">
<MenuItem
Header="Go to End"
Command="{Binding Path=GoToEndCommand}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.HTMLEndTag}" />
</MenuItem.Icon>
</MenuItem>

<Separator />

<MenuItem Header="Select In Code" Command="{Binding Path=SelectInCodeCommand}">
<MenuItem
Header="Select In Code"
Command="{Binding Path=SelectInCodeCommand}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.BlockSelection}" />
</MenuItem.Icon>
</MenuItem>

<Separator />

<MenuItem Header="Copy Name" Command="{Binding Path=CopyNameCommand}">
<MenuItem
Header="Copy Name"
Command="{Binding Path=CopyNameCommand}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.Copy}" />
</MenuItem.Icon>
Expand Down Expand Up @@ -71,7 +81,9 @@
</MenuItem.Header>
</MenuItem>

<MenuItem Header="Clear Bookmarks In Document" Command="{Binding Path=ClearBookmarksCommand}"
<MenuItem
Header="Clear Bookmarks In Document"
Command="{Binding Path=ClearBookmarksCommand}"
IsEnabled="{Binding BookmarksAvailable}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.ClearBookmark}" />
Expand All @@ -81,39 +93,49 @@
<MenuItem Header="Filter On Bookmarks" Command="{Binding Path=FilterBookmarksCommand}"
IsCheckable="True"
IsChecked="{Binding Path=FilterOnBookmarks}"
IsEnabled="{Binding Path=BookmarksAvailable}" />
IsEnabled="{Binding Path=BookmarksAvailable}"/>

<MenuItem Header="Customize Bookmark Styles" Command="{Binding Path=CustomizeBookmarkStylesCommand}">
<MenuItem
Header="Customize Bookmark Styles"
Command="{Binding Path=CustomizeBookmarkStylesCommand}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.ColorPalette}" />
</MenuItem.Icon>
</MenuItem>

<Separator />

<MenuItem Header="Refresh" Command="{Binding Path=RefreshCommand}">
<MenuItem
Header="Refresh"
Command="{Binding Path=RefreshCommand}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.Refresh}" />
</MenuItem.Icon>
</MenuItem>

<Separator />

<MenuItem Header="Expand All" Command="{Binding Path=ExpandAllCommand}">
<MenuItem
Header="Expand All"
Command="{Binding Path=ExpandAllCommand}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.ExpandAll}" />
</MenuItem.Icon>
</MenuItem>

<MenuItem Header="Collapse All" Command="{Binding Path=CollapseAllCommand}">
<MenuItem
Header="Collapse All"
Command="{Binding Path=CollapseAllCommand}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.CollapseAll}" />
</MenuItem.Icon>
</MenuItem>

<Separator />

<MenuItem Header="Clear History" Command="{Binding Path=ClearHistoryCommand}">
<MenuItem
Header="Clear History"
Command="{Binding Path=ClearHistoryCommand}">
<MenuItem.Icon>
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.CleanData}" />
</MenuItem.Icon>
Expand Down

0 comments on commit a0651b0

Please sign in to comment.