Bug 184345 [Forms] ColumnLayout calculates number of columns incorrectly
In package org.eclipse.ui.forms.widgets, class ColumnLayout, method layout, I believe the number of columns is calculated incorrectly. This can cause the columns to be considerably wider than they should be. The line is: int ncolumns = (carea.width - leftMargin - rightMargin - horizontalSpacing) / (cwidth + horizontalSpacing); I think it should be: int ncolumns = (carea.width - leftMargin - rightMargin + horizontalSpacing) / (cwidth + horizontalSpacing); because the horizontalSpacing is only between columns, and not also on the outsides of the columns. (i.e. There are only ncolumns-1 horizontalSpacing's.) The derivation is: ncolumns * cwidth + (ncolumns-1) * horizontalSpacing = carea.width - leftMargin - rightMargin ==> ncolumns * cwidth + ncolumns * horizontalSpacing = carea.width - leftMargin - rightMargin + horizontalSpacing ==> ncolumns * (cwidth + horizontalSpacing) = carea.width - leftMargin - rightMargin + horizontalSpacing
bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ColumnLayout.java
Control child = children[i];
			Point csize = sizes[i];
			ColumnLayoutData cd = (ColumnLayoutData) child.getLayoutData();
			int align = cd != null ? cd.horizontalAlignment : ColumnLayoutData.FILL;
			int childWidth = align == ColumnLayoutData.FILL ? fillWidth : csize.x;
			if (i>0 && colHeight + csize.y > perColHeight) {
				heights[ncol] = colHeight;
				if (fillIn || ncol == ncolumns-1) {
					
					fillIn = true;
					ncol = findShortestColumn(heights);
					
					x = leftMargin + ncol * (fillWidth + horizontalSpacing);
				}
				else {
					ncol++;
					x += fillWidth + horizontalSpacing;
				}
				colHeight = heights[ncol];
			}
			if (colHeight > 0)
				colHeight += verticalSpacing;
			
			
			switch (align) {
				case ColumnLayoutData.LEFT :
				case ColumnLayoutData.FILL :
					child.setBounds(x, topMargin+colHeight, childWidth, csize.y);
					break;
				case ColumnLayoutData.RIGHT :