Mercurial > hg > octave-nkf
diff libgui/src/m-editor/file-editor-tab.cc @ 19437:f3c4b48f3c53 gui-release
add a preference for the default eol mode of new files (bug #43334)
* file-editor-tab.cc (new_file): get eol mode from the settings or from the OS;
(notice_settings): set visibility of eol chars depending on settings
* settings-dialog.ui: new checkbox for showing eol chars, new combobox for
the default eol mode
* settings-dialog.cc (constructor): init preferences for showing eol chars and
for the default eol mode from the settings;
(write_changed_settings): write these new preferences to the settings files
author | Torsten <ttl@justmail.de> |
---|---|
date | Sat, 11 Oct 2014 11:05:53 +0200 |
parents | 05d8e71d20cb |
children | 9582fad68730 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -1396,9 +1396,28 @@ file_editor_tab::new_file (const QString &commands) { update_window_title (false); // window title (no modification) + + QSettings *settings = resource_manager::get_settings (); + + // set the eol mode from the settings or depending on the OS if the entry is + // missing in the settings + QsciScintilla::EolMode eol_modes[] = + {QsciScintilla::EolWindows, QsciScintilla::EolUnix, QsciScintilla::EolMac}; + +#if defined (Q_OS_WIN32) + int eol_mode = QsciScintilla::EolWindows; +#elif defined (Q_OS_MAC) + int eol_mode = QsciScintilla::EolMac; +#else + int eol_mode = QsciScintilla::EolUnix; +#endif + _edit_area->setEolMode ( + eol_modes[settings->value("editor/default_eol_mode",eol_mode).toInt ()]); + + update_eol_indicator (); + _edit_area->setText (commands); _edit_area->setModified (false); // new file is not modified yet - update_eol_indicator (); } void @@ -1735,6 +1754,9 @@ else _edit_area->setWhitespaceVisibility (QsciScintilla::WsInvisible); + _edit_area->setEolVisibility ( + settings->value("editor/show_eol_chars",false).toBool ()); + if (settings->value ("editor/showLineNumbers", true).toBool ()) { _edit_area->setMarginLineNumbers (2, true);