How to cut/paste a line in WebStorm, keeping indentation? - indentation

I started using Webstorm, and I can't figure out to how cut/paste a line keeping the exact same indentation.
In Jade file:
.something
ul
li
label -->Cut this line<--
li
label some text
I put the cursor at the beginning of the above-specified line. Then, Edit -> Cut and Edit -> Paste. I end up with:
.something
ul
li
label -->Cut this line<--
li
label some text
I want the indentation to be exactly the same as before. How do I achieve this?
I tried all the options in Preferences -> Editor -> General -> Smart Keys -> Reformat on paste and none of them made any difference.

Yes, you can change the settings so that it doesn't alter the formatting when you paste.
File > Settings > Editor > General > Smart Keys .. then look for the 'Reformat on paste:' and select None from the drop-down.

When editing Jade, on pasting a code block the position of the 'top' element in pasted fragment is equal to current cursor position, other elements are indented to the same level relative to top element as in original fragment. So you have to make sure to put cursor not at the beginning of line, but at the desired position... For example, hit Enter after <li> and then paste

use Ctrl+Shift+Alt+V for simple paste
https://www.jetbrains.com/help/webstorm/2016.1/cutting-copying-and-pasting.html?origin=old_help

Related

How can I define the spacing following a paragraph in prawn pdf?

I'm rendering texts in a prawn pdf report and would like to define the exact spacing after a paragraph.
I found :leading, which helps to define the line height, but nothing to define the spacing after a new paragraph (within the same cell or bounding box).
So far I have not found out how to define the spacing as such, but I still think I found the problem why the space was too large.
I add the statement
puts content.dump
to my class to print the content on the console.
In the cases where I had a paragraph in the content, the paragraph was replaced by \n\n.
Example:
<p>Text</p><p>Text</p>
is changed to
"Text\n\nText\n\n"
As I anyway use an html sanitizer method to remove undesired html tags, I could extend the method with the following:
res = content.gsub(/\n{2,2}/, "\n")
res = res.gsub(/\n{3,}/, "\n\n")
This solved the problem for me.

Search while selection enabled in macro VS2015

On VAX/VMS (or OpenVMS Alpha and its other names) there was an editor called TPU. In TPU you could enable selection of text independently of holding a key down. You pressed SELECT and then any cursor movement you made selected text between the editing point and the new cursor location.
You could also record macros. So you could use this text selection feature to create macros like:
find "abc"
select
find "xyz"
cut
stop recording
So this macro would find any line with "abc" in it and then cut all text between "abc" and "xyz". Massive time saver.
Making sense? How can I do that in VS2015? I can't find a macro extension that provides the selection behaviour I need to do this.
Cheers,
.pd.
EDIT
It occurred to me this could be done with a regex but it seems like a pretty big ask.
#Html.DropDownListFor(m => m.Property, Model.SelectListProperty, htmlAttributes: new { #class="whatever" })
// the regex would replace this with
#Html.MyDropDownListFor(m => m.Property, Model.SelectListProperty, Model.Property, htmlAttributes: new { #class="whatever"})
So I would be looking for a regex to
- find #Html.DropDownList
- replace the token 1 of that line split by ',' with token 1 of token 0 split by '.' and prefixed with "Model."
Assuming Model.Property comes from m => m.Property.
Search for
#Html\.DropDownListFor\(((\w+)\s*=>\s*\2\.(\w+)),\s*(Model\.\w+)(,(?:[^(){}]|\{[^{}]*\})*)?\)
Replace with
#Html.MyDropDownListFor($1, $4, Model.$3$5)
Demo: http://regexr.com/3f3io

EditBox Text Alignment using Cocos2d-x 3.2

I am using CCEditBox in the latest cocos2d-x 3.2 as textBox for user input.
now , i want to align text which i am typing in Textbox area , but it's always stays left align. i want to set it in the Center of my textBox.
I tried one Function named : setLabelAnchorPoint but it's not giving any effect to my label alignment. please help.
cocos2d::extension::Scale9Sprite *Playername_bgtemp = cocos2d::extension::Scale9Sprite::create("Name_bg.png");
auto _editName = EditBox::create(Size(1000,164), Playername_bgtemp);
Point absolutePosition = Point(ReferenceFrameSprite->getContentSize().width/2,4*ReferenceFrameSprite->getContentSize().height*0.20);
_editName->setPosition(absolutePosition);
_editName->setFontName("fonts/HelveticaLTStd-Cond_0.ttf");
_editName->setFontColor(Color3B::WHITE);
_editName->setLabelAnchorPoint(Vec2(0.0f,0.0f));
_editName->setPlaceHolder(" Name ");
_editName->setPlaceholderFontColor(Color3B::WHITE);
_editName->setPlaceholderFontName("fonts/HelveticaLTStd-Cond_0.ttf");
_editName->setMaxLength(10);
_editName->setReturnType(EditBox::KeyboardReturnType::DONE);
_editName->setFontSize(BgContentFontSize);
_editName->setDelegate(this);
bgFrameSprite->addChild(_editName,PopUpTag);
I did the trick with a text Label in the same position than the Editbox. I keep the Editbox with an empty string.
When start editing the edit box:
Hide the label.
Set the Editbox text with the label content.
When end editing the Editbox:
Set label text to Editbox content.
Show the label.
Set Editbox text to an empty string.

How to get dragged text position MFC

I'm trying to insert tag next to specific text.
I was get a knowhow to insert tag next to text..
It is to use Setsel() and ReplaceSel().
example,
char str = "< name >";
m_richedit.Setsel( position of start dragging of text, end position )
m_richedit.ReplaceSel( str, TRUE )
but, I don't know how to get position of start dragging of text in richEdit.
Is there anybody who has an idea?
Thank you.
You need to add the appropriate accelerator key like they explain here: Adding accelerators(shortcuts) in MFC - HOW? . Then in the handler of the accelerator key, use GetSelText, add your tags to the string you get and call ReplaceSel.

Infragistics Webdatagrid: Resize column to largest header/data cell contents

I am searching for a solution that changes the column width based on largest data content or header.
Solutions like
tbody.igg_Item > tr > td
{
white-space: nowrap !important;
}
does not work because the grid sets the column width based on the column header contents not the data, thus the data cell contents is not displayed in its full length.
e.g if content is "my test data content", I can only see "my test dat" because my header is not long enough.
My markup is:
<ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False" Height="350px"
Width="100%">
<ClientEvents MouseDown="GridMouseDown" />
<Behaviors>
<ig:Activation>
</ig:Activation>
<ig:ColumnResizing>
</ig:ColumnResizing>
<ig:Selection CellSelectType="Single">
</ig:Selection>
</Behaviors>
</ig:WebDataGrid>
I am adding the columns in code behind (I have not seen any DataColumn property that controls width)
The grid will automatically size the columns to the data portion of the grid if there is no width set on the column and the grid itself doesn't have a width. Note that you will need to put the grid in a container if you want a horizontal scroll bar and if using paging the pager will scroll with the columns.
I have a more detailed answer to this question here on StackOverflow. I also have this posted in the Infragistics forums here with a sample. I also have a modification of that example that allows wrapping of text in the header if there are multiple words with sample posted here.