[New-bugs-announce] [issue42239] IDLE: Restore calltip when needed

Terry J. Reedy report at bugs.python.org
Mon Nov 2 00:24:17 EST 2020


New submission from Terry J. Reedy <tjreedy at udel.edu>:

If one types 'int(' an int calltip is displayed.  If one adds 'float(' then the float calltip is displayed instead.  If one adds '"3.1")', the int calltip is restored.  (Actually a new int calltip.)  Finally, if one closes with ')', the int calltip is removed.

If, after 'int(', one adds instead 'f(', where f has no accessible signature or docstring and hence no calltip, the int calltip is dropped with no replacement.  When f is closed, the int calltip is not restored because open_calltip in

    def refresh_calltip_event(self, event):  # Bound to ')'.
        if self.active_calltip and self.active_calltip.tipwindow:
            self.open_calltip(False)

is not called because there is no existing calltip.

This issue is about somehow having the int calltip after the f call.  Possibilities.

1. Do not drop the int calltip when an inner call has none.

2. Give the inner call a fake calltip, something like "f(<unknown>".  Again, revise open_calltip.

3. Drop the outer calltip and set a 'nested_call flag in open_calltip and test it with 'or' in refresh_calltip_event (and unset the flag -- conditionally?) to restore it.

4. Add a calltip stack and test it for not empty in refresh_calltip_event. 

Tal, any opinions on the desired behavior.  I believe the #40511 revision should make any of the above, with 1 and 2 being easiest and safest.  A problem with 3 and 4 is that the text cursor can be moved out of the call and the calltip closed without the call being completed with ')'.

I want to add more tests first.

----------
assignee: terry.reedy
components: IDLE
messages: 380180
nosy: taleinat, terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE: Restore calltip when needed
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42239>
_______________________________________


More information about the New-bugs-announce mailing list