[issue10415] readline.insert_text documentation incomplete
New submission from Justin Lebar <justin.lebar@gmail.com>: The readline documentation currently says:
readline.insert_text(string) Insert text into the command line.
But as far as I can tell, readline.insert_text() does something only when called from startup_hook or pre_input_hook. Here's an example of someone using the module in a way that works: http://swapoff.org/svn/cly/tags/0.7/cly/interactive.py ---------- assignee: docs@python components: Documentation messages: 121178 nosy: Justin.Lebar, docs@python priority: normal severity: normal status: open title: readline.insert_text documentation incomplete versions: Python 3.1 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue10415> _______________________________________
Justin Lebar <justin.lebar@gmail.com> added the comment: Actually, maybe startup_hook doesn't do what it sounds like it does and insert_text() only works from startup_hook. If this is the case, then the documentation for startup_hook could also be improved:
The startup_hook function is called with no arguments just before readline prints the first prompt.
---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue10415> _______________________________________
Éric Araujo <merwok@netwok.org> added the comment: Hi Justin, thanks for the report and patch. Would you like to turn your suggestion into a patch? Guidelines are at http://www.python.org/dev/patches/ ---------- nosy: +eric.araujo versions: +Python 2.7, Python 3.2 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue10415> _______________________________________
Matheus Portela added the comment: Apparently, the documentation was already changed to reflect the behaviour of startup_hook. Should this issue be closed? ---------- nosy: +Matheus.Portela _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue10415> _______________________________________
Berker Peksag added the comment: Documentations of insert_test and set_startup_hook functions are unchanged since 2007. See revision 9e1529bf0442 (warning, huge diff!). ---------- nosy: +berker.peksag versions: +Python 3.3, Python 3.4 -Python 3.1, Python 3.2 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue10415> _______________________________________
Matheus Vieira Portela added the comment: I could get readline.insert_text() to work, ish, without calling startup_hook. The script is attached to this message. Apparently, there is some need to call readline.redisplay() to update what's on screen. However, I can't really understand what's happening... The script prints "Testing text" only when the input has exactly one character. Also, by calling redisplay() after insert_text(), the string is not on the command line buffer, but already printed on screen. I should take a look on the GNU Readline Library documentation to understand better how it works. Anyway, I still think the documentation is unclear on these behaviours and should be updated. ---------- Added file: http://bugs.python.org/file34366/test_readline.py _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue10415> _______________________________________
Martin Panter added the comment: In Issue 6953, I updated the documentation to indicate which underlying Readline functions etc are accessed. So perhaps that helps, so the reader knows what function to look up in the Readline documentation. Other than that, I’m not sure what else to do. It would be more helpful to suggest an improvement, rather than just quoting the existing documentation back. ---------- nosy: +martin.panter stage: -> needs patch status: open -> pending _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue10415> _______________________________________
Berker Peksag added the comment: I agree with Martin. Closing this as 'out of date' for now, but we can reopen if you could provide more information. Thanks! ---------- resolution: -> out of date stage: needs patch -> resolved status: pending -> closed type: -> behavior _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue10415> _______________________________________
participants (6)
-
Berker Peksag
-
Justin Lebar
-
Martin Panter
-
Matheus Portela
-
Matheus Vieira Portela
-
Éric Araujo