Word wrap in WebStorm - settings

Which position in WebStorm settings responds for word wrap/line break? In VSCode it's easy: Alt + Z
When line is so long, and in code editor displays like:
1 Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Blanditiis cumque debitis
deleniti distinctio dolor doloribus.
2 Lorem ipsum dolor sit amet.
3 Lorem ipsum dolor sit amet.
I used section Settings -> Editor -> General -> Soft wraps, but nothing changed.

Related

iText 7 - Justify align text and paragraphs

I'm trying to justify align a block of text, however getting inconsistent results using iText7
Here my block of text stored in a database:
<p style="text-align: justify;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
Here is my code:
List<IElement> lst = HtmlConverter.ConvertToElements(dt.Rows[i]["contents"].ToString()).ToList();
for (int j = 0; j < lst.Count; j++)
{
IBlockElement element = (IBlockElement)lst[j];
if (dt.Rows[i]["contents"].ToString().StartsWith("<br /><br /><h3 style=color:#0000ff;margin: 0 3px 0 3px;><strong>"))
{
contents.SetFontSize(12)
.SetBold()
.SetFontColor(ColorConstants.BLUE);
}
else if (dt.Rows[i]["contents"].ToString().StartsWith("<h4><strong>- "))
{
contents.SetFontSize(10)
.SetBold()
.SetFontColor(ColorConstants.BLACK);
}
else
{
contents.SetTextAlignment(TextAlignment.JUSTIFIED_ALL)
.SetFontSize(10)
.SetFontColor(ColorConstants.BLACK);
}
element.SetProperty(Property.LEADING, new Leading(Leading.MULTIPLIED, -1f));
document.Add(element);
}
Here is the PDF Output:
I've trying this question without success
I've checked the iText7 documentation, but is there a way to do this ?
I'm not sure what the contents object is in your code sample. I assume you're getting it somehow from the list of IElements that's generated by HtmlConverter. If not, you should review that, because you're setting properties on contents, but adding element to the document. If those do not refer to the same object, the properties on contents will be lost.
That being said, HtmlConverter will already apply the text alignment property defined by text-align: justify:
String html = "<p style=\"text-align: justify;\">Lorem Ipsum is simply dummy " +
"text of the printing and typesetting industry. Lorem Ipsum has been the " +
"industry's standard dummy text ever since the 1500s, when an unknown " +
"printer took a galley of type and scrambled it to make a type specimen " +
"book. It has survived not only five centuries, but also the leap into " +
"electronic typesetting, remaining essentially unchanged. It was " +
"popularised in the 1960s with the release of Letraset sheets containing " +
"Lorem Ipsum passages, and more recently with desktop publishing software " +
"like Aldus PageMaker including versions of Lorem Ipsum.</p>";
PdfWriter writer = new PdfWriter("SO66970672.pdf");
PdfDocument pdfDoc = new PdfDocument(writer);
Document document = new Document(pdfDoc);
IList<IElement> lst = HtmlConverter.ConvertToElements(html);
for (int j = 0; j < lst.Count; j++)
{
IBlockElement element = (IBlockElement)lst[j];
// Text alignment is already applied by HtmlConverter
//Paragraph contents = (Paragraph)element;
//contents.SetTextAlignment(TextAlignment.JUSTIFIED_ALL)
//.SetFontSize(10)
//.SetFontColor(ColorConstants.BLACK);
element.SetProperty(Property.LEADING, new Leading(Leading.MULTIPLIED, -1f));
document.Add(element);
}
document.Close();
Resulting PDF:
When setting the properties on contents (commented code in code sample above):
To illustrate that HtmlConverter respects the text-align property, this is the output with text-align: right in the HTML snippet:

Applescript: cut character and paste within span tags

I've been automating a process that we do for work that involves converting word documents to html files in TextWrangler. I've got everything sorted except for one final step, which involves moving the first character of the article inside of span tags (Boss's design choice, and the website doesn't support CSS that isn't inline or I'd just use first-letter).
Anyway, the HTML looks like this:
<p style='color: #444; font-size: 1.4em; line-height: 1.8em; font-weight: bold;'>
<img style='display: block; float: right; margin-bottom: 30px; margin-left: 15px; width: 475px;' src='*****.jpg' alt='' width='950' height='713' />
<span style='color: #444; float: left; font-size: 3em;'></span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer at rhoncus velit. Sed velit libero, venenatis non ornare ac, egestas vitae quam.</p>
The idea would just be to move the first letter following the closing span tag to inside the span tag, but I've looked around and don't really have any idea where to begin.
Edit: This might be made easier knowing in that the number of characters prior to the necessary letter in the line won't ever change. So maybe finding a way to isolate the nth character in the line and go from there?
This is a silly example, you'll want to polish it a bit:
set htmlText to "... your HTML ..."
set endSpanLength to 7
set endSpanPos to offset of "</span>" in htmlText
set firstCharPos to (endSpanPos + endSpanLength + 1)
set firstChar to character firstCharPos of htmlText
set oldEndSpan to "</span>" & linefeed & firstChar
set newEndSpan to firstChar & "</span>" & linefeed
findAndReplaceInText(htmlText, oldEndSpan, newEndSpan)
on findAndReplaceInText(theText, theSearchString, theReplacementString)
set AppleScript's text item delimiters to theSearchString
set theTextItems to every text item of theText
set AppleScript's text item delimiters to theReplacementString
set theText to theTextItems as string
set AppleScript's text item delimiters to ""
return theText
end findAndReplaceInText

TypeError: "embedded NUL character" to stick little pictures on a white picture

I want to create a "DOBBLE" game, but,
to create a DOBBLE card game, I just want to put some symbols (little pictures) on a bigger, but the Shell return this:
"embedded NUL character".
My program is:
def creer_carte(L):
S=associer() #a list of little pictures' link : ['1.jpg','2.jpg',..]
size=(700,450) #dimension de l'image finale
newim=Image.new('RGB',size,"white") #on créé une image vide
newim.save("carteblanche.jpg", "PNG")
for i in range(len(L)):
A=open(S[L[i+1]],encoding='latin-1').read()
img=Image.open(A) #On télécharge le fichier
newim.paste(img,(i*200,0))
newim.show()
return None
...It's only the beginning of my program.

RichEdit, winapi - paragraph aligment

I would like to have a line aligned in such way, that some first words are aligned left and some last words are aligned right, but all are in the same line:
| text 1 text2 |
| Lorem ipsum dolor sit amet |
Is that possibile? How can I do that?
As far as I know, the only way is to use tab stops. You simply create a right-justified tab stop at the very right edge. Then you have to write your text as
text 1\ttext2
Lorem ipsum\tdolor sit amet
where \t is a Tab character (i.e. U+0009).
I had this same problem, you need to send the message EM_SETTYPEPOGRAPHYOPTIONS to the control with wParam = TO_ADVANCEDTYPOGRAPHY, and lParam = TO_ADVANCEDTYPOGRAPHY, then right justifying using PARAFORMAT with the rgxTabs[ n ] += 0x2000000 works.

What are some useful TextMate shortcuts? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Macs are renowned (or bemoaned) for having an extensive number of shortcuts. However, OS X itself pales in comparison to the shortcut lists in TextMate and its bundles.
What are some useful keyboard shortcuts you use?
These are my favorite shortcuts:
cmd+t Start typing name of a file to open it
ctrl+w Select word
cmd+r Run the ruby or php-script that is open
cmd+opt+m Define a new macro
cmd+shift+m Run the macro
opt Switch to vertical selection mode
cmd+opt+a Edit ends of selected lines
ctrl+shift+K deletes current line
ctrl+shift+J merges current line with the next line
Esc auto completes common words in the document you are working in.
For example if you are using a function alot called LongFuntionNameThatChecksStuff, you can type Lon and pressEsc and it should auto complete.
Control-T(ControlT): Transpose (works in most Cocoa-native text fields and areas, but TextMate enhances the behavior).
Place your caret between two characters, hit ControlT, and the characters switch places (this is standard Mac behavior). Awesome for typos.
Select a word or series of characters on a single line, hit ControlT, and the characters in the selection will now be reversed (not too useful, but this is a TextMate enhancement)
Select a series of characters that spans more than one line, hit ControlT, and the lines will reverse. Characters within the line will still be in order. Most useful when selecting whole lines, but still works with partial lines selected, just so long as there is at least one newline character selected (TextMate enhancement).
My favourites are:
option+command+[ to clean up your indentation
"lorem", TAB to insert placeholder text
Personally two of my favourite shortcuts are:
⌃⇧L (that's ctrl+shift+L): Which wraps the currently selected text with a link to whatever's in the clipboard, and works for every text language I've tried it in.
⌃⇧⌘L (that's ctrl+shift+cmd+L): Which googles for the selected text and links to the top result.
The are both super useful for writing text and blogging, (and stackoverflow).
Codewise, I think that I prefer snippets to key shortcuts. Being able to type if⇥ etc., in almost any language is ridiculously useful, and the consistent interface is what keeps me using TextMate.
I also found this quite amusing. But I prefer to learn my shortcuts in small steps, and often find that just looking in the gear menu (⌃⎋) works.
shift+ctrl+alt+v sends selected text to pastie.org
also, using the PHP Bundle, try to start writing a function name and do the following:
str + alt + F3 = list of available functions
str + alt + F1 = short description of the function you've just completed.
Look word up in dictionary, in any Cocoa app (not just Textmate): ctrl + cmd + D
Wrap each selected line in markup tags: SHIFT + CONTROL + COMMAND + W
For example, if you have:
This is a
few sample
list items
Highlight all three lines and presss SHIFT + CONTROL + COMMAND + W to create:
<li>This is a </li>
<li>few sample</li>
<li>list items</li>
Generate Lorem ipsum: lorem + TAB
Will generate:
Lorem ipsum dolor sit amet,
consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit
anim id est laborum.
Selecting text using alt (via click and drag)
then use ⌘ + ] to indent (or [ to dedent)
Delete the current line: CONTROL + SHIFT + K
Format CSS: CONTROL + Q
Select some CSS and press CONTROL + Q to turn this:
body { background: red; font-size: 10px; color: black; }
Into this:
body {
background: red;
font-size: 10px;
color: black;
}
Look up property specifications in W3C: CONTROL + H
This works for both HTML and CSS. Place your carrot over whatever property you'd like to look up and press CONTROL + h. This will open a new window listing the W3C info.
For example, place your carrot over background:
body {
background: red;
}
Hit command + h and you'll see something like:
CMD + / comments out a line and it's smart enough to format based on language. I use it all the time.
Toggle between {} and do end blocks. Place your cursor on the block arugument (i.e. the word after the keyword do between the two pipes) and press Shift + Control + {
For example, converts:
#post.each do |post|
puts post.name
end
to:
#post.each { |post| puts post.name }
Edit the end of multiple selected lines simultaneously : COMMAND + OPTION + A
Close the nearest open html/xml tag: OPTION + COMMAND + PERIOD
For example, if you have:
<div>Lorem ipsum dolor sit amet, consectetur
CONTROL + COMMAND + D will automatically add the closing </div> tag to create:
<div>Lorem ipsum dolor sit amet, consectetur</div>
Switch between tabs:
Left: SHIFT + COMMAND + [
Right: SHIFT + COMMAND + ]
in the cftextmate bundle you can type any cfml tag without the opening "<" or closing ">" and press tab and it completes the entire tag and you can then tab to each of the tag attributes. i'm not sure if this type of shortcut works for other languages.
I just found a list of shortcut key symbols w/ definitions under Bundles > HTML > Entities - helpful for me in figuring out the whole short-cut bonanza going on with TextMate.
You can get a really great desktop background here. It has a ton of really useful keyboard shortcuts. I used it for a couple of days before memorizing the most useful ones.
Wrap selected text in markup tags: SHIFT + CONTROL + W
For example, if you have:
Lorem ipsum dolor sit amet, consectetur
Highlight the text and press SHIFT + CONTROL + W to create:
<p>Lorem ipsum dolor sit amet, consectetur</p>
Go to File: ⌘ + T
Find in Project: ⌘ + SHIFT + F
Eliminate all whitespace / carriage returns between the location of your caret and the start of the next piece of content: SHIFT + CONTROL + J
For example, if you have:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et
dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip.
Place your caret at the end of the first paragraph and press SHIFT + CONTROL + J to remove the space in between the paragraphs:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.
(these are mostly html-related)
cmd + option + closes current open html tag
shift + cmd + w wrap selection in tags
ctrl + return insert escaped line end, i.e. \n or <br> depending on the occasion.
Copy and Paste Clipboard: ⌘ + SHIFT + V
Titleize selected text: CONTROL + OPTION + U
Will turn:
Lorem ipsum dolor sit amet,
consectetur adipisicing elit.
Into:
Lorem Ipsum Dolor Sit Amet,
Consectetur Adipisicing Elit.
Downcase selected text: CONTROL + SHIFT + U
Will turn:
Lorem ipsum dolor sit amet,
consectetur adipisicing elit.
Into:
lorem ipsum dolor sit amet,
consectetur adipisicing elit.
Upcase selected text: CONTROL + SHIFT + U
Will turn:
Lorem ipsum dolor sit amet,
consectetur adipisicing elit.
Into:
LOREM IPSUM DOLOR SIT AMET,
CONSECTETUR ADIPISICING ELIT.

Resources