Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions Vienna/Sources/Application/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1683,15 +1683,41 @@ -(IBAction)localPerformFindPanelAction:(id)sender
*/
-(BOOL)handleKeyDown:(NSEvent *)event
{
if (event.type != NSEventTypeKeyDown && event.characters.length != 1) {
if (event.type != NSEventTypeKeyDown || event.characters.length != 1) {
return NO;
}
unichar keyChar = [event.characters characterAtIndex:0];
NSEventModifierFlags flags = event.modifierFlags;
unichar keyChar = [event.characters characterAtIndex:0];
NSEventModifierFlags flags = event.modifierFlags;
NSEventModifierFlags relevantFlags = flags & NSEventModifierFlagDeviceIndependentFlagsMask;

if (relevantFlags == NSEventModifierFlagControl &&
(keyChar == 0x05 ||
[[event.charactersIgnoringModifiers lowercaseString] isEqualToString:@"e"])) {
id<Tab> activeBrowserTab = self.browser.activeTab;
if (activeBrowserTab == nil) {
// We are in the article view.
[self.mainWindow makeFirstResponder:((NSView<BaseView> *)self.browser.primaryTab.view).mainView];
[self.articleController.mainArticleView scrollLineDownDetails];
return YES;
}
}

if (relevantFlags == NSEventModifierFlagControl &&
(keyChar == 0x19 ||
[[event.charactersIgnoringModifiers lowercaseString] isEqualToString:@"y"])) {
id<Tab> activeBrowserTab = self.browser.activeTab;
if (activeBrowserTab == nil) {
// We are in the article view.
[self.mainWindow makeFirstResponder:((NSView<BaseView> *)self.browser.primaryTab.view).mainView];
[self.articleController.mainArticleView scrollLineUpDetails];
return YES;
}
}

switch (keyChar) {
case NSLeftArrowFunctionKey:
if (flags & (NSEventModifierFlagCommand | NSEventModifierFlagOption)) {
return NO;
return NO;
} else {
if (self.mainWindow.firstResponder == ((NSView<BaseView> *)self.browser.primaryTab.view).mainView) {
[self.mainWindow makeFirstResponder:self.foldersTree.mainView];
Expand Down
2 changes: 2 additions & 0 deletions Vienna/Sources/Main window/ArticleBaseView.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
@protocol ArticleBaseView <BaseView>
@property (readonly, nonatomic) BOOL selectFirstUnreadInFolder;
@property (readonly, nonatomic) BOOL viewNextUnreadInFolder;
-(void)scrollLineDownDetails;
-(void)scrollLineUpDetails;
-(void)scrollDownDetailsOrNextUnread;
-(void)scrollUpDetailsOrGoBack;
-(void)scrollToArticle:(NSString *)guid;
Expand Down
12 changes: 11 additions & 1 deletion Vienna/Sources/Main window/ArticleListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,17 @@ -(void)scrollDownDetailsOrNextUnread
ArticleController * articleController = self.articleController;
[articleController markReadByArray:self.markedArticleRange readFlag:YES];
[articleController displayNextUnread];
}
}
}

-(void)scrollLineDownDetails
{
[(NSView *)articleText scrollLineDown:nil];
}

-(void)scrollLineUpDetails
{
[(NSView *)articleText scrollLineUp:nil];
}

-(void)scrollUpDetailsOrGoBack
Expand Down
8 changes: 8 additions & 0 deletions Vienna/Sources/Main window/BrowserTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ extension BrowserTab: Tab {
self.webView.scrollPageUp(sender)
}

override func scrollLineDown(_ sender: Any?) {
self.webView.scrollLineDown(sender)
}

override func scrollLineUp(_ sender: Any?) {
self.webView.scrollLineUp(sender)
}

func searchFor(_ searchString: String, action: NSFindPanelAction) {
if #available(macOS 11, *) {
let configuration = WKFindConfiguration()
Expand Down
10 changes: 10 additions & 0 deletions Vienna/Sources/Main window/UnifiedDisplayView.m
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,16 @@ - (void)scrollDownDetailsOrNextUnread
}
}

- (void)scrollLineDownDetails
{
[articleList scrollLineDown:nil];
}

- (void)scrollLineUpDetails
{
[articleList scrollLineUp:nil];
}

- (void)scrollUpDetailsOrGoBack
{
NSScrollView *scrollView = [articleList enclosingScrollView];
Expand Down