TailBlazer
TailBlazer copied to clipboard
Keyboard shortcuts for navigating file
- The
↑
and↓
keys do move line but they strangely highlight (lowlight?) the lines in grey and react incredibly slowly -
Page Up
andPage Down
likewise are unusably slow and suffer from the highlighting problem -
Ctrl
+Home
andCtrl
+End
are (almost) universally implemented to mean 'top of file' and 'bottom of file' respectively but do nothing it TailBlazer. -
Home
andEnd
seem to navigate to the top and bottom of the screen rather than the more normal behaviour of moving the cursor to the start and end of the line. These also suffer from the weird highlighting problem. As there is no cursor I suggest these should scroll the line to the far left and right respectively.
Would be nice if these could all work properly.
I am aware of this and you can be assured the problem will soon go away.
However you raising it as an issue has pushed it up the priority queue.
+1
+1
Guys, finally lifted my head up from doing some search / highlight / regex stuff and taken a look again at this one.
90% of the problem is the list box which displays the lines loses focus after the keyboard events fires. So for example if you press PageUp it correctly goes to the first line. When you press it again it correctly goes to the first line on the previous page. At that point focus is lost and the keyboard navigation no longer works.
I have done my reading and apparently by setting Keyboard.TabNavigation="Cycle" and IsTabStop="False" should solve this, Alas, it does not so I am left scratching my head.
If anyone can help on this one please give me a shout
@RolandPheasant I got the same problem in my player. It was the delete action that breaks my selection and focus, maybe my solution can help you a little bit.
public BaseListBox()
{
this.Events().Loaded.Subscribe(e => {
var observeItemContGenerator = this.ObservableForProperty(x => x.ObserveItemContainerGenerator)
.Where(x => x.Value == true)
.Select(_ => Unit.Default);
var itemContGeneratorStatusChanged = this.ItemContainerGenerator.Events().StatusChanged
.Throttle(TimeSpan.FromMilliseconds(150), RxApp.MainThreadScheduler)
.Select(_ => Unit.Default);
Observable.Zip(observeItemContGenerator, itemContGeneratorStatusChanged).Subscribe(_ => this.FocusSelectedItem());
});
}
private void FocusSelectedItem()
{
if (this.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated) return;
this.Log().Debug("ItemContainerGenerator status changed");
if (this.Items.Count == 0) return;
var index = this.SelectedIndex;
if (index < 0) return;
Action focusAction = () => {
this.ObserveItemContainerGenerator = false;
if (this.Items.Count == 0) return;
index = this.SelectedIndex;
if (index < 0) return;
this.Focus();
this.ScrollIntoView(this.SelectedItem);
var item = this.ItemContainerGenerator.ContainerFromIndex(index) as ListBoxItem;
if (item == null) return;
item.Focus();
this.Log().Debug("focus selected item {0} / {1}", index, item);
};
this.Dispatcher.BeginInvoke(DispatcherPriority.Background, focusAction);
}
@punker76 my problem is a little different but your solution got me on the right tracks. The page up / down are now working well so thanks very much.
The other navigation oddities still need sorting out but the problems are in my code only.
@RolandPheasant and again a little step forward :+1: