Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add command line parameters #16

Open
jleclanche opened this Issue · 5 comments

2 participants

@jleclanche

--help and --version at least.

Also requesting --line: would open and go to a specific line number (or the last line if the file is too small)

Maybe a good one too would be -n / --new-window, which would open in a new window rather than tabbed with the current window.

@Mezomish Mezomish was assigned
@Mezomish
Owner

Added --help and --version.

For --line and --new-window there's going to be another kind of solution. I'm planning to introduce some sort of "juffed-tiny" - a lightweight "companion app" based on the same editing component with the same editing capabilities, same shortcuts, same highlighting, etc., but with no tabs, no plugins, no extra toolbars and so on. Because of lacking all that stuff it's gonna start and work much faster and I think that will be a nearly-ideal solution for fast previews and all that kind of things when you only need to open and quickly edit one file.
Of course it will be tied up with the main app, so you will be able to send documents between them.

@jleclanche

That sounds like a nice idea but, if a juffed-tiny exists with that functionality, there is no reason for juffed not to have --line / --new-window.

@Mezomish
Owner

Consider this:
By default JuffEd works as a single application (using QSingleApplication class), so if you attempt to launch another one with some file it will be just opened in existing instance (using special "messages" implemented in QSingleApplication class).
To open another window there's no other choice than to create it with a regular QApplication class (since we can't have 2 instances of QSingleApplication running at the same time). That window can't receive those messages.
Now if we close the first instance we will have only the second one, running as a regular QApplication.
So, if you now attempt open a file from file manager and expect it to open in already existing instance - that won't happen since the running instance is not a QSingleApplication. Another window will be opened instead (now running QSingleApplication). I find that experience too confusing and inconsistent.

For the "--line" option: if I open multiple files which one of them should go to the specified line?

@jleclanche

You do not need multiple Q(Simple)Application in order to create more windows, you can create more than one QMainWindow instance. It might require some re-architecturing in the application though.

As for --line, there are three ways to do it:

  • Open the last file in the list to that line (so treat --line as a post-open action)
  • Open all the files in the list to that line (treating --line as a global command)
  • Allow multiple --line parameters (eg juffed file1 --line 123 file2 --line 234)

I would go with the third one personally, but if too complicated to implement the second one sounds fine.

@Mezomish
Owner

That will require a major refactoring since the app's architecture is unfortunately not that flexible. It grows from 2007-2008 and to be honest I'm not proud of it at all (I was not that experienced in architecture design back then).

I'll certainly introduce the --line option (most likely I'll go with the 3rd variant) but --new-window will definitely be postponed till the time I re-design the app (I started thinking of it couple months ago btw).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.