Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#5644 closed defect (duplicate)

make it so escape make the introspection window in the notebook disappear

Reported by: was Owned by: boothby
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: notebook Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

this was *the* most commonly requested features during Math 480B

Attachments (1)

trac_5644_esc_kills_introspect.patch (766 bytes) - added by mpatel 12 years ago.
See comment.

Download all attachments as: .zip

Change History (10)

Changed 12 years ago by mpatel

See comment.

comment:1 Changed 12 years ago by mpatel

  • Summary changed from make it so escape make the introspection window in the notebook disappear to [with patch, needs review] make it so escape make the introspection window in the notebook disappear

The attached patch seems to work in Firefox 3 without breaking other functions. I'm not sure about the purpose of

            if(browser_op) { focus_delay(id,true); }

Although I haven't copied this to the new conditional clause, the patch works in Opera 9, too.

By the way, I think the halt_introspection(); statement just before the new code is unnecessary, since handle_replacement_controls() calls it before returning true. But the patch leaves this alone.

comment:2 Changed 12 years ago by mpatel

  • Summary changed from [with patch, needs review] make it so escape make the introspection window in the notebook disappear to [with patch, needs work] make it so escape make the introspection window in the notebook disappear

To clarify: This patch works for a "TAB" introspection window but not for a "SHIFT-ENTER" introspection window. The latter is placed in cell_output_* instead of introspect_div_*, which is more difficult to make disappear, at least for me.

Because of this, I've changed this ticket's status to "needs work." The TAB-only patch may be enough for some users.

comment:3 Changed 12 years ago by mpatel

On "SHIFT-ENTER" introspection: If you're feeling adventurous, replace the new lines in the patch with these:

    } else if((introspect_id == id) && introspection_loaded) {
        if(key_close_helper(e)) {
            halt_introspection();
            return false; //otherwise, keep going
        }
    } else {
        output_html = get_element('cell_output_html_'+id);
        pre0 = output_html.getElementsByTagName('pre')[0];
        if (pre0 && (pre0.getAttribute('class') === 'introspection') && key_close_helper(e)) {
            output_html.removeChild(pre0);
            return false; //otherwise, keep going
        }

Note: This doesn't tell the server about any changes! I don't know exactly how this plays out in practice.

comment:4 Changed 12 years ago by mpatel

Ultimately, perhaps it's better to "unify" the treatment of introspection windows. That is, should the notebook place both TAB and SHIFT-ENTER results in a cell's dedicated introspect_div_*? Then binding ESC to halt_introspection() should be enough. This may also simplify related code (e.g., see #6001).

At first glance, which is all I can muster right now, notebook treats TABS and SHIFT-ENTER differently enough that this is not a trivial change.

comment:5 Changed 12 years ago by mpatel

A first take at "unification:" Replace the end of js.py's set_output_text() with something like

    if(introspect_id == id) {
        if (status == 'd') {
            introspection_loaded = true;
            introspection_text = introspect_html;
        }
        update_introspection_text();
    } else if(introspect_html != '') {
        introspect_id = id;
        introspection_loaded = true;
        introspection_text = introspect_html;
        update_introspection_text();
/*
        cell_output.innerHTML = '';
        cell_output_nowrap.innerHTML = '';
        cell_output_html.innerHTML = introspect_html;
        if (contains_jsmath(introspect_html)) {
            try {
                jsMath.ProcessBeforeShowing(cell_output_html);
            } catch(e) {
                cell_output.innerHTML = jsmath_font_msg + cell_output_html.innerHTML;
            }
        }
*/
    } else {
        introspect_id = id;
        introspection_loaded = true;
        introspection_text = '';
        update_introspection_text();
    }

Probably, it's far better to eliminate all global variables, starting with those related to introspection. This would

  • Make it easier to understand, maintain, and modify the code.
  • Permit independent (i.e., non-interfering) introspection windows for different cells.
  • Help with ticket #6001.

To be continued...

comment:6 Changed 11 years ago by mpatel

  • Report Upstream set to N/A

It's likely that #6855 will subsume this ticket.

comment:7 Changed 11 years ago by mpatel

  • Work issues set to Close with #7666

#7666 subsumes this ticket. Please close this ticket when that one merges.

comment:8 Changed 11 years ago by timdumol

  • Milestone changed from sage-4.3.1 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from needs_work to closed
  • Work issues Close with #7666 deleted

comment:9 Changed 11 years ago by mvngu

  • Summary changed from [with patch, needs work] make it so escape make the introspection window in the notebook disappear to make it so escape make the introspection window in the notebook disappear
Note: See TracTickets for help on using tickets.