patchGNU Octave - Patches: patch #9762, Don't select the '.m' extension...

 
 

patch #9762: Don't select the '.m' extension when double clicking on a file name in terminal window

Submitter:  Roland Baudin <roland65>
Submitted:  Wed 06 Mar 2019 01:30:17 PM UTC
   
 
Category:  Core : new feature Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 04 Jan 2020 06:57:52 PM UTC, comment #9: 

Definitely a QSetting user preference.

Mike Miller <mtmiller>
Group Member
Sat 04 Jan 2020 09:32:34 AM UTC, comment #8: 

No, I didn't update the patch. I could work on it, but I don't know what to do: a user setting in the GUI or a command line option to put in .octaverc?

Roland Baudin <roland65>
Thu 02 Jan 2020 07:25:42 PM UTC, comment #7: 

The patch is very simple.  Has there been an update to make this a User Preference?  Otherwise, it will have to stay out of the upcoming 6.1 release.

Rik <rik5>
Group administrator
Mon 08 Apr 2019 07:40:23 AM UTC, comment #6: 

OK, I'll try to update my patch.
Do you mean a user setting in the GUI or a command line option would be sufficient?

Roland Baudin <roland65>
Sun 07 Apr 2019 10:30:24 PM UTC, comment #5: 

I recommend that you file a new bug report about adding a user setting for the set of word boundary characters. This patch report isn't actionable as it is, unless you are planning on updating your patch to add the user preference.

Mike Miller <mtmiller>
Group Member
Fri 08 Mar 2019 08:57:51 AM UTC, comment #4: 

OK, I tried your approach with setWordCharacters (":@-/_~") and it's definitely better than my hack.

I attach the new patch to this report.

Of course, a user preference for this would be the best option.

Thanks!


(file #46463)

Roland Baudin <roland65>
Thu 07 Mar 2019 07:40:03 PM UTC, comment #3: 

Terminal emulators typically define a set of "word characters", which is the set of punctuation characters that are considered to be part of a contiguous "word" when double clicking on some text.

The qterminal default set of word characters is ":@-./_~" and Octave doesn't change that from the default. So "." is included in words. This is primarily for compatible behavior with other terminal widgets, so double clicking will behave the same in Octave, in gnome-terminal, in konsole, or in rxvt.

It would be easy to remove "." from the set by simply calling setWordCharacters (":@-/_~"), but then Octave would behave differently from almost every other terminal emulator's defaults. We could add this as a user preference like other terminals do.

Mike Miller <mtmiller>
Group Member
Thu 07 Mar 2019 08:57:34 AM UTC, comment #2: 

Yes, assuming you want to execute the script 'myscript.m" the use case is the following (in Unix systems):

1. Type 'ls' or 'dir' in the terminal window (within the GUI), in the folder where the file is located

2. Double click on the name 'myscript.m', this selects the name 'myscript' (without the '.m' extension)

3. Click on the middle button of the mouse on the command line, this pastes the name 'myscript' to the command line

4. Press enter, this executes the script

In fact, I particularized the '.m' case because it was simpler for me, but when double clicking in MATLAB on a file name, any extension is removed from the selection, so this probably should be a better way than that what I've done.

Roland Baudin <roland65>
Wed 06 Mar 2019 06:09:22 PM UTC, comment #1: 

Can you explain the use case for this? Is this to support the user running 'dir' or 'ls' and being able to copy by double-clicking and paste the function name back into the terminal or the editor?

This seems like a very narrow case to make such a strange exception for. Any other file name double-clicked will select the entire file name. It looks very odd that only one file extension is excluded. If the file name is selected in the File Browser panel, right click, and choose "Copy Selection to Clipboard", it copies the entire file name. It seems far better to be completely consistent.

Also, double-clicking on the file name and then dragging while still holding the second click, normally allows multiple words to be selected. With this patch applied, after dragging, suddenly the ".m" is included in the selection.

I think we want to reduce the special cases in our fork of libqterminal so that we may eventually link with the upstream libqterminal library, if that happens before the Command Window is rewritten to not be a terminal anymore.

Mike Miller <mtmiller>
Group Member
Wed 06 Mar 2019 01:30:17 PM UTC, original submission:  

On Linux (and other unix systems) it is very common in terminal window to double click on a m file name and paste this name to the command line with the middle mouse button.

This works well but we have to manually delete each time the '.m' extension before executing the script. This is annoying...

In MATLAB, this works the same, but the '.m' extension is not selected, which is more convenient.

This tiny patch implements this feature in Octave 5.1.0.

Roland Baudin <roland65>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #46463:  terminal-double-click.patch added by roland65 (583B - text/x-patch - Better patch that avoids the selection of the extension when double clicking on a file name in terminal window )
file #46446:  terminal-unix.patch.gz added by roland65 (319B - application/gzip - Patch for Octave 5.1.0)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by roland65 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-11 mtmiller StatusIn Progress None
    2020-01-02 rik5 StatusNone In Progress
    2019-03-08 roland65 Attached File- Added terminal-double-click.patch, #46463
    2019-03-06 roland65 Attached File- Added terminal-unix.patch.gz, #46446

    Back to the top

    Powered by Savane 3.14-8eb0.
    Corresponding source code