Bug #65513 Edit > Format > Comment Selection double spaces the sql text
Submitted: 4 Jun 2012 20:57 Modified: 6 Jun 2012 23:47
Reporter: Kevin Dyer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S4 (Feature request)
Version:5.2.31 OS:Any
Assigned to: CPU Architecture:Any
Tags: comment, format, UI

[4 Jun 2012 20:57] Kevin Dyer
Description:
Edit > Format > Comment Selection double spaces the comment which is unnecessary and unexpected.

Feature originally added here:
http://dev.mysql.com/doc/workbench/en/wb-news-5-2-31.html
Edit, Format, Un/Comment Selection was added. (Bug #55278, Bug #11762657)

How to repeat:
Any sql such as

SELECT
    ValueA,
    ValueB
FROM
    SomeTable
WHERE
    ValueC > 3
;

Use Edit > Format > Comment Selection and you will get

-- SELECT

--     ValueA,

--     ValueB

-- FROM

--     SomeTable

-- WHERE

--     ValueC > 3

-- ;

Perhaps there is a good reason why this was done but I have searched and found no answers.

Suggested fix:
Do not insert double new lines i.e.

-- SELECT
--     ValueA,
--     ValueB
-- FROM
--     SomeTable
-- WHERE
--     ValueC > 3
-- ;

Alternatively:

# SELECT
#     ValueA,
#     ValueB
# FROM
#     SomeTable
# WHERE
#     ValueC > 3
# ;
[4 Jun 2012 23:43] Alfredo Kojima
Please try with a more recent version.
[6 Jun 2012 23:47] Kevin Dyer
Fixed by 5.2.40. I didn't realise how old my version was.