alt+q wrap_lines missing space before (, [ and {
Description of the bug
alt+q wrap_lines removes spaces before (, { and [, but I don't think it should. Personally, I always want to keep the space.
Steps to reproduce
ctrl+n, open the console and paste
view.settings().set('wrap_width', 80)
Then paste in the buffer
Lorem ipsum dolor sit amet, consectetur adipisicing elit
(quis
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eisumod (commodo
And press alt+q for each paragraph.
Expected behavior
Lorem ipsum dolor sit amet, consectetur adipisicing elit (quis
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eisumod
(commodo
Actual behavior
Lorem ipsum dolor sit amet, consectetur adipisicing elit(quis
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eisumod(commodo
Sublime Text build number
4169
Operating system & version
Ubuntu 22.04
(Linux) Desktop environment and/or window manager
Gnome
Additional information
No response
OpenGL context information
No response
It probably shouldn't in text scope, but in source it might be possible the parentheses defining a function argument list, which most likely is not separated with space from function name.
void
func_name
(int arg1, int arg2)
{ return arg1 + arg2; }
is most likely expected to become
void func_name(int arg1, int arg2) { return arg1 + arg2; }
Space in front of { should however be preserved, ideally.
So whether whitespace should be removed or not may not be simple to answer.
is alt+Q meant to be used on source code though?
Sure.
related report: https://forum.sublimetext.com/t/inhibit-removing-spaces-before-parentheses-when-wrapping-comments/73233
I have to set ruler to 78 instead of 80 with ST4180, but I can reproduce it. Space in front of column is removed, even though the whole line is not wrapped.
That kind of behavior is certainly a bug.
- Set syntax to C++
- Paste content from "before" block
- Set ruler to 78
- Hit alt+q
Before:
// The instruction buffer is a shift register with three 16-bit entries:
//
// * 2x 16-bit entries form the 32-bit current instruction register (CIR) which
// is the processor's decode window
//
After
// The instruction buffer is a shift register with three 16-bit entries:
//
// * 2x 16-bit entries form the 32-bit current instruction register(CIR) which
// is the processor's decode window
//