changeset 19270:eee862631953 gui-release

backing out cset 85b2d669c21e for applying a modified version at stable
author Torsten <ttl@justmail.de>
date Thu, 09 Oct 2014 18:10:19 +0200
parents 97eea1e2d9ff
children eb9b2160e878
files libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h
diffstat 2 files changed, 3 insertions(+), 86 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Tue Oct 07 14:37:17 2014 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Thu Oct 09 18:10:19 2014 +0200
@@ -99,23 +99,15 @@
   connect (_edit_area, SIGNAL (context_menu_edit_signal (const QString&)),
            this, SLOT (handle_context_menu_edit (const QString&)));
 
-  // create statusbar for row/col indicator and eol mode
+  // create statusbar for row/col indicator
   _status_bar = new QStatusBar (this);
 
-  // eol mode
-  _eol_indicator = new QLabel ("",this);
-  QLabel *eol_label = new QLabel (tr ("eol:"), this);
-  _eol_indicator->setMinimumSize (35,0);
-  _status_bar->addPermanentWidget (eol_label, 0);
-  _status_bar->addPermanentWidget (_eol_indicator, 0);
-
-  // row- and col-indicator
   _row_indicator = new QLabel ("", this);
   _row_indicator->setMinimumSize (30,0);
-  QLabel *row_label = new QLabel (tr ("line:"), this);
+  QLabel *row_label = new QLabel (tr ("Line:"), this);
   _col_indicator = new QLabel ("", this);
   _col_indicator->setMinimumSize (25,0);
-  QLabel *col_label = new QLabel (tr ("col:"), this);
+  QLabel *col_label = new QLabel (tr ("Col:"), this);
   _status_bar->addPermanentWidget (row_label, 0);
   _status_bar->addPermanentWidget (_row_indicator, 0);
   _status_bar->addPermanentWidget (col_label, 0);
@@ -1312,7 +1304,6 @@
   in.setCodec("UTF-8");
   QApplication::setOverrideCursor (Qt::WaitCursor);
   _edit_area->setText (in.readAll ());
-  _edit_area->setEolMode (detect_eol_mode ());
   QApplication::restoreOverrideCursor ();
 
   _copy_available = false;     // no selection yet available
@@ -1320,85 +1311,15 @@
   update_window_title (false); // window title (no modification)
   _edit_area->setModified (false); // loaded file is not modified yet
 
-  update_eol_indicator ();
-
   return QString ();
 }
 
-QsciScintilla::EolMode
-file_editor_tab::detect_eol_mode ()
-{
-  char *text = _edit_area->text ().toAscii ().data ();
-  int text_size = _edit_area->text ().length ();
-
-  char eol_lf = 0x0a;
-  char eol_cr = 0x0d;
-
-  int count_lf = 0;
-  int count_cr = 0;
-  int count_crlf = 0;
-
-  for (int i = 0; i < text_size; i++)
-    {
-      if (text[i] == eol_lf)
-        {
-          count_lf++;
-        }
-      else
-        {
-          if (text[i] == eol_cr)
-            {
-              if ((i < text_size -1) && text[i+1] == eol_lf)
-                {
-                  count_crlf++;
-                  i++;
-                }
-              else
-                count_cr++;
-            }
-        }
-    }
-
-  QsciScintilla::EolMode eol_mode = QsciScintilla::EolUnix;
-  int count_max = count_lf;
-
-  if (count_cr > count_max)
-    {
-      eol_mode = QsciScintilla::EolMac;
-      count_max = count_cr;
-    }
-  if (count_crlf > count_max)
-    {
-      eol_mode = QsciScintilla::EolWindows;
-    }
-
-  return eol_mode;
-}
-
-void
-file_editor_tab::update_eol_indicator ()
-{
-  switch (_edit_area->eolMode ())
-    {
-      case QsciScintilla::EolWindows:
-        _eol_indicator->setText (tr ("CRLF"));
-        break;
-      case QsciScintilla::EolMac:
-        _eol_indicator->setText (tr ("CR"));
-        break;
-      case QsciScintilla::EolUnix:
-        _eol_indicator->setText (tr ("LF"));
-        break;
-    }
-}
-
 void
 file_editor_tab::new_file (const QString &commands)
 {
   update_window_title (false); // window title (no modification)
   _edit_area->setText (commands);
   _edit_area->setModified (false); // new file is not modified yet
-  update_eol_indicator ();
 }
 
 void
--- a/libgui/src/m-editor/file-editor-tab.h	Tue Oct 07 14:37:17 2014 +0200
+++ b/libgui/src/m-editor/file-editor-tab.h	Thu Oct 09 18:10:19 2014 +0200
@@ -211,15 +211,11 @@
   void add_octave_apis (octave_value_list key_ovl);
   QString get_function_name ();
 
-  QsciScintilla::EolMode detect_eol_mode ();
-  void update_eol_indicator ();
-
   octave_qscintilla *_edit_area;
 
   QStatusBar *_status_bar;
   QLabel *_row_indicator;
   QLabel *_col_indicator;
-  QLabel *_eol_indicator;
 
   QString _file_name;
   QString _file_name_short;