Mercurial > hg > octave-nkf
changeset 15988:38348a6c3db0
gui: initialize search text in the find dialog with selected text in editor file
* find_dialog.h: new function init_search_text ()
* find_dialog.cc (init_search_text): new function, initializes the search text
of the file dialog with the slected text of the related editor tab
* file-editor-tab.cc (find): call init_search_text after activating the find
dialog
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 31 Jan 2013 19:28:23 +0100 |
parents | 47a4c92924a7 |
children | afc4e08f2143 |
files | libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/find-dialog.cc libgui/src/m-editor/find-dialog.h |
diffstat | 3 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -624,6 +624,8 @@ } _find_dialog->activateWindow (); + _find_dialog->init_search_text (); + } void
--- a/libgui/src/m-editor/find-dialog.cc +++ b/libgui/src/m-editor/find-dialog.cc @@ -130,6 +130,21 @@ _extension->hide (); } + +// initialize search text with selected text if this is in one single line +void +find_dialog::init_search_text () +{ + if (_edit_area->hasSelectedText ()) + { + int lbeg, lend, cbeg, cend; + _edit_area->getSelection(&lbeg,&cbeg,&lend,&cend); + if (lbeg == lend) + _search_line_edit->setText (_edit_area->selectedText ()); + } +} + + void find_dialog::search_next () {