-r command line option does not work in one instance mode & cudatext opened
See original GitHub issueWhen I have "ui_one_instance": true
in user.json, opened CudaText with another file and call cudatext -r anotherfile
, new file is opened as read-write.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
CudaText - Free Pascal wiki
-r - Open files from command-line in read-only mode. ... single-instance mode, so that program with one "group" will not interfere and find...
Read more >CudaText/history.txt at master · Alexey-T/CudaText - GitHub
fix: macOS: "Open with / CudaText" did not work from Finder ... + add: command line parameter '-p' supports 'single instance' mode (thanks...
Read more >Change-log - CudaText
AsString] * hotkeys part in Options dlg: now read-only, cannot change hotkeys there * SynPlugins.ini: not used last 2 items for command plugins:...
Read more >CudaText 1.96 vs other Linux editors on huge lines - Reddit
Opening a large file in Vim is no problem usually. If you can give me a test sample I'll gladly try.
Read more >Script runs from R, but not via command line - Stack Overflow
Loading required package: RODBC Error in sqlQuery(channelMflib, the.SQL) : first argument is not an open RODBC channel Calls: get.all.areas -> oceans.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just added (win32, did not test linux) -z=, -e=, -nh. the same easy way.
@Alexey-T
I’m still too busy in my job to be able to fix that issue by myself but I did a code analysis to give you some hints for fixing it.
BTW: I would classify this issue not as an enhancement but as a bug instead. I was able to figure out that in single-instance-mode the whole command line parsing is reduced to file names, options are ignored as a whole, see below.
Analysis Results
File
FormMain.pas
contains the following code block (in procedureTfmMain.FormCreate
at lines 1840 to 1850):In single-instance-mode, after executing line 1847 the main/visible Cud instance is ready to receive data (i.e. command lines sent from subsequently started instances). When data is received, procedure
TfmMain.SecondInstance
is called (located in fileFormMain.pas
at line 1720).The problem is, that
TfmMain.SecondInstance
checks every command line parameter if it is an existing file and opens it. Thus command line options like-r
or even-n
are skipped.To solve the issue, procedure
TfmMain.SecondInstance
should call the same function that is used for parsing command line arguments. This would be procedureTfmMain.DoOps_LoadCommandLineOptions
(located in fileformmain_commandline.inc
at line 10).But currently
TfmMain.DoOps_LoadCommandLineOptions
is called from procedureTfmMain.DoOps_OnCreate
(located in fileFormMain.pas
at line 2038) which in turn is called fromTfmMain.OnCreate
in line 2031. Furthermore,TfmMain.DoOps_LoadCommandLineOptions
operates directly on theParamStrUTF8
array but it should operate on the command line arguments sent from the subsequently started Cud instance in this case.That means there has to be implemented some code that stores in single-instance-mode the whole command line of the first started Cud instance and in multi-instance-mode the whole command line of every Cud instance to an array. The same should happen in single-instance-mode in procedure
TfmMain.SecondInstance
with the command line data sent from a subsequently started Cud instance. ProcedureTfmMain.DoOps_LoadCommandLineOptions
should operate on that array.Since procedure
TfmMain.DoOps_LoadCommandLineOptions
only parses command line options and doesn’t load the provided file(s), there already has to be a piece of code that does that but I haven’t found it. This part of code has to use the array mentioned above as well.