Notepad++ Multi-Editing - sublimetext2

I’m new around here and i wanted to know if there is possible to make multi-editing still work after you press ENTER OR TAB. It’s like this you go to line 5-6-7 and want to paste a line of code right after them by pressing enter and entering a new line or you want to move the lines 5-6-7 with tabs so they look nested to parent or in some other examples. (it runs perfectly in Sublime Text 2 )
I hope i was explicitly enough and straight to the point , sorry for misspelled words or bad english.
[EDIT] :
I wanted to add some pictures with the example but i need 10 reputation... I will try to explain once more . Notepad++ allows you to do multi-editing , it works perfectly to write inline continiously without pressing enter, if you press enter is going to enter a new line at the last position where you wanted to modify with multi-editing .
I am going to write an in-line example here:
<div id="1">
<div class="child-1"></div> <-[here is where i hold CTRL for multi editing]
</div>
<div id="2">
<div class="child-1"></div> <-[here is where i hold CTRL for multi editing]
</div>
So i want in both of parent divs [id=1 & id=2] after the div with class="child-1" to enter a new line [by pressing ENTER] and write something else like a new div with class="child-2" , but simultaneously in both of the parents.
<div id="1">
<div class="child-1"></div>
<div class="child-2"></div><-[this is how it should be ]
</div>
<div id="2">
<div class="child-1"></div>
<div class="child-2"></div><-[this is how it should be ]
</div>
[BUT UNFORTUNATELY IS GOING TO BE LIKE THIS ]
<div id="1">
<div class="child-1"></div>
</div>
<div id="2">
<div class="child-1"></div>
<div class="child-2"></div><-[this is how it is ]
</div>
This kind of thing happens too if you want to space more lines of code with TAB so they will look nested to their parrents.

Tab works for me with inline continuous editing by:
Settings -> Preferences -> Editing -> Multi-Editing Settings -> (check) Enable
Single left-click the first location for insertion
Hold Control + single left-click the second location for insertion
Tab, or type something then tab. Auto-completion will interrupt multi-line editing, so disable it as necessary for this operation.
Enter, by itself, exited multi-line editing for me as well. However, you mentioned "pasting" multiple lines, which did work for me. So I recommend preparing what you want to insert on another tab/doc, copy that with a new line at the beginning, ie. shown with chars:
CRLF
<div class="child-2"></div>CRLF
Switch to your destination tab, repeat steps 1 thru 3 above, and CTRL + V to paste.
Tested in Notepad++ v6.6.7 Build Jun 24 2014

Related

Selenium IDE clicking checkbox doesn't work after downloading file

Using the Selenium IDE in Chrome I am making a test for a process on a website.
I have a website, where I need to click a checkbox to accept the terms of use, privacy terms etc. after the login. I can check those boxes without a problem through Selenium, but I can't check the box for the client terms. I have to download those first, what works without a problem. Selenium then doesn't check the accept box though.
I am using the whole xpath and when I tell Selenium to show me the element in the website, it shows me the correct one. I copied the xpath directly out of Chrome. I'm using following command.
Command: click
Target: xpath=/html/body/div[1]/div[2]/main/div/div[3]/div[3]/div[3]/label
I also tried following other targets, none of them worked. Nevertheless Selenium always showed the right label when I clicked the option "Find Target in Page".
css=.terms-client label
xpath=//div[3]/div[3]/label
xpath=//label[contains(.,'Ich akzeptiere die Prüfungsbestimmungen')]
I tried check instead of click too, what didn't work. This is the HTML-code of the affected element, after the client terms have been downloaded already.
<div class="terms-client card" ng-repeat="role in data.roles" style="">
<div class="header">Kandidat/-in: Elektroniker/in EFZ CH</div>
<div class="content">
<p ng-bind-html="(role.description || ('terms.client.terms'|trans))|nl2br">Bitte studieren Sie die Prüfungsbestimmungen sorgfältig.</p>
<span iv-ipa-dokument="role.url" btn-class="btn-fill" download-state="role.downloaded" btn-label="Bestimmungen herunterladen"><button ng-click="download(url)" class="btn btn-fill" ng-disabled="disabled"><i class="icon icon-check-square-o" ng-class="class"></i> Bestimmungen herunterladen</button></span>
</div>
<div class="accept">
<!---->
<input id="client-accept-0" class="checkbox-new client-accept ng-pristine ng-untouched ng-valid ng-empty" type="checkbox" ng-model="role.state" ng-disabled="!data.agb || role.accepted || !role.downloaded">
<label for="client-accept-0">Ich akzeptiere die Prüfungsbestimmungen</label>
<!---->
</div>
</div>
The label at the end is the part I would like to click. I don't understand why Selenium is able to check the other boxes and accept those terms, but not this one.
I noticed, the issue is, that the click stops working after downloading the terms. Before that it works.
I think the issue is the locator being used to locate the checkbox. With the information provided, I guess the click event isn't handled for the label used.
Instead of getting the XPATH of the label, you need to select the input tag of the checkbox you need to click.
In this case the xpath of the element to select should be :
//label[contains(.,'Ich akzeptiere die Prüfungsbestimmungen')]/../input
Clicking using this element selector should perform the intended click.
I didn't find a proper solution but a workaround. A simple reload of the page after the download managed to solve my issue.

contenteditable br / p / div weirdness

I create <div contenteditable="true"></div>
The behaviour I want is:
Enter key press = <p></p> around the text line
Shift-Enter keys press = <br/> after the text line
To get the behaviour I want in Firefox, I have tried creating the following "keypress" event:
function(ev) {
if (ev.keyCode == '13') {
document.execCommand('formatBlock', false, 'p');
document.execCommand('insertBrOnReturn',false,false);
}
return false;
}
but Firefox (as at 33.1.1) insists on inserting <br></br> on first enter (which then gets wrapped in my paragraph). I understand it to a degree when a line is empty however I do not understand why it is not removed as soon as a character is inserted into the new line.
For example, assume I type:
hello<enter>goodbye
into the editable field, I will end up with the following markup (using the above event handler)
<p>hello</p>
<p>goodbye<br></br></p>
The <br></br> does indeed disappear if I hit enter again but then I am left with the following markup
<p>hello</p>
<p>goodbye</p>
<p><br></br></p>
There are 2 problems with this:
Users will not necessarily hit the second enter, leaving "invisible" <br></br> after the goodbye
Alternatively users will hit the second enter and end up with an essentially redundant line containing <p><br></br></p>.
In fact the only way I can see to get
<p>hello</p>
<p>goodbye</p>
ie. what I want, is to to use the following sequence hello<enter>goodbye<enter><backspace> which seems patently ridiculous.
At this point I should say that I personally love Firefox as a browser and my strong preference is to keep using it, however for our business clean editing markup is critical, and in Chrome, using the above method (excluding insertBrOnReturn) produces the desired markup (the above keypress event function switches Chrome cleanly to use p rather than its standard div)
So I am in a difficult position, and I would welcome any input from other Firefox enthusiasts as to how the above can be achieved elegantly if indeed it is possible (please don't invest time providing complex hacks though as we are unlikely to use them - in my limited experience complexity is diametrically opposed to reliability)
thanks in advance for any help!
(PS - after working with this, I'm really not sure that the Chrome div implementation is any better - see comments below)

How do I change tab behavior when writing HTML markup?

I have Sublime Text 2. When I begin typing <d a dropdown suggests autocomplete for . Hitting enter will complete the tag and even add the ending tag </div> and place the cursor between the tags. Perfect. If I hit enter again twice, I get this setup:
<div>
|</div>
But now when I go up one row to the blank row in between and hit tab, instead of indenting on the line between the tags, the cursor jumps to the end of </div>.
What I can do is hit enter once when I have <div>|</div> and then hit left to return to the end of <div>and enter again to go to a new auto-indented line.
How do I get this auto-indentation behavior to work when hitting enter in the <div>|</div> situation?
The problem you are having is that when pressing tab your are moving to the next tab stop in the snippet. That is the expected behaviour.
Snippets are tools for helping you write code faster. Those snippets can have multiple cursor positions called tab stops. You move between those positions by hitting tab. So when you hit enter to create those lines, and then tab, you are moving the the next tab stop in that particular snippet.
Sublime Text allows for deep customisation. You could change your auto indent settings, or create your own snippet.
This snippet should do what you are after. Save this as div.sublime-snippet into your User folder (in the packages folder accessed from Preference > Browse Packages) .
<snippet>
<content><![CDATA[
<div>
$1
</div>$0
]]></content>
<tabTrigger>div</tabTrigger>
<scope>source.html</scope>
<description>My own div snippet</description>
</snippet>
After doing this, you will have a new option in that dropdown auto complete menu. Usually you will only have to write div then press tab and voila.

Find closing HTML tag in Sublime Text

I have a very long and very nested HTML document, where I need to quickly find the closing tag. How can I do this?
Try Emmet plug-in command Go To Matching Pair:
http://docs.emmet.io/actions/go-to-pair/
Shortcut (Mac): Shift + Control + T
Shortcut (PC): Control + Alt + J
https://github.com/sergeche/emmet-sublime#available-actions
There is a shortcut (Ctrl+Shift+A for Windows and Linux users, Command+Shift+A for Mac users) to select the whole block within the currently selected tag.
For example, if you pressed this while your text cursor was within the outer div tag in the code below, all the divs with class selected would be selected.
<div class='current_tag_block'>
<div class='selected'></div>
<div class='selected'></div>
<div class='selected'></div>
<div class='selected'></div>
</div>
As #frazer-kirkman mentioned in a comments you can also move your cursor to the start or to the end of the selected block by pressing either Left or Right button on a keyboard depending on your cursor's position
It's built in from Sublime Editor 2 at least. Just press the following and it balances the HTML-tag
Shortcut (Mac): Shift + Command + A
Shortcut (Windows): Control + Alt + A
None of the above worked on Sublime Text 3 on Windows 10,
Ctrl + Shift + ' with the Emmet Sublime Text 3 plugin works great and was the only working solution for me.
Ctrl + Shift + T re-opens the last closed item and to my knowledge of Sublime, has done so since early builds of ST3 or late builds of ST2.
Under the "Goto" menu, Control + M is Jump to Matching Bracket. Works for parentheses as well.
As said before, Control/Command + Shift + A gives you basic support for tag matching. Press it again to extend the match to the parent element. Press arrow left/right to jump to the start/end tag.
Anyway, there is no built-in highlighting of matching tags. Emmet is a popular plugin but it's overkill for this purpose and can get in the way if you don't want Emmet-like editing. Bracket Highlighter seems to be a better choice for this use case.
I think, you may want to try another approach with folding enabled.
In both ST2 and ST3, if you enable folding in User settings:
{
...(previous item)
"fold_buttons": true,
...(next item, thus the comma)
}
You can see the triangle folding button at the left side of the line where the start tag is. Click it to expand/fold. If you want to copy, fold and copy, you get all block.

Weirdness when clicking span elements

I have a FAYT input I'm checking. I type in the textbox, see the options unfold and click one of them. All this passes neatly but there is something in the process that fails because the selected category is not selected. (this feature works like a charm when you try it manually)
This is the outline of the drop down suggestions' html:
<div id="suggestions">
<span name="span1" onclick="selectByClick()" onMouseOver="changeColor()">text1<span/>
<span name="span2" onclick="selectByClick()" onMouseOver="changeColor()">text2<span/>
</div>
What I'm doing is:
sel.click('//div[#id="suggestions"]//span[2]')
Ideas what could be causing this?
ok got it:
sel.mouse_over(xpath)
sel.click(xpath)