Mercurial > hg > octave-nkf
diff libgui/src/m-editor/file-editor-tab.cc @ 16375:f482302d81c9
editor goto line menu item (bug #38590)
* file-editor-tab.h,file_editor_tab.cc (file_editor_tab::goto_line):
New function.
* file-editor.h, file-editor.cc (file-editor::request_goto_line):
New function.
(file_editor::request_goto_line): New function.
(file_editor::construct): New goto_line_action QAction. Include it in
edit menu.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Wed, 27 Mar 2013 00:44:04 -0400 |
parents | e0df71fbe39b |
children | 8430ea8c1594 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -41,6 +41,7 @@ #include <QMessageBox> #include <QTextStream> #include <QVBoxLayout> +#include <QInputDialog> #include "file-editor-tab.h" #include "file-editor.h" @@ -628,6 +629,25 @@ } void +file_editor_tab::goto_line (const QWidget* ID) +{ + if (ID != this) + return; + + int line, index; + + _edit_area->getCursorPosition(&line, &index); + + bool ok = false; + + line = QInputDialog::getInt (_edit_area, "Goto line", "Line number", + line+1, 1, _edit_area->lines(), 1, &ok); + if (ok) + _edit_area->setCursorPosition (line-1, 0); +} + + +void file_editor_tab::do_comment_selected_text (bool comment) { if ( _edit_area->hasSelectedText() )