Skip to content

Specify toggle value on cell line number#2903

Merged
Carreau merged 2 commits into
ipython:masterfrom
Carreau:toggle-line-number
Feb 16, 2013
Merged

Specify toggle value on cell line number#2903
Carreau merged 2 commits into
ipython:masterfrom
Carreau:toggle-line-number

Conversation

@Carreau
Copy link
Copy Markdown
Member

@Carreau Carreau commented Feb 9, 2013

this allow to call toggle_line_number by specyfying wether you want to
show or hide the line number with a boolean.
Without parameter it continue to toggle to the opposite of curent state

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, if this sets an explicit value, it's not toggling anymore.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it "toggles" only when called without argument. I have no strong
feeling about a different name if you prefere.
Le 10 févr. 2013 00:42, "Min RK" notifications@github.com a écrit :

In IPython/frontend/html/notebook/static/js/cell.js:

  **/
  • Cell.prototype.toggle_line_numbers = function () {
  • Cell.prototype.toggle_line_numbers = function (value) {
  •    if(value != undefined){
    
  •        this.code_mirror.setOption('lineNumbers', value);
    
  •        this.code_mirror.refresh();
    
  •        return
    
  •    }
    

Just to be clear, if this sets an explicit value, it's not toggling
anymore.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2903/files#r2954147..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a show_line_numbers method for the argument, so that toggling and explicit setting are separate

mostly convenience methods to wrap codemirror one,
plus doc and 1 doc fix (missing curly bracket)
@Carreau
Copy link
Copy Markdown
Member Author

Carreau commented Feb 10, 2013

Done.

@minrk
Copy link
Copy Markdown
Member

minrk commented Feb 14, 2013

Should toggle_line_numbers call show_line_numbers? I know it's just a two-line function, so maybe it doesn't make sense.

@Carreau
Copy link
Copy Markdown
Member Author

Carreau commented Feb 16, 2013

Should toggle_line_numbers call show_line_numbers? I know it's just a two-line function, so maybe it doesn't make sense.

Done.

Carreau added a commit that referenced this pull request Feb 16, 2013
Specify toggle value on cell line number
@Carreau Carreau merged commit 48c19e7 into ipython:master Feb 16, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Specify toggle value on cell line number
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

Successfully merging this pull request may close these issues.

2 participants