vim diff view for long lines - neovim

Is there a solution for getting a useful vim diff with very long lines? The problem I have is that for example I have one long line in one file:
Lorem ipsum dolor sit amet, consectetur adipiscing 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.
In another file I have a line very similar, but I have two changes. I capitalize ipsum to IPSUM and Duis to DUIS.
Lorem IPSUM dolor sit amet, consectetur adipiscing 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.
The problem is that now, when I compare these two files with :diffthis, vimdiff highlights everything between IPSUM and DUIS, and this is really useless to look at. I would like to just see highlighted LOREM and DUIS and their lowercase counterparts. Here is an image of what my vimdiff view looks like. Is there a way to achieve this?
The behaviour I want is actually the default diff view in pycharm. This image is from pycharm:

I found a plugin that does what I am asking for:
https://github.com/rickhowe/diffchar.vim

Related

Display full string in F# interactive window

If I type the following into an fsx in Visual Studio Code
let longString = "Lorem ipsum dolor sit amet, consectetur adipiscing 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."
and run F# interactive on it by highlighting and pressing Alt+Enter, the output in the interactive window is
- let longString = "Lorem ipsum dolor sit amet, consectetur adipiscing 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. Excepte- ur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";;
val longString : string =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed "+[384 chars]
or as screenshot:
How can I tell the F# interactive window to display the full string? Is there a shortcut or else?
I am aware of this post, but as fas as I know this is different here because a string is not lazily-evaluated.
printfn will print it completely:
printfn "%s" longString
Alternatively, you can change the fsi object properties, for instance:
fsi.PrintWidth <- 1000;;
Also, you can use AddPrinter:
fsi.AddPrinter (fun (s:string) -> s)
Here is the documentation: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/fsharp-interactive-options#f-interactive-structured-printing
If it is just for testing/debugging:
If you are in VSC you can run your script interactively as you mentioned. You can take advantage of that by using the interactive terminal and typing (in said interactive terminal)
longString;;
//output
val it : string =
"Lorem ipsum dolor sit amet, consectetur adipiscing 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."
This will then show the whole string and is in most cases sufficient (since you do not want to clutter your script with unnecessary outputs anyway).

UITextView height changes to scrollable after adding Line Break

I am trying to set the height of a UITextview and all works well until I try to format the text.
An example might be "/n" or using a line break with the Swift Multiline String Literals.
After that the Textview becomes scrollable with some sort of max height value.
Does formatting the text destroy the "self.overViewTxt.contentSize.height"?
Thanks.
#IBOutlet weak var overViewTxt: UITextView!
#IBOutlet weak var overviewTxtHC: NSLayoutConstraint!
overViewTxt.text = "Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, \n 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. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
overviewTxtHC.constant = self.overViewTxt.contentSize.height
or
overViewTxt.text = """
Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, 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\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
"""
UITextView has a unique property of calculating height automatically. You DON'T need to take the IBOutlet of constraint or do not give any fix HEIGHT constraint, rather than you need to disable it's scrolling property and then assign any text it will be automatically became of it's size.
Note: Make sure you give proper constraints, i.e., top, bottom, leading & trailing.
Try to update frame instead of using constraint:
overViewTxt.text = "Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, \n 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. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
let overviewTxtHCSize = overviewTxtHC.intrinsicContentSize
overviewTxtHC.bounds.size = overviewTxtHCSize

In flutter development, how to print long string in visual studio code debug console?

I want to print large string in flutter but they are truncated.
Example, this is 1342 characters string:
Lorem ipsum dolor sit amet, consectetur adipiscing 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. Lorem ipsum
dolor sit amet, consectetur adipiscing 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.Lorem ipsum dolor sit amet, consectetur
adipiscing 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.
Only the top 1022 characters will be printed.
I try to use debugPrint and print functions but nothing.
What I can do?
That's due to VS Code truncating big strings, usually bigger than 1000 char of being printed at once.
You can try a little "hack" by splitting it into words and print each of it.
myLongString.split(' ').forEach((word) => print(" " + word));
You can also try to use the logging package, but probably it will experience the same problem when trying to print the whole string, since it is trying to stdout all at once.
you can use log(message) function.

How can I stop MailApp.sendEmail() from adding line breaks to an email body every ~80 chars?

I am using a google script attached to a google sheet in my Google Drive to send emails. I have noticed that MailApp.sendEmail() sends emails with a body that have doesn't quite look like the original: it adds a line break every ~75 characters (without interrupting words).
How can I stop the MailApp.sendEmail() function from doing this?
Here's an example to illustrate:
Running this function :
function sendTestEmail(){
var text = "Lorem ipsum dolor sit amet, consectetur adipiscing 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.";
MailApp.sendEmail("test#gmail.com", "test", text);
}
Will give an email that looks like this
In case it's useful, I tested a bit: a 76 character sentence stays on one line (no more), but adding an extra word made the last two words of this new sentence go to a new line.
Thanks a lot in advance !
EDIT 1: These line breaks do not appear in mac mail or thunderbird, but do appear on the iphone gmail app.
Also I tried using html instead of plain text, and it does remove the unwanted line breaks: great! But it also removes all line breaks unless I put <br> manually.
I might need to fine tune details, but as suggested the following works for me. The text.replace is needed to make the line breaks I might put in intentionally to appear in the html email.
function sendTestEmail(){
var text = 'Lorem ipsum dolor sit amet, consectetur adipiscing 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.';
var htmlText = text.replace(/\n/g,'\n<br>');
MailApp.sendEmail({
to: "test#gmail.com",
subject: "test",
htmlBody: htmlText,
});

Asp classic mail function sends string with blank spaces

I am sending a mail with CDO.Message object and the mail arrives with a blank space between characters.
For example, I sent this string:
"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."
And arrives this:
"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 volup tate 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."
Check the strong word for understand. Why occurre that?
My code
Set Mail= Server.CreateObject("CDO.Message")
Set MailConfig = Server.CreateObject("CDO.Configuration")
Mail.From = example#hotmail.com
Mail.Bcc = "example#hotmail.com"
Mail.Subject = "Example"
MailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = sendUsing
MailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
MailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpServerPort
MailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
MailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = smtpUseSSL
MailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = smtpConnectionTimeout
MailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = mailUsername
MailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = mailPassword
MailConfig.Fields.Update
Mail.Configuration = MailConfig
strBody = "the string"
Mail.HTMLBody = strBody
Mail.HTMLBodyPart.Charset = "utf-8"
Mail.send
The extra space appears every 991 characters.
I added this:
Mail.HTMLBodyPart.ContentTransferEncoding = "quoted-printable"
And has been solved.
If you don't send HTML in the email body, do not make use of Mail.HTMLBody, instead use Mail.TextBody which is the correct choice when sending pure text. Textbody preserves line breaks and other control characters which HTMLBody does not.
I have experienced similar issues in Outlook when displaying raw text sent with HTMLBody, so I believe this simple change will fix it.