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

Qt console: Fix _prompt_pos accounting on timer flush output. #4768

Merged
merged 1 commit into from Jan 8, 2014

Conversation

pankajp
Copy link
Contributor

@pankajp pankajp commented Jan 8, 2014

When output is appended to the frontend widget by the output
flushing timer, the _prompt_pos was not being modified accordingly.
This could cause incorrect prompt position resulting in apparent
freezing of the prompt in some circumstances.

Running the following file and then doing p.edit_traits() a couple
of times in the frontend and clicking the button shows the error
some times, when the prompt stops responding to enter and
backspace once the prompt pos exceeds the document's size.

from traits.api import *
from traitsui.api import *

class Problem(HasTraits):
  e = Button

  def _e_changed(self, content):
    print 'E CHANGED', content

  traits_view = View(
    Item('e'),
  )

p = Problem()
p.edit_traits()

I would also like this to be backported into 1.x branch, but i'm not sure of the procedure.

When output is appended to the frontend widget by the output
flushing timer, the _prompt_pos was not being modified accordingly.
This could cause incorrect prompt position resulting in apparent
freezing of the prompt in some circumstances.
@@ -2044,6 +2058,7 @@ def _show_prompt(self, prompt=None, html=False, newline=True):
there is not already a newline at the end of the buffer.
"""
# Save the current end position to support _append*(before_prompt=True).
self._flush_pending_stream()
Copy link
Member

Choose a reason for hiding this comment

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

I see you've also moved this call earlier within _show_prompt. Do you want to comment on that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yes, now that i think of it, the pending output should obviously be flushed before writing the new prompt. Not sure whether that needs any further explanation.

@takluyver
Copy link
Member

Thanks, we've discussed it in the office at Berkeley. We'll merge it, but we don't feel we understand that bit of the code well enough to be confident that it won't introduce other problems, so we're not going to backport it to 1.x at the moment.

takluyver added a commit that referenced this pull request Jan 8, 2014
Qt console: Fix _prompt_pos accounting on timer flush output.
@takluyver takluyver merged commit 0f818d1 into ipython:master Jan 8, 2014
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
…ting

Qt console: Fix _prompt_pos accounting on timer flush output.
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.

None yet

2 participants