Open Bug 890351 Opened 11 years ago Updated 11 years ago

SeaMonkey 2.19, in edit mode Delete(s) Columns only deletes one column, previous versions would delete columns even if they were not side by side.

Categories

(SeaMonkey :: Composer, defect)

defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: st-silvera, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0 SeaMonkey/2.19 (Beta/Release)
Build ID: 20130630011339

Steps to reproduce:

Selected 3 columns, 2 were side by side and one was a couple columns away.  Selected a cell in each in each column.


Actual results:

selected Delete column(s)


Expected results:

All 3 columns would be deleted.
Component: www.seamonkey-project.org → Composer
OS: All → Windows 7
Product: Websites → SeaMonkey
Hardware: All → x86
Version: unspecified → SeaMonkey 2.19 Branch
In Error Console, even when two cells in near columns selected
Error: An error occurred executing the cmd_DeleteColumn command: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsITableEditor.deleteTableColumn]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://editor/content/ComposerCommands.js :: nsDeleteTableColumnCommand.doCommand :: line 3527"  data: no]
Source File: chrome://global/content/globalOverlay.js
Line: 95
Code:
    var columns = GetNumberOfContiguousSelectedColumns();
    // Delete at least one column
    if (columns == 0)
      columns = 1;

    try {
      var editor = GetCurrentTableEditor();
      editor.beginTransaction();

      // Loop to delete all blocks of contiguous, selected columns
      while (columns)
      {
        editor.deleteTableColumn(columns);
        columns = GetNumberOfContiguousSelectedColumns();
      }
    } finally { editor.endTransaction(); }
    window.content.focus();
GetNumberOfContiguousSelectedColumns lives in editor.js
  var columns = 0;
  try {
    var editor = GetCurrentTableEditor();
    var colObj = { value: 0 };
    var rowObj = { value: 0 };
    var cell = editor.getFirstSelectedCellInTable(rowObj, colObj);
    if (!cell)
      return 0;

    // We have at least one column
    columns++;

    var lastIndex = colObj.value;
    do {
      cell = editor.getNextSelectedCell({value:0});
      if (cell)
      {
        editor.getCellIndexes(cell, rowObj, colObj);
        var index = colObj.value;
        if (index == lastIndex +1)
        {
          lastIndex = index;
          columns++;
        }
      }
    }
    while (cell);
  } catch (e) {}

  return columns;
So the idea is that only contiguous columns should be deleted, but this doesn't explain why it is falling even in two contiguous columns case. Anybody willing to fix?
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 7 → All
Hardware: x86 → All
Version: SeaMonkey 2.19 Branch → Trunk
All the above coding is Greek to me.  I sort of get along with Visual Basic.  Both row and columns used to work just fine. They did not have to be adjacent but, then in the earlier versions 2.xx they both stopped.  Rows eventually got fixed but not columns.
You need to log in before you can comment on or make changes to this bug.