Zeus IDE Forum Index Zeus IDE
Use this forum to ask for help, submit a bug report or make a suggestion.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

bug with copying text from start of folded text

 
Post new topic   Reply to topic    Zeus IDE Forum Index -> Reporting a Bug
View previous topic :: View next topic  
Author Message
gwgs



Joined: 21 Nov 2006
Posts: 78

PostPosted: Sun Dec 05, 2010 9:42 pm    Post subject: bug with copying text from start of folded text Reply with quote

This occurs in Zeus 3.97c. I'm using windows 7

Sample Text:
Code:
function abc (def, ghi):
    1234567890
    1234567890
    1234567890
    1234567890
    1234567890
    1234567890
    1234567890


When folded:
Code:
function abc (def,ghi): ...


select abc and copy to clipboard, when you paste you get a column of text from the folded block, eg
Code:
abc
678
678
678
678
678
678
678


Not useful when all you want is the function name in this case.

Please fix.

Thanks in advance

Grant Smith
Back to top
View user's profile Send private message Yahoo Messenger
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2104

PostPosted: Sun Dec 05, 2010 11:12 pm    Post subject: Reply with quote

Hi Grant,

I would argue that Zeus has worked exactly as designed Wink

You have folded away 8 lines into 1 and then you copied 3 characters from the folded line.

The result of the copy is the 3 characters in selected range of all 8 lines get copied to the clipboard.

This is analogous to what would have happen if you had selected the entire line, in which case all 8 lines get copied to the clipboard.

To me both these behaviorsí are consisted and to be expected for folded lines Wink

Cheers Jussi
Back to top
View user's profile Send private message Send e-mail
gwgs



Joined: 21 Nov 2006
Posts: 78

PostPosted: Sun Dec 05, 2010 11:48 pm    Post subject: Reply with quote

I can see your point of view. But I see it as an unexpected result.
When I try the same thing in the PythonWin editor all that is copied and pasted is the function name abc using the same example above. This is the result I expected. I have all the functions folded for readability, when i select a function name and copy it, I don't expect or want a column of text the width of the function name. Makes for unexpected results when you paste (what you expect) into a cmdline and get a potentially huge block of code pasted instead.

The workaround of opening the folded code, finding the start of the block and then selecting the word/function name you originally selected seems very cumbersome and slow.


Thanks

Grant Smith
Back to top
View user's profile Send private message Yahoo Messenger
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2104

PostPosted: Mon Dec 06, 2010 1:56 am    Post subject: Reply with quote

Quote:
The workaround of opening the folded code, finding the start of the block and then selecting the word/function name you originally selected seems very cumbersome and slow.

But if you actually wanted this current behaviour then the alternative would likewise be cumbersome and slow since you would have to manually column mark all the lines of the folded area.

But in any case donít forget Zeus is scriptable, so by righting a simple script it should be easy enough to make Zeus behave which ever way you like.

See below my first rough attempt at a Python script to do exactly what you describe. As a first attempt it is a bit rough around the edges and still needs to be debugged but it does indicate that a script solution is possible Wink

Cheers Jussi

Code:
import zeus

def key_macro():
    FOLD_NONE    = 0

    # check if the current line is a fold point or if we have no markings
    if zeus.get_line_folding() == FOLD_NONE or zeus.is_marked() == 0:
        # leave it up to default behaviour
        zeus.MarkCopyEx()
    else:
        # get the current mark range
        top    = zeus.get_marked_top()
        bottom = zeus.get_marked_bottom()

        # see if this is the 'single line' marked case
        if bottom == top:
            # copy the lines to the clipboard
            zeus.MarkCopyEx()

            # read back the lines from the clipboard
            text = zeus.get_clipboard_text()

            # break clipboard data into lines and throw away the line feeds
            keepends = 0
            results = text.splitlines(keepends)

            # put the first line back into the clipboard
            zeus.set_clipboard_text(results[0])
        else:
            # leave it up to default behaviour
            zeus.MarkCopyEx()

key_macro() # run the macro
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Zeus IDE Forum Index -> Reporting a Bug All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group