### snapdragon3101's blog

By snapdragon3101, 6 weeks ago, ,

Hi Guys !

You guys are truly amazing. I created CP Editor around 3 months ago just for fun and personal use, never wanted to make it public but anyways, I decided to make it public with this blog. I got so much love and support that I could not hold myself back from improving it, in following weeks I released the second version in this blog. Fixing a lot of issues and bringing new features.

Let's get into what is new in this release of CP Editor. But first,

#### Merry Christmas programmers!!

Thanks to ouuan for his wonderful contributions. Almost all new features were implemented by him.

#### What's New

• [NEW] Editor now only prompts to save on exit, if unmodified changes are present.
• [NEW] Title-bar shows * for unsaved files.
• [NEW] Verdict now shows colors. WA in Red and AC in Green.
• You can Expand the size of the Input, Output and Message box.
• Now you can Read Input from files in Input boxes.
• Editor now also Optionally accepts Expected Output that you can use to check against your program's stdout.
• Editor also Shows Verdict If you have provided Expected Output. Verdict can be any of three :
• AC : Accepted, Verdict given when Output matches with Expected Output
• WA : Wrong Answer, Verdict given when Output does not matches with Expected Output
• ** : Unknown, Either Expected or Your Program's stdout is Empty.
• Diff viewer has been added to check the difference between the Expected and Produced Output. (Click More to view Diff)
• Set Tab Size.
• Added Competitive Companion in the Editor. So no need to copy paste Input/Output manually, Competitive Companion fetches testcases for you. Set it up as follow :
Setting Competitive Companion

#### What's Fixed

• [New] Fixed Issue when even if expected and produces output were same, the editor still produced WA.
• [New] Fixed an Issue where upon format, there was a chance of command window to blink.
• [New] Fixed Application Crash when Companion Server was restarted.
• [New] Fixed Issue where AppImage would crash on Some Ubuntu 18.04.
• Fixed the issue where { always automatically added a new line with }
• Fixed Tab and Spaces mix-up, in the old version editor always used Spaces for indentation.
• Fixed issue where if user was not opted for beta. Still they get beta update notifications.

#### Troubleshooting and General Information

• Make sure Competitive companion extension port and CP Editor Companion port are same and above 10,000.
• Make sure no other server is listening on the port. If this is the reason you may have to change the port to something else that is not being used.
• Two instances of CP Editor will not be able to run Companion, because only one of them can listen at one port.
• Competitive Companion can also parse Contests. Make sure you are on a problem page when you press parse Task not on a contest page.
• If a problem has more than Sample 3 testcases. The Editor will discard all testcases except first three.
• I have not much experience with Windows, So if your OS has a firewall that prevents CP Editor from listening or request from arriving, you may need to add an exception for the port in your Anti-virus or firewall settings.

###### Support me with Stars**

• +123

 » 6 weeks ago, # |   0 Nice. Keep it going! <3
 » 6 weeks ago, # |   0 How can I use it in my Ubuntu ?
•  » » 6 weeks ago, # ^ |   0 AppImage
•  » » » 6 weeks ago, # ^ |   0 So I can just download AppImage and run it ?
•  » » » » 6 weeks ago, # ^ |   0 Yes it would be better if you google on how to run AppImage. You have to download it and then make it executable then run it on terminal.
•  » » » » » 6 weeks ago, # ^ |   0 I downloaded it but on running it says segmentation fault core dumped .
•  » » » » » » 6 weeks ago, # ^ |   0 You can open an issue in GitHub for this. You will be notified when this is fixed. Due to so much fragmentation in Linux, there is no single executable that runs everywhere except AppImages
•  » » » » » » 4 weeks ago, # ^ |   +3 The new 3.2.1 will not SEGFAULT. Try it
 » 6 weeks ago, # |   0 "An invalid payload was delivered on the listening port"The above error is coming when we click on the browser extension on codeforces.What to do now, i have checked they have same port no configured.
•  » » 6 weeks ago, # ^ |   0 That message pops if the extension is not providing correct json data. Try another browser even try changing ports.
•  » » » 6 weeks ago, # ^ |   0 Thanks, one feature that we can't resize the coding area and hence its not helping to work properly on split screen. Any help to enable the feature to reduce coding area(i tried the normal way,it did't work). Thanks again.
•  » » » » 6 weeks ago, # ^ |   0 You can't resize because there is some minimum height and width that is required for editor.
•  » » » 5 weeks ago, # ^ |   0 I've tried changing ports and still get the same message. Is it possible to fix this issue without trying another browser? I don't have other browsers available (except Tor).
•  » » » » 5 weeks ago, # ^ |   0 Check with Competitive Companion, GitHub page, (url in post) i guess it doesn't work well with tor. Try opening an issue there and see if there is a fix! Since this issue is not related with Editor, I cannot help much except to guide you to correct place.
•  » » » » » 5 weeks ago, # ^ |   0 Sorry, I use Google Chrome as my main browser. I'm just stating that I don't have any browsers other than Google Chrome left, except Tor.Apologize for the unclear information.
•  » » » » » » 5 weeks ago, # ^ |   0 So you are getting error? What does it says?
•  » » » » » » » 5 weeks ago, # ^ |   0 My browser is Google Chrome. This message appeared on the editor as I click the parse button of the extension:"An invalid payload was delivered on the listening port"I tried changing port to some values larger than 10000 and it still doesn't work.
 » 6 weeks ago, # |   0 No output is displayed on running the code and the Formatter gives the error message :- Format feature will not work as your format command is not valid.
•  » » 6 weeks ago, # ^ |   0 You need formatter tool like Prettier, clang-format installed and in your PATH. Then you can change format command and it will work.
 » 5 weeks ago, # | ← Rev. 3 →   +5 Hey)Recently I've started to use this editor, and I like it very much so far) Here some of my thoughts)1) The size of output boxes and compiler messages box size could be flexible, because on small monitors there is just not enough space for code editor window.2) An option to make a new .cpp file after parsing a task could be very convenient. Like it would be possible to choose a folder, and when I parse a task, a file with the task name automatically is made.3) I cannot figure out why the expected output thing sometimes does not work. It works for sums of numbers for example. But for this task https://codeforces.com/contest/1277/problem/B it does not work for some reason. It prints WA when the output is clearly the same. 4) Make run and compile possible using a hotkey5) Make an option to make WA and AC red and green colors, so I'll will be able to immediately see the verdictKeep up the good work, I'll definitely follow this project)EDIT: here an img of bug that I mentioned in (3) https://imgur.com/a/7Q6miXw
•  » » 5 weeks ago, # ^ | ← Rev. 2 →   +5 Thanks to ouuan, points 5, and points 3 are fixed and will rollout as update in following days. EDIT: You should open this as issues in GitHub, so that you can track it's status and it also reminds us what to do.
•  » » 5 weeks ago, # ^ |   +5 Yes, i know it is issue with carriage return and line feeds. It has been fixed, in coming days you will get an update!
•  » » 5 weeks ago, # ^ |   0 Please tell me what hotkey mapping you need. I don't know those hotkeys for compiler, and running!
 » 5 weeks ago, # |   0 Is there any way to update instead of download new version and install it?
•  » » 5 weeks ago, # ^ |   0 Windows??It's 15 MB .exe file, download it and run it will update if you already had it installed otherwise it will install.
•  » » » 5 weeks ago, # ^ |   0 Thanks for your reply!
•  » » 5 weeks ago, # ^ |   0 The method of update you are asking is called delta updates. Not even VSCode or Atom have it. To update your editor you need to download full size new binaries.Those features usually come in handy with professional IDE like Jetbrains, they have modular structure and hence such updates are possible.
•  » » » 5 weeks ago, # ^ |   0 Can you add option that I can change size of any part on workspace because space to code is small for me?
•  » » » » 5 weeks ago, # ^ |   0 Yeah it's in my mind.
•  » » » » » 5 weeks ago, # ^ |   0 Hope to see it in next version!
•  » » » » 4 weeks ago, # ^ |   0 Can you add an option source code formatter like codeblocks ??
 » 4 weeks ago, # | ← Rev. 2 →   0 I have been using this text editor and its really cool.I just wanted to share a few things i have experienced multiple times-1) There's some issue when we use mouse to select a range of code,and try to copy or do something,i mean, there's no problem in copying but i was not able to select the lines of code as normally as we could have done.There's some issue there.2)There were problems that i was solving, that got executed in other online compilers and also got AC in codeforces but I was getting error in the text editor( and i was just finding whats wrong in my code when there was none). The error message i was getting is "Error occured during execution...Non-zero exit code -1073741571" Here is one of the submissions if you want to refer it: 67448850. You may try it for any test case.3) When we press '(' followed by ')' key, we get only one pair of bracket but this doesn't happen in case of the following keys- ',"(single inverted and double inverted) where we get two pairs if we press twice.Please make it behave the same as bracket.But altogether a great experience, and thanks for this editor.
•  » » 4 weeks ago, # ^ |   +8 67448850 works well for me (on Windows 10). Could you please provide your environment?BTW, it's better to open an issue here for 2). But for 1) and 3), they are editor issues, so you should open issues here.
•  » » » 4 weeks ago, # ^ |   0 I am also using windows 10.Any idea why its happening like that?
•  » » » » 4 weeks ago, # ^ |   +9 Which version of CP Editor are you using? What's your compile command?
•  » » » » » 4 weeks ago, # ^ |   0 The version is 3.0.0 The command is g++ -Wall
•  » » » » » » 4 weeks ago, # ^ |   +9 Try adding -Wl,--stack=536870912 to the compile command. You declared arrays in the main function, which cost the stack memory. You should declare them outside the main function, or add -Wl,--stack=536870912 to get more stack memory.
•  » » » » » » 4 weeks ago, # ^ |   +9 And you should update the editor. There are many cool features in the newest version.
•  » » » » » » » 4 weeks ago, # ^ |   0 ok..thank you very much.
•  » » 4 weeks ago, # ^ |   +1 Error occured during execution...Non-zero exit code -1073741571 Such behavior is a cause of memory error! If your programs runs out of stack or heap memory on your machine. It abruptly halts with non-zero exit code. Codeforces judges are powerful and have enough memory, so it runs fine there.Also, --stack will only work on windows. Also, better safe than sorry, if your can give some more time to compilation, you could use sanitizers, by appending -fsanitizer=memory,undefined. It prints to stderr, the complete state of memory if anything bad happens. It does slows compilation but not much, there are more sanitizer like address, but only in clang. So I recommend using and installing llvm clang for windows. You will get formatter and complete compiler!
 » 4 weeks ago, # |   0 Does this work on Macintosh??snapdragon3101
•  » » 4 weeks ago, # ^ |   0 Yes it will work. You will have to compile it from source, Its easy and won't take more than 5 minutes.
•  » » » 4 weeks ago, # ^ |   0 Can u please elaborate how to compile it from source ?snapdragon3101
•  » » » » 4 weeks ago, # ^ |   0 Download or clone the source code from github. Install Qt and cmake for your computer. The follow the instructions here : https://github.com/coder3101/cp-editor2#building-for-source
 » 4 weeks ago, # |   0 Thanks a lot snapdragon3101 keep updating and best wishes for your project buddy
 » 4 weeks ago, # |   0 So i have been using this editor for the whole day today, and i'm totally in love with this.I was really in need of something like this :PI would like to request/recommend some more features which will surely enhance this awesome editor. Support for more themes ( I really like my Monokai Theme :P ). Feature that lets you comment a block of code using [ Ctrl ]+[ / ] Auto Completion Some more blocks for test cases, maybe scrollable (Not a Must tho) Thanks to snapdragon3101 and all devs for creating this. <3
•  » » 4 weeks ago, # ^ |   +1 Support for more themes! Okay, It can be added easily.Comment with CTRL+/ is already in progress.Auto completion requires at least some kind of LSP which slows down stuff! However auto completion like that of Geany could be added. It's already in progress, actually I am stuck at one of dependency to add this feature. So as soon as it's done, it will rollout!I thought 3 would be enough as mostly CF problem or other problems don't have more than 3 testcases. It also requires doing some UI tweaks which i don't want to do now. Maybe Later.Here is what you should do:Open issue on the above GitHub, that way you can track the progress of your feature requests! Open 2 issues one for CTRL+/ comment and other for Monkai theme. Issues also help us (devs) to remember what our users want.
 » 4 weeks ago, # |   0 Is there a way to make snippets?
•  » » 4 weeks ago, # ^ |   +3 Already requested! There is no way as of now, but in future I will add option to add snippets! This issue already asks it https://github.com/coder3101/cp-editor2/issues/56
 » 4 weeks ago, # |   0 [Format feature will not work as your format command is not valid]. I am getting this error. Please help.
•  » » 4 weeks ago, # ^ |   0 Just ignore it. If you don't want code formatting to eork!. To solve it you need to download and add to path clang-format
•  » » » 4 weeks ago, # ^ |   0 How do I add it? I am new to this. Can you please help.
•  » » » » 4 weeks ago, # ^ |   0 I am not very familiar with Windows system but it's called Environment Variable. You need to add the path of LLVM to ENVIRONMENT Variable named PATH. But as I said earlier you can ignore this error and everything should work fine. Except of course Code Formatting
•  » » » » » 4 weeks ago, # ^ |   0 Okay, thanks a lot for your help. Thank you for this app, will save a lot of time by directly fetching test cases.
•  » » » » » » 4 weeks ago, # ^ |   0 Spread the word! Let others know it and let them save time too! It keeps the competition fair and square.
•  » » » » » » » 4 weeks ago, # ^ |   0 What is Format Feature Does anyway and what it's formatting ?
•  » » » » » » » » 4 weeks ago, # ^ |   0 It makes your ugly code look consistent and beautiful for better readability
 » 4 weeks ago, # |   0 sometimes it create problem with fastio do snapdragon3101 notice it ??!
•  » » 4 weeks ago, # ^ |   0 I never tested with fastio. I will see what the issue is, meanwhile could you please explain the problem. So that i can confirm it.
•  » » » 4 weeks ago, # ^ |   0 sometimes after running the code with ios::sync_with_stdio(false); cin.tie(nullptr); gives garbage value and unexpected value as output