Mercurial > octave
comparison 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 |
comparison
equal
deleted
inserted
replaced
24654:6daa29105d21 | 24655:3ceee1910e1a |
---|---|
104 octave_base_matrix<Cell>::edit_display (octave_idx_type i, | 104 octave_base_matrix<Cell>::edit_display (octave_idx_type i, |
105 octave_idx_type j) const | 105 octave_idx_type j) const |
106 { | 106 { |
107 octave_value val = matrix(i,j); | 107 octave_value val = matrix(i,j); |
108 | 108 |
109 if (val.numel () == 1 && (val.isnumeric () || val.islogical ())) | 109 std::string tname = val.type_name (); |
110 return val.edit_display (0, 0); | 110 dim_vector dv = val.dims (); |
111 else | 111 std::string dimstr = dv.str (); |
112 { | 112 return "[" + dimstr + " " + tname + "]"; |
113 std::string tname = val.type_name (); | |
114 dim_vector dv = val.dims (); | |
115 std::string dimstr = dv.str (); | |
116 return "[" + dimstr + " " + tname + "]"; | |
117 } | |
118 } | 113 } |
119 | 114 |
120 template <> | 115 template <> |
121 octave_value | 116 octave_value |
122 octave_base_matrix<Cell>::fast_elem_extract (octave_idx_type n) const | 117 octave_base_matrix<Cell>::fast_elem_extract (octave_idx_type n) const |