Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evaluate region (cmd-enter) in help file calls code selected in code editor #1676

Closed
telephon opened this issue Sep 30, 2015 · 6 comments
Closed
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: SCDoc scdoc syntax, parser, and renderer. for changes to schelp files, use "comp: help" env: SCIDE
Milestone

Comments

@telephon
Copy link
Member

Evaluate region in help file calls code selected in code editor. This happens only when using cmd-enter(evaluate region) and not in shift-enter. Evaluate region isn't implemented in the help system. Instead, the same key should probably do nothing.

Possibly the mistake is here?

void HelpBrowser::applySettings( Settings::Manager *settings )
{
    settings->beginGroup("IDE/shortcuts");

    mActions[DocClose]->setShortcut( settings->shortcut("ide-document-close") );

    mActions[ZoomIn]->setShortcut( settings->shortcut("editor-enlarge-font") );

    mActions[ZoomOut]->setShortcut( settings->shortcut("editor-shrink-font") );

    mActions[ResetZoom]->setShortcut( settings->shortcut("editor-reset-font-size") );

    QList<QKeySequence> evalShortcuts;
    evalShortcuts.append( settings->shortcut("editor-eval-smart") );
    evalShortcuts.append( settings->shortcut("editor-eval-line") );
    evalShortcuts.append( QKeySequence(Qt::Key_Enter) );
    mActions[Evaluate]->setShortcuts( evalShortcuts );

    settings->endGroup();

    QString codeFontFamily = settings->codeFont().family();
    mWebView->settings()->setFontFamily( QWebSettings::FixedFont, codeFontFamily );
}
@telephon telephon added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE triaged labels Sep 30, 2015
@telephon
Copy link
Member Author

This was discussed in #1385

@telephon telephon added the comp: SCDoc scdoc syntax, parser, and renderer. for changes to schelp files, use "comp: help" label Sep 30, 2015
@telephon telephon added this to the 3.7.0 milestone Sep 30, 2015
@timblechmann
Copy link
Contributor

the shortcuts for evaluating code in the code editor are defined in MultiEditor: grep for EvaluateRegion and EvaluateLine.

@scztt
Copy link
Contributor

scztt commented Sep 30, 2015

To reiterate / collapse some of my comments from the previous thread:

  • we use QEvent::ShortcutOverride to catch eval-related events in the HelpBrowser
  • for some reason, our ShortcutOverride is not even being reached in case of Cmd+Enter. My hypothesis was that this is because Qt already has an override or other special shortcut handling behavior elsewhere that is catching the Cmd+Enter further up in the UI. ShortcutOverride overrides the normal keyboard event chain, but there doesn't appear to be a mechanism to override OTHER overrides / other non-standard interceptions of the event.
  • A pragmatic fix is to install an application-eval Cmd+Enter handler (which we may already have, if it's not on the editors themselves), detect which widget has focus (editor, help browser, etc) and explicitly invoke an eval method on that.

@telephon telephon modified the milestones: 3.7.x, 3.7.0 Nov 16, 2015
@telephon
Copy link
Member Author

Added a note in Known Issues

@kisielk
Copy link
Contributor

kisielk commented Jul 31, 2016

I can confirm it's something specific about cmd-enter. If I reassign the shortcut to something else in the preferences then it works fine.

@telephon telephon changed the title evaluate region in help file calls code selected in code editor evaluate region (cmd-enter) in help file calls code selected in code editor Jul 31, 2016
@nhthn nhthn modified the milestones: 3.8, 3.9 Jan 15, 2017
@nhthn nhthn modified the milestones: 3.9, 3.9.x Oct 28, 2017
@telephon
Copy link
Member Author

telephon commented Jun 8, 2018

Fixed in 7201aa7

@telephon telephon closed this as completed Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: SCDoc scdoc syntax, parser, and renderer. for changes to schelp files, use "comp: help" env: SCIDE
Projects
None yet
Development

No branches or pull requests

6 participants