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

[SC-IDE] Evaluate a line within a region (with the same shortcut) #403

Closed
smrg-lm opened this issue Aug 21, 2012 · 5 comments
Closed

[SC-IDE] Evaluate a line within a region (with the same shortcut) #403

smrg-lm opened this issue Aug 21, 2012 · 5 comments

Comments

@smrg-lm
Copy link
Contributor

smrg-lm commented Aug 21, 2012

Trying to evaluate a line inside a region always evaluates the region.
That is no possible to do with the same shortcut as in sc.app and gedit for example.
Selecting text works but the issue is that it differs form the traditional behavior.

@jamshark70
Copy link
Contributor

Ctrl-shift-return evaluates the line only.

It might be debatable whether the so-called "default" behavior (that is, the behavior of the shorter key binding ctrl-return) should evaluate only a line or the whole region. But, there is a way to evaluate the line only.

I tend to think that ctrl-return and ctrl-shift-return should be reversed. If we assume that most users will be coming to SC-IDE from sc.app, they will expect the most basic "execute" keystroke to run the line or an explicitly selected block and not "helpfully" implicitly select a larger block. They expect to have to do something extra to run an entire region. Better to err on the side of caution and tend towards executing shorter code, rather than creating lots of opportunities for users to run initialization code accidentally and thereby leak objects etc.

@danstowell
Copy link
Member

I just got hit by this. I think the following is quite an unpleasant effect of the current behaviour:

  (96000 * 0.02).nextPowerOfTwo

I had my cursor inside the brackets and pressed ctrl+return. I got weird answers because it was not evaluating the full line but only the subset in the brackets. Maybe I would get used to this but it's quite awkward that the execution of such a simple statement can lead to two different results depending on where my cursor is...

@timblechmann
Copy link
Contributor

personally, i evaluate regions more often with lines, but maybe we can improve the behavior:

  • if selection, evaluate selection
  • if inside region(()), and ( and ) are in the same line, evaluate line
  • if inside region(()), evaluate region
  • else evaluate line

in general, i prefer a smart design, which might be not what scapp as been doing. we don't want to re-implement scapp

@danstowell
Copy link
Member

Yes, I agree, no need to re-implement scapp - and I like the logic of the behaviour you listed there tim.

@timblechmann
Copy link
Contributor

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants