FLTK logo

STR #3442

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | SVN ⇄ GIT ]

STR #3442

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:3 - Applies to all machines and operating systems
Subsystem:FLUID
Summary:fluid: ^V (paste) should paste new item below current selection
Version:1.4-feature
Created By:greg.ercolano
Assigned To:matt
Fix Version:1.4.0
Fix Commit:e76611a1fe3c49e66c42d9d4f0e2c995fa7f6f5e
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 greg.ercolano
11:10 Feb 07, 2019
paste_after_last_selected_item_v1.diff
4k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 greg.ercolano
10:31 Dec 13, 2017
I've been wanting this feature for all the years I've used fluid.

When you've selected an item in the fluid tree and use ^C/^V to
make a copy, the pasted copy appears at the VERY BOTTOM, which in
the case of large fluid files can be several pages down from the
current selection. It then has to be chased back up to where I want
it with F2, which is usually back near where the original was.

It would be better IMHO if the pasted copy appear immediately below
the current selection.

I find it common situation to use the ^C/^V combo to:

    o Make new class members+methods by copying an existing member/method
      near where I want the new one to be, and then changing the name/code
      of the copy.

    o Make new #include/globals/functions by copying an existing
      one near where I want it and changing the copy

It really looses coding continuity when the new copy appears pages away
from where you want it, having to then use F2 to chase it back to where
you were, which in large files is sometimes hard to find while using F2.

It would be much better if the new item appeared directly below the
current selection, so you're not suddenly transported away from where you were
before the paste.
 
 
#2 matt
08:18 Jan 15, 2019
LOL, yes, I know exactly what you mean. I'll implement that.  
 
#3 AlbrechtS
07:07 Feb 06, 2019
See also related STR #2842:
https://www.fltk.org/str.php?L2842
 
 
#4 greg.ercolano
11:10 Feb 07, 2019
Matt: I did some research on this; attaching a v1 patch suggestion
that seems to work, though I'm not sure if this is necessarily the
'right' way to add this.

Patch includes extra comments I added to existing code to assist
readability, but not 100% if what my comments say is correct..
if you can verify?

BTW: in Fl_Type.cxx, I noticed this coding pattern:

      Fl_Type *end = this;
      while (end->next) end = end->next;

..wouldn't this one-liner be equivalent, avoiding the while() loop:

      Fl_Type *end = this->last ? this->last : this;
 
 
#5 matt
05:28 Dec 05, 2021
About the 'while' loop: I was wondering about that too, but when reorganising code, I saw that the node (or node-tree) doesn't need to be part of the main widget tree. If you cut a number of widgets and paste them back, then 'end' will point at the last node of the layout, not at the last node of the cut widgets. Ouch!  
 
#6 matt
17:22 Dec 12, 2021
What looked so simple was quite complicated in the end. There will be a huge checkin, but for now, it's all in my branch:

https://github.com/MatthiasWM/fltk/tree/str3442

It would be great if some users could do test runs.
 
 
#7 greg.ercolano
17:37 Dec 12, 2021
Thanks for doing this!

 I did clone and checkout branch str3442 and give it a spin with a large .fl file.

I highlighted 3 items somewhere in the middle (a bunch of #defines) and hit ^C, ^V, and it worked!

So given:
A
B
C
D
E

..I highlighted B/C/D and did ^C followed by ^V and it worked as expected:

A
B \
C  |-- orig
D /
B \
C  |-- pasted copy
D /
E

..which is great!

But then I hit ^V again, and that seemed to split the paste, where the top line in the selection was copied above, and the lower lines were copied below. After several such pastes I got:

A
B \
C  |-- orig
D /
B \
C  |-- paste #1
D /
B <-- paste #2  \
B <-- paste #3   >-- unexpected
B <-- paste #4  /
C \__ paste #2  \
D /              |
C \__ paste #3   |-- unexpected
D /              |
C \__ paste #4  /
D /
E
 
 
#8 matt
09:17 Dec 13, 2021
Fixed in Git repository.  
 
#9 greg.ercolano
10:15 Dec 16, 2021
FYI I noticed these warnings this morning (linux), seems to be related to lines in this STR according to git blame:

"""
Compiling factory.cxx...
code.cxx: In function 'void write_c_indented(const char*, int, char)':
code.cxx:417:11: warning: variable 'line_len' set but not used [-Wunused-but-set-variable]
  417 |       int line_len;
      |           ^~~~~~~~
Compiling file.cxx...
factory.cxx: In function 'Fl_Type* add_new_widget_from_user(Fl_Type*, Strategy)':
factory.cxx:1056:12: warning: unused variable 'ins' [-Wunused-variable]
 1056 |   Fl_Type *ins = Fl_Type::current;
      |            ^~~
Compiling fluid.cxx...
Compiling function_panel.cxx...
"""
 
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.