bugGNU Octave - Bugs: bug #53032, Variable Editor: Leftover...

 
 

bug #53032: Variable Editor: Leftover debugging code in delete operation

Submitter:  Rik <rik5>
Submitted:  Wed 31 Jan 2018 10:40:14 PM UTC
   
 
Category:  GUI Severity:  2 - Minor
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 12 Feb 2018 08:45:56 PM UTC, comment #4: 

Closing as fixed since I think the debugging code is now removed and the unused parameter warnings were fixed with this changeset:


changeset:   24707:aaf7bcea71dd
user:        Kai T. Ohlhus <k.ohlhus@gmail.com>
date:        Wed Feb 07 11:34:13 2018 +0100
summary:     Silence build warnings about unused parameters.


Reopen or create a new report if I missed something.

John W. Eaton <jwe>
Group administrator
Fri 02 Feb 2018 06:59:43 PM UTC, comment #3: 

Another item for cleanup, when compiling I now get many warnings of this type


libinterp/octave-value/ov-base-scalar.cc:193:67: warning: unused parameter ‘fmt’ [-Wunused-parameter]
libinterp/octave-value/ov-base-scalar.cc: In instantiation of ‘std::__cxx11::string octave_base_scalar<ST>::edit_display(const float_display_format&, octave_idx_type, octave_idx_type) const [with ST = octave_int<long int>; std::__cxx11::string = std::__cxx11::basic_string<char>; octave_idx_type = long int]’:
libinterp/octave-value/ov-uint8.cc:79:62:   required from here


The issue seems to be in ov-base-scalar.cc which is included in all of the ov-*int*.cc files.

Rik <rik5>
Group administrator
Thu 01 Feb 2018 03:17:27 AM UTC, comment #2: 

Yeah, I added those comments and left the code because I really wasn't sure whether there was some reason for it.  I will take another pass through and see what else is obsolete and can be deleted now.

John W. Eaton <jwe>
Group administrator
Thu 01 Feb 2018 02:00:01 AM UTC, comment #1: 

FWIW, the code is in libgui/src/variable-editor.cc at line 1007.


void
variable_editor::delete_selected (void)
{
  QTableView *view = get_table_data (m_tab_widget).m_table;
  QString selection = selected_to_octave ();
  QList<int> coords = octave_to_coords (selection);

  if (coords.isEmpty ())
    return;

  bool whole_columns_selected
    = coords[0] == 1 && coords[1] == view->model ()->rowCount ();

  bool whole_rows_selected
    = coords[2] == 1 && coords[3] == view->model ()->columnCount ();

  emit command_requested (QString ("disp ('")
                          + QString::number (coords[0]) + ","
                          + QString::number (coords[1]) + ","
                          + QString::number (coords[2]) + ","
                          + QString::number (coords[3]) + "');");

  // Must be deleting whole columns or whole rows, and not the whole thing.

  if (whole_columns_selected == whole_rows_selected)
    return;

  if (whole_rows_selected)
    view->model ()->removeRows (coords[0], coords[1] - coords[0]);

  if (whole_columns_selected)
    view->model ()->removeColumns (coords[2], coords[3] - coords[2]);

  emit updated ();
}


I think deleting the "emit command_requested" should fix this.

Also, if you search through this file for 'disp (' you find a number of FIXME notes like this one


void
variable_editor::columnmenu_requested (const QPoint& pt)
{
  QTableView *view = get_table_data (m_tab_widget).m_table;

  int index = view->horizontalHeader ()->logicalIndexAt (pt);

  // FIXME: What was the intent here?
  // emit command_requested (QString ("disp ('")
  //                         + QString::number (index) + "');");


I think the intent was just to have some debug information.  If the interface is working these FIXME notes could be deleted.

Rik <rik5>
Group administrator
Wed 31 Jan 2018 10:40:14 PM UTC, original submission:  

At least, I think that is what is happening.  If I delete a column or a row in the Variable Editor a disp() statement is displayed and executed.  I assume this was the equivalent of printf debugging during the original coding.

Steps to Reproduce:


x = magic (3)
openvar x
# Select second column, Right-Click and choose Delete Column


The column is successfully deleted, but back in the Command Window there is this:


disp ('1,3,2,2');

1,3,2,2



Rik <rik5>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-02-12 jwe StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2018-02-02 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code