diff libinterp/octave-value/ov-cell.cc @ 24655:3ceee1910e1a

allow single character strings to be edited (bug #51848) * variable-editor-model.h, variable-editor-model.cc (get_quote_char): New function. (variable_editor_model::quote_char, variable_editor_model::impl::quote_char): New functions. (variable_editor_model::subscript_expression): New overload. Handle cells and strings. (variable_editor_model::set_data_oct): Don't pass name as argument. Change all uses. Handle character strings. (get_rows_and_columns): Special case for strings. (variable_editor_model::impl): Special case for strings. (variable_editor_model::impl::value_at): New overload. (variable_editor_model::type_is_editable): Handle strings. * ov-str-mat.h, ov-str-mat.cc (octave_char_matrix_str::edit_display): New function. * ov-cell.cc (octave_base_matrix<Cell>::edit_display): Don't handle special cases here.
author John W. Eaton <jwe@octave.org>
date Tue, 30 Jan 2018 17:18:01 -0500
parents ef60416c4686
children d4dd741b2794
line wrap: on
line diff
--- a/libinterp/octave-value/ov-cell.cc	Tue Jan 30 13:23:07 2018 -0500
+++ b/libinterp/octave-value/ov-cell.cc	Tue Jan 30 17:18:01 2018 -0500
@@ -106,15 +106,10 @@
 {
   octave_value val = matrix(i,j);
 
-  if (val.numel () == 1 && (val.isnumeric () || val.islogical ()))
-    return val.edit_display (0, 0);
-  else
-    {
-      std::string tname = val.type_name ();
-      dim_vector dv = val.dims ();
-      std::string dimstr = dv.str ();
-      return "[" + dimstr + " " + tname + "]";
-    }
+  std::string tname = val.type_name ();
+  dim_vector dv = val.dims ();
+  std::string dimstr = dv.str ();
+  return "[" + dimstr + " " + tname + "]";
 }
 
 template <>