Set position of status message in SublimeText 3 - sublimetext3

There is sublime.View.set_status method which adds message to status bar.
Is there a way to set position of that message? E.g. I'd like to have it on the right, before count of misspelled words, not on the left where Sublime adds it.

There is (after a fashion) a method of being able to specify where in the user addressable portion of the status bar the items you add will fall, but the key part there is user addressable.
In particular, all items that can be added to the status bar by a plugin are always to the left of the standard status bar items such as Line 1, Column 1 and it's only in that left side area that it's possible to specify where the status item is added.
As such you can't place anything to the right of the standard position text or the spell checker's indication of how many words are misspelled.
Within the user addressable part, the status items that view.set_status() adds to the status bar are ordered according to the key value that you use when you set the key.
So for example view.set_status("AAAAA", "Something") will appear on the left and view.set_status("ZZZZZ", "Otherthing") will appear on the right.
This is only partial control since any plugin can add items to the status bar and it's impossible to know what other plugins might be adding items and what key they will use.
I would presume that the ordering is done this way so that even though it's not possible to know with certainty exactly where the item is added, it's still done in a way that's repeatable so that for the user certain items are always in the same relative position while they're working.
This may be why the status bar items for core features such as the count of misspelled words are always placed in known positions.

Related

Sublime Text: How can I disable auto scrolling while I'm typing in the Find box?

I am currently trying to write a complex regex for a huge file. Every time I type in the find input box to make a small change, Sublime scrolls me either to the top of the document or to a semi-random location (from what I can remember, it doesn't always scroll to the first match), even when there are matches where I'm already scrolled to in the file. It makes for a pretty painful workflow: I write down the line number on a piece of paper, edit my regex, and then have to "go-to" back to the line I was already at. How can I prevent this, or at the very least, does anybody know why exactly this is happening in the first place?
This is controlled by the Highlight Matches button in the Find and Find and Replace panels, and causes Sublime to show you all of the matches, highlighting one of them and outlining the remainder in a region to show you where they are.
The visual appearance of the button is controlled by the theme you use, but it's always in this position in the panel (and it should have the same icon in all other find panels as well); it also has a tooltip that tells you the name.
When the search term is modified and this option is turned on, Sublime jumps to a match, though this doesn't occur if the panel opens with an existing search term already in it; in that case matches are highlighted but the view doesn't change.
The option also exists in Incremental Find panel as well, but turning it off there only stops other matches from being highlighted as by definition Incremental Find is for jumping to a search term incrementally as you modify it.

Change the length of selected text lines sublime text 3?

Is there a way to split selected long text into multiple shorter lines?
For example: from this
French President Emmanuel Macron said France will not accept text that does not mention the historic Paris accord.
"If we don't talk about the Paris agreement and if we don't get an agreement on it among the 20 members in the room, we are no longer capable of defending our climate change goals and France will not be part of this," he said on Wednesday.
France was one of the main drivers behind the Paris accord and the French parliament is now debating an energy bill that targets net zero greenhouse gas emissions by 2050.
"Negotiations on the topic of climate will be especially difficult this time," a German government official said.
to something like this
French President Emmanuel Macron said France will not accept text that does not
mention the historic Paris accord.
"If we don't talk about the Paris agreement and if we don't get an agreement on
it among the 20 members in the room, we are no longer capable of defending our
climate change goals and France will not be part of this," he said on
Wednesday.
France was one of the main drivers behind the Paris accord and the French
parliament is now debating an energy bill that targets net zero greenhouse gas
emissions by 2050.
"Negotiations on the topic of climate will be especially difficult this time,"
a German government official said.
There are two ways to do something like this, depending on whether you want to leave the text alone and be able to read long lines or if you want to physically modify the file.
Soft Wrapping
If you just want to view the text but leave it physically the same, then what you want is Word Wrapping. You can toggle the state of View > Word Wrap to turn wrapping on and off, and the options in View > Word Wrap Column specify where the wrapping will occur. Automatic chooses the edge of the window, or you can specify a specific column for the data to wrap on.
This is Soft Wrapping; you'll notice that the lines in the gutter do not correspond 1:1 with the actual lines because there is one physical line but several logical lines (Here the wrap setting is set to Automatic):
The word wrap state is controlled by the word_wrap setting in the default preferences; that determines what the default wrap state is. Changing the wrap from the menu will change it only for the file that you're currently editing, so if you want to change the state permanently, you should change that setting.
Additionally, the wrap_width setting controls where the soft wrap happens, with 0 (the default) being the width of the window (i.e. the Automatic setting in the menu). The menu items under View > Word Wrap Column change the value of this setting to specific values, but you can set any value you like in your preferences.
Hard Wrapping
If you want to physically modify the text, then you want the options in the Edit > Wrap menu instead. Here you can select text to have all of it wrapped, or just put the cursor inside of a paragraph to have only that one paragraph wrapped.
You have the option of wrapping at specific columns or at the current ruler, which you can specify in View > Ruler.
When done in this manner, the content of the file is physically modified (Here I chose the option to wrap at column 70 and turned the soft wrapping from above off):
The position of the ruler (or rulers; you can have more than one) is controlled by the rulers setting, which by default is empty. The menu item above sets the ruler in the current file to the value shown in the menu item, but you can set the rulers setting to anything you want. As above, the defaults for the settings are in your Preferences file and the menu items only change the state for the current file, so you need to modify your preferences to set a permanent value.
It's also worth nothing that the menu items that wrap at specific columns use the wrap_lines command with a specified width argument, so if desired you can craft a custom key binding that would wrap at any position you want.

UIKeyboardFrameBeginUserInfoKey/UIKeyboardFrameEndUserInfoKey: what is the difference?

It is possible to read the following in the apple Documentation:
UIKeyboardFrameBeginUserInfoKey
The key for an NSValue object containing a CGRect that identifies the start frame of the keyboard ……
UIKeyboardFrameEndUserInfoKey
The key for an NSValue object containing a CGRect that identifies the end frame of the keyboard ……
Would that mean that the keyboard has a "start frame" and an "end frame"?
I suppose YES.
But when the keyboard appears I cannot see any frame changing. It just stays the same frome start to end.
So my question is:
What are those "start frame" and "end frame" referring to?
I must be missing something.
Thanks for your help.
The keyboard does indeed have a start and end frame, and the properties do exactly what you suppose they do. They keyboard does not always animate however; sometimes it just appears or changes size. For example, in the case that you are typing on the Japanese keyboard, when the keyboardWillShow fires after the first character is hit. There's no animation, but an additional bar appears above the keyboard, thus changing the size. The properties you listed above tell you how much the keyboard changed size by.
I'm not sure what exactly you're looking at when you say no frames are changing. I suppose it's possible that when you move from one editable text field to another, you get a keyboardWillShow notification, even though nothing on the screen changes.

When two CCMenuItem overlaps each other, is it possible to prioritise one over the other?

I have 2 CCMenuItems A and B
A is a screen-wide transparent button
and B is an actual button that is set to visible when A is touched
Currently, when I'm touching B, A responds with it's selector method and basically B does not respond because the touch is 'taken' by A's selector.
I need B to be responding even though A is a screen-wide button so- Is it possible to prioritise B's selector when it is pushed?
To summarize, I'm toggling B's visibility via A and would like to be able to use B when it is visible.
Is this possible? How can it be done?
for me worked adding one menu in one layer and another menu in other layer
I)
Yes, You can prioritize your CCMenuItems by setting Z-Order.
First button that gets touch is the button with lowest Z-Order.
II)
And if you want to prioritize your CCMenus, you need to setTouchPriority(..) them.
The less priority you give, the earlier your CCMenu will handle the touch. (CCMenu's default value is -128 ).
Either you can set the buttons yourButton.isEnabled to NO or you can just move the A-button off the scene when you don't want it to take input.
It's possible to use an additional CCMenu with a higher z-order for the button B.

What is the best way to layout/design a long complex web form to collect user input

I need to design a web form which landlords can use to add rental listings. There are 8 mandatory text boxes and 2 optional text boxes, 11 drop-down lists, 12 checkboxes and one large text area. Any suggestions about how to arrange them in a way that is clean, and uncluttered? My concern is, if the form looks lengthy, they may not want to fill it. So far I have divided the elements on the page into sections, however the page still looks cluttered.
I would suggest that you use 2 pages instead of 1. On the first page, show the 8 mandatory text boxes and follow them with an additional checkbox which makes the 2 optional text boxes appear on being clicked. This means that the user will opt-in for the optional checkboxes making it more acceptable and natural to her. Next, place a submit button which would take the user to the second page.
Put all the 12 checkoxes and the text area on the second page. On page 2, tell the users very clearly that this is the last page they need to fill. They will be less disinclined now since all they need to do is to place a few more clicks.
You may want to split the process of getting all of this data from the user into multiple parts. Conventionally, that would be multiple pages of forms. The problem with that is that it's annoying for the user to have to watch their browser reload the whole page as they move through the form.
A more popular methodology now is to use AJAX to present the larger form in multiple pieces without having to reload the entire page.
In both cases you will need to keep state between each page load or AJAX request so that the back button behaves sanely and the user's previous input reappears as they move backwards (and forwards) through the form.
Unless you have some kind of nifty state-keeping mechanism already written that is generic enough to work for any given form set you may decide to use, welcome to the pain in the ass that is web development.
How about a wizard-style layout?
Break the sections out into separate pages, so components are submitted separately. Make it clear how many sections there are, and how far through the form the user is. Be careful to track the user's progress either in the session, or by keeping state in the form.
This approach makes giving error messages a bit less threatening to users (you never show them the error message "Please correct the following 34 errors").
Edit: Having seen the current form layout, I actually think what you've got at present is very clear, and nicely done.
Do submitters have account profiles that you can use to populate the contact details? If so, I would drop the contact details from the form for creating a listing, and add a review screen that shows all of the information, and gives links for specifying alternative contact details or amending other information. Users then see one screen, plus a review screen with a big "Publish This Listing" button. Amazon's order process uses a good review screen.
Breaking the input into multiple sections is a good idea.
I also like to make most of the input fields invisible, and make them visible as more information is entered. I start with the most important info to be entered first (e.g., name), and as each item is entered, I make further input fields visible. I also give focus to the next logical field that the user is expected to enter as he goes along.
You can use other tricks like highlighting the next field to enter (i.e., changing the background color or surrounding borders of the input field label) to make it even more obvious to the user.
Grouping related fields into separate boxes (with visible borders) may make the info seem less cluttered, too.
This approach makes it look less overwhelming to the user, and makes it more obvious to him what he needs to enter, from start to finish.
Frankly, 33 fields on a single page does not sound all that long for describing a rental listing, especially when 23 of the fields (checkboxes and dropdowns) can default to the most common values. With your current layout, the form almost all fits above the fold. That ain’t bad.
I’d be very cautious about splitting it into separate pages (e.g., as a wizard). First of all, that will take the user longer, because now you’re adding navigation and re-orientation time. Second of all, it will seem to take longer; the user will be like, “Geez, I have fill out a multi-page form?” Thirdly, users can’t tell how much work is expected of them when some of it is hidden on other pages (or by AJAX tricks). Some will not fill out the form at all assuming the worse. Others will abandon it part-way through because they either didn’t plan enough time for it, or just got tired of hitting Next indefinitely. You can mitigate this last problem by saying up front how many pages there are, and showing the user’s progress through them, but that just accentuates the fact that it’s multi-page, and therefore “long.”
IMO, all it needs is some lighter graphic design. I’d drop the “reverse video” section titles and the green background on alternating sections and make it all white. Use color and/or bold text for the section titles. You can combine the Property Description section label with the field label to reduce clutter and redundancy. Consider putting the Pets and Parking fields on the same line as Laundry then spreading the Unit Details fields out vertically so the mis-alignment of the fields is not so noticeable. Alternatively, size the Unit Detail fields so that they are better aligned. Maybe you can drop the “How do you want to be contacted?” field. I’d expect that if users don’t want to be contacted by one of the means, they simply don’t fill out that field.
Other than that, be sure your users understand the importance of these fields –why filling them out helps them find the right renters. Users don’t mind filling out a lot of fields if it’s clear that each benefits them. It’s when users feel like they're disclosing a lot of data to benefit you that they get resentful and reluctant. The importance of the fields you have seems self-evident to me, but maybe you should include a link that explains the purpose and value of the fields.
Finally, make sure there’s not too much clutter and competition from the “standard” page elements (e.g., sidebar menus, legal information).

Resources