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.
18 class PyConsole_EnhEditor: public PyConsole_Editor
23 PyConsole_EnhEditor(PyConsole_EnhInterp * interp, QWidget * parent=0);
24 virtual ~PyConsole_EnhEditor() {}
28 * Signal emitted by the editor widget when the doc string should be updated.
29 * @param doc a HTML block with the formatted doc string.
30 * TODO: for now this signal is left uncaught.
32 void updateDoc(QString doc);
35 /** List of separators identifying the last parsable token for completion */
36 static const std::vector<QString> SEPARATORS;
38 /** Maximum number of completions shown at once */
39 static const int MAX_COMPLETIONS = 70;
41 /** Are we in completion mode */
44 /** String on which the dir() comamnd is executed */
45 QString _compl_before_point;
46 /** String on which the results of the dir() are matched */
47 QString _compl_after_point;
49 /** Cursor position when <TAB> is hit */
52 /** Are we currently pasting several lines */
53 bool _multi_line_paste;
55 /** Queue of lines being pasted */
56 std::queue<QString> _multi_line_content;
59 virtual void keyPressEvent ( QKeyEvent* event);
60 virtual void customEvent( QEvent* event);
61 virtual void mousePressEvent( QMouseEvent* event );
62 virtual void insertFromMimeData(const QMimeData * source);
64 virtual PyInterp_Request* createTabRequest( const QString& input );
65 virtual void handleTab();
66 virtual void handleBackTab();
67 virtual void clearCompletion();
68 virtual void formatCompletion(const std::vector<QString> & matches, QString & result) const;
69 virtual QString formatDocHTML(const QString & doc) const;
71 virtual void multilinePaste(const QString & s);
72 virtual void multiLineProcessNextLine();
75 void extractCommon(const std::vector<QString> & matches, QString & result) const;
79 #endif /* PYCONSOLE_ENHEDITOR_H_ */