Sublime Text 2 Lines too Far Right - indentation

I opened my laptop to code in Sublime Text 2 today, and every single file has it's starting indent line in the middle of the screen. I'm not sure what to call it, but, for example, this text box for my question starts my cursor for typing at the far left edge of the box.
This morning, that line is in the middle of the Sublime text editor. Instead of every line starting from the far left, their starting line is in the middle of the text editor window. It sounds small, but it bugs me quite a bit.
What setting is this? How can I get my normal indentation back?

Screenshot?
Anyway, what does this setting in your Preferences.sublime-settings say?
// Draws text centered in the window rather than left aligned
"draw_centered": false,

Find your sublime settings (in OSX it's the Sublime text 2- Preferences - Settings (default)) and find the "margin" value (default should be 4). Probably it's changed some how.

Related

Adding new lines and spaces to the old Qt PieMenu

I need to use the old Qt pieMenu, I know it's deprecated, But I've found the source code here, and the installations instructions here(they are in the zip file as well)
I've successfully compiled and ran the examples, but my problem is that I need to add spaces and manipulate the font in the text of the pie menu
for example in the editor.cpp example, these lines insert items to the pie menu with the first parameter as the displayed text :
markMenu->insertItem("Cut", this, SLOT(cut()));
markMenu->insertItem("Del", this, SLOT(del()));
markMenu->insertItem("Copy", this, SLOT(copy()));
I tried setting the lines like this as a test :
markMenu->insertItem("item cut", this, SLOT(cut()));
markMenu->insertItem(tr("Del item"), this, SLOT(del()));
markMenu->insertItem("test on item", this, SLOT(copy()));
and the results are like in the photo(everything after the space character is not displayed)
then I used the '\t' instead of using space directly, it worked as one space instead of a tab.
markMenu->insertItem("test\ton\titem", this, SLOT(copy()));
but when trying to add a new line to the text things didn't work right.
I tried using '\n' but didn't work for me.
Another issue, I was trying to change the font settings of the menu, I tried :
markMenu->setFont(QFont("Arial", 9, 5, true)); // size 9, weight 5, italic
but this didn't affect the font, I tried styleSheets as well but no success.
Any ideas how can I display the new liens and adjust the font of the text?
In the link provided by OP, scrolling to bottom, the source code can be found:
painter.drawText(center.x() + x
- metrics.width(itemText(i)) / 2,
center.y() + y, itemText(i));
Now, a look into the Qt doc. of QPainter::drawText() provides the explanation:
This function does not handle the newline character (\n), as it cannot break text into multiple lines, and it cannot display the newline character. Use the QPainter::drawText() overload that takes a rectangle instead if you want to draw multiple lines of text with the newline character, or if you want the text to be wrapped.
...and a possible fix as well. (Emphasize by me.)
As the source code is available, this can be fixed.
To achieve a proper pre-calculation of boundary rectangle, QFontMetrics can be used.
The answer to How to automatically increase/decrease text size in label in Qt shows an example for text boundary determining with QFontMetrics which even considers automatic word-wrapping.

How to keep the view format in notepad++ from simple notepad?

Been trying to get this one done for some time and couldn't find a solution.
The annoying issue I got is that when I open my x.txt notepad file everything is in line, organized, well arranged however when I do open it with notepad++ everything gets messed up. Here is a quick example (left notepad++/right notepad, same file) http://prntscr.com/9ypxcm
Some of the files get the same view format and style in both notepad and notepad++ (probably they were created originally in notepad++?) however some of my other text documents get really messed into notepad++ and I just hate simple windows notepad when it comes to text editing.
Would appreciate some help. Thank you
I just checked for How much spaces does a tab takes in both ?.
Notepad++ takes 4 spaces to constitute 1 tab.
Windows Notepad takes 6 spaces to constitute 1 tab.
Therefore when a file which is first edited in Windows Notepad ( 6 spaces-tab ) is opened in Notepad++, the tab is converted to 4 spaces reducing 2 spaces. That's why everything gets messed up
Solution
1) This is same file opened in two editors.
2) Now go as directed
Settings --> Preferences --> Tab Settings --> normal.
Uncheck the Use default value.
Click on Tab size. A small input box will appear.Input 6 as value and press Enter.
3) The tabs are now properly formatted.

How to Move selected text Left or Right

I can't believe I can't find a way in Webstorm that when you highlight code, then move it right or left as a group (tab left or right, moving it over left or right).
Is there a way to do this? I can't find one. I need to shift several lines of code in JSON to tab and make it read better from withing Webstorm as just one example. Most editors have this capability! unless I'm just missing it, this is a huge hole in Webstorm that is fundamental that is simply not there!
On top of this I've also noticed that if you put your cursor at the beginning of a line of code and then do Shift + Home to highlight the empty space before it, typically in most editors you can hit tab and start moving it back from the farthest point left back to right. In webstorm, when you highlight the empty space to the left of a starting line and hit tab, it starts tabbing from the the start of the line, not from the first empty space. I find this bizarre and very frustrating.
select a code region and hit Tab (Edit | Indent Selection) or Shift+Tab (unindent)

Making Dreamweaver more like Notepad++

I'm moving to Dreamweaver from Notepad++, and while Dw does have many better features than Notepad++, there are a few that I'm really missing.
Is there a way to make the "Home" key on the keyboard take you to the front of where the code starts, instead of the very front of the line? In Notepad++ this is how it works by default, and I don't know why anyone would want to go to the very front of the line instead of the front of the code. I use tabbing to keep it more organized, so this feature is really important to me.
How do I duplicate a line in Dw? In Notepad++ I can select the line and press ctrl + d and it automatically duplicated the code. This is awesome for something like a gallery or a table where I don't want to have to type out every line because it's so similar.
Less important, as I don't use this that often, but can you vertically select in Dw? In Notepad++ you can hold down alt and select lines vertically. Ex:
http://dl.dropbox.com/u/12147973/vert-select.jpg
Thanks in advance.
For #2, check out the Code Extras extension for Dreamweaver
No Longer works in DW5.5; Try here - http://yoropan.com/en/archives/544
I was also wanting some of this features... I discovered that, at least in CS6, #2 is already in Dreamweaver, but the shortcut is Ctrl+Alt+Down ou Up, depending on the direction that you wanna duplicate the code.
Note that I had to disable the shortcut that turns your screen view for that to work. (It's an intel default, press Ctrl+Alt+f12 to open the options)
And tãa dãaa... IT WORKS! :D
I want to say one thing different. My Dreamweaver theme (Users who use Dreamweaver after use Notepad++). Download Dreamweaver.xml
"Dreamweaver.xml" file is in here for windows: C:\Program Files\Notepad++\themes\Dreamweaver.xml
The answer to #1 = Ctrl+Home in anything in windows will take you to the absolute start of the documents, same as Ctrl+End, Home and End to start and finish of lines, Ctrl+Left or Right arrow to jump entire words...
I too am on the quest for duplicating lines in DW. #3 your image no longer shows.
If I want to duplicated a line I click on the line number, then CTRL+C to copy and CTRL+V to paste. Is that what you're looking for or am I being simple?

SAS Progam Editor on Unix

Is there a way to autoindent or a shortcut to insert a select number of spaces as a tab in the SAS Progam Editor on Unix?
I'm used to using the enhanced editor on PC and this is the only part of the switch that I can't find the answer to.
On the line numbers to the left of the code in the program editor, enter the >># command (replace # with a number) to indent '#' spaces to the right and <<# for shifting to the left. Enter these commands on the starting line and ending line. All rows inclusive between them will shift.
For a single line, ># or <#.
Without trying to start a flame-war... have you and your team considered NOT using the tab key in code? This way code always appears consistent regardless of editor/tab settings. Especially handy when you use a combination of vi/EG/SAS editor/notepad etc... I've worked at places that do this and it works great once you get everyone to agree to it.
When you open up existing code with tabs, just figure out how many spaces the tab is supposed to represent and do a search/replace.
It's still as fast to navigate quickly when you use, ctrl-left/ctrl-right in windows editors (and unix eds if setup that way), or 'w' and 'b' to jump to the next/previous word when using vi.
Cheers
Rob