patchGNU Octave - Patches: patch #9050, Display variables by hovering the...


patch #9050: Display variables by hovering the mouse cursor

Submitter:  Lachlan Andrew <lachlan>
Submitted:  Wed 13 Jul 2016 10:34:48 AM 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

Sun 24 Jul 2016 08:47:29 PM UTC, comment #6: 

Last patch didn't apply anymore, updated one attached.

Lachlan, can this be made a configurable option, preferrably in the editor menu toolbar? Sometimes the hovering + popups are a bit in the way, so it would be nice if they can be shut off.
Or maybe the time-to-popup would just need to be twice or three times as long (or configurable in the editor preferences).

(file #38010)

Philip Nienhuis <philipnienhuis>
Group Member
Sat 16 Jul 2016 09:44:23 AM UTC, comment #5: 

clicking the close button, or even the question mark, doesn't do a thing.
 matter to me.

No idea here how to get rid of that status bar. Maybe JohnD knows?

I wouldn't worry too much. I like it.

BTW Matlab also show these stats when hovering over variables in the terminal window.

Philip Nienhuis <philipnienhuis>
Group Member
Sat 16 Jul 2016 06:54:20 AM UTC, comment #4: 

Thanks for testing this again, Philip.

It seems that the Windows version still has a title bar.  I tried to get rid of that.  (There isn't one on my Linux system.)  Do you need to click on the X to clear it, or does it go when you move the mouse?

You're right that it gets messy for large matrices, but I think Matlab does too.  My goal is to have some useful summary statistics for large matrices: perhaps the output of matrix_type, perhaps the maximum and minimum values (and their locations?), perhaps whether it is non-negative.  Many of my matrices are sparse but stored as full, so I was thinking of using the sparse representation if the matrix is "sparse enough".

Any suggestions of how you would like the output are welcome :)

Lachlan Andrew <lachlan>
Fri 15 Jul 2016 05:58:41 PM UTC, comment #3: 

Tried the cset on Linux and Windows, works fine!
Things get interesting however when e.g. a variable has been declared as "rand (250, 250)" .... (see attached pic)

Philip Nienhuis <philipnienhuis>
Group Member
Fri 15 Jul 2016 12:33:58 AM UTC, comment #2: 

Oops. Thanks!  Trying again.

(file #37881)

Lachlan Andrew <lachlan>
Thu 14 Jul 2016 08:41:39 PM UTC, comment #1: 

I think the 1st and 3rd patch are the same. Seems the "hover" patch is lacking....

Philip Nienhuis <philipnienhuis>
Group Member
Wed 13 Jul 2016 10:34:48 AM UTC, original submission:  

This patch, in three changesets, causes the value of a variable to be displayed when the cursor hovers over it, as Matlab does.  (Philip, you mentioned that this would be useful, so I'm adding you to the Cc list.)

The first two patches (display_mutex and display_hover) have been separated out because they provide "infrastructure" that is likely to be useful for other tasks.

The first provides a thread-safe (i.e., locked) mechanism to allow the GUI to call quick functions from the core.  It uses a very coarse-grained mutex lock, which the core holds whenever it is not doing a readline.  That minimizes the locking overhead, while still allowing the GUI access while the user is debugging or writing code.

The second provides "hover" events when the mouse stays still over the edit area for more than 0.5s.  In future, this will allow us to show the matching if/while etc. when hovering over an endif/endwhile/end, or the usage info for a function.

The final patch, display_show_vars, responds to the hover signal by displaying the variable name, size, type and value. Some, such as large diagonal matrices, are displayed in a more compact form than print() gives, but most just use print().

One caveat is that, like Matlab, this just looks at the string under the cursor and evaluates it in the current context, even if the cursor is over a function in a different context.  In the future, I hope to have the full parse tree accessible to the GUI, which would allow us to determine which function the cursor is in, and look for the appropriate stack frame.

Lachlan Andrew <lachlan>


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

Attach Files:

Attached Files
file #38010:  patch_9050_display_show_vars_v2.cset added by philipnienhuis (11KiB - application/octet-stream)
file #37902:  patch9050_1.png added by philipnienhuis (39KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by lachlan (Submitted the item)
  • -email is unavailable- added by lachlan

    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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-07-24 philipnienhuis Attached File- Added patch_9050_display_show_vars_v2.cset, #38010
    2016-07-15 philipnienhuis Attached File- Added patch9050_1.png, #37902
    2016-07-15 lachlan Attached File- Added patch_xxxxx_display_hover.cset, #37881
    2016-07-15 lachlan Attached File#37843 Removed
    2016-07-13 lachlan Attached File- Added patch_xxxxx_display_mutex.cset, #37843
        Attached File- Added patch_xxxxx_display_show_vars.cset, #37844
        Attached File- Added patch_xxxxx_display_mutex.cset, #37845
        Carbon-Copy- Added philipnienhuis

    Back to the top

    Powered by Savane 3.13-c54d.
    Corresponding source code