3 #ifndef PYCONSOLE_ENHEDITOR_H_
4 #define PYCONSOLE_ENHEDITOR_H_
8 #include "PyConsole_Editor.h"
12 class PyConsole_EnhInterp;
15 * Enhanced Python editor handling tab completion.
17 class PYCONSOLE_EXPORT PyConsole_EnhEditor: public PyConsole_Editor
22 PyConsole_EnhEditor(PyConsole_EnhInterp * interp, QWidget * parent=0);
23 virtual ~PyConsole_EnhEditor() {}
27 * Signal emitted by the editor widget when the doc string should be updated.
28 * @param doc a HTML block with the formatted doc string.
29 * TODO: for now this signal is left uncaught.
31 void updateDoc(QString doc);
34 /** List of separators identifying the last parsable token for completion */
35 static const std::vector<QString> SEPARATORS;
37 /** Maximum number of completions shown at once */
38 static const int MAX_COMPLETIONS = 70;
40 /** Are we in completion mode */
43 /** String on which the dir() comamnd is executed */
44 QString _compl_before_point;
45 /** String on which the results of the dir() are matched */
46 QString _compl_after_point;
48 /** Cursor position when <TAB> is hit */
51 /** Are we currently pasting several lines */
52 bool _multi_line_paste;
54 /** Queue of lines being pasted */
55 std::queue<QString> _multi_line_content;
58 virtual void keyPressEvent ( QKeyEvent* event);
59 virtual void customEvent( QEvent* event);
60 virtual void mousePressEvent( QMouseEvent* event );
61 virtual void insertFromMimeData(const QMimeData * source);
63 virtual PyInterp_Request* createTabRequest( const QString& input );
64 virtual void handleTab();
65 virtual void handleBackTab();
66 virtual void clearCompletion();
67 virtual void formatCompletion(const std::vector<QString> & matches, QString & result) const;
68 virtual QString formatDocHTML(const QString & doc) const;
70 virtual void multilinePaste(const QString & s);
71 virtual void multiLineProcessNextLine();
74 void extractCommon(const std::vector<QString> & matches, QString & result) const;
78 #endif /* PYCONSOLE_ENHEDITOR_H_ */