Mercurial > octave
changeset 27638:95534a0ad14c
eliminate redundant loop over tabs in file_editor::handle_file_remove
* file-editor.cc (file_editor::handle_file_remove): Don't loop over
map from filenames to tab info to search for the widget we already
found.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 05 Nov 2019 00:27:53 -0500 |
parents | d16336646e18 |
children | a18081db8fa3 |
files | libgui/src/m-editor/file-editor.cc |
diffstat | 1 files changed, 7 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc Tue Nov 05 00:25:23 2019 -0500 +++ b/libgui/src/m-editor/file-editor.cc Tue Nov 05 00:27:53 2019 -0500 @@ -1058,21 +1058,13 @@ if (editor_tab) { - // YES: Get and store the related encoding - for (editor_tab_map_const_iterator p = m_editor_tab_map.begin (); - p != m_editor_tab_map.end (); p++) - { - if (editor_tab == p->second.fet_ID) - { - // Get index and line - f_data.encoding = p->second.encoding; - f_data.index = m_tab_widget->indexOf (editor_tab); - int l, c; - editor_tab->qsci_edit_area ()->getCursorPosition (&l, &c); - f_data.line = l + 1; - break; - } - } + // Get index and line. + + f_data.encoding = editor_tab->encoding (); + f_data.index = m_tab_widget->indexOf (editor_tab); + int l, c; + editor_tab->qsci_edit_area ()->getCursorPosition (&l, &c); + f_data.line = l + 1; // Close it silently m_no_focus = true; // Remember for not focussing editor