It is currently Thu Jan 28, 2021 3:54 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Sun Sep 30, 2012 4:06 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2999
Location: Planet Earth
Thanks, works fine. You can set indent level of wrapped lines to match indentation level of original line, plus one more level of indentation if you want.
Code:
Scintilla = Val( GetEnvironmentVariable("PB_TOOL_Scintilla") )

If Scintilla
    SendMessageTimeout_(Scintilla,#SCI_GETWRAPMODE,0,0,#SMTO_ABORTIFHUNG,2000,@result)
    If result = 0
        wrapmode = 1 ; 1 = wrap at word boundary
                     ; 2 = wrap at character boundary (for asian languages without spaces)
    Else
        wrapmode = 0
    EndIf

    ; by DoubleDutch, add visual marker and indent wrapped line
    ; http://www.purebasic.fr/english/viewtopic.php?f=18&t=30385
    ; http://forums.purebasic.com/german/viewtopic.php?f=16&t=25933&start=28
    SendMessageTimeout_(Scintilla, #SCI_SETWRAPVISUALFLAGS, #SC_WRAPVISUALFLAG_START, 0, #SMTO_ABORTIFHUNG,2000,@result)
    SendMessageTimeout_(Scintilla, #SCI_SETWRAPSTARTINDENT, 16, 0, #SMTO_ABORTIFHUNG,2000,@result)                    ; <-- indent amount
    SendMessageTimeout_(Scintilla, #SCI_SETWHITESPACEFORE, #True, RGB($70, $50, $d0), #SMTO_ABORTIFHUNG,2000,@result) ; <-- colour of marker

    #SCI_SETWRAPINDENTMODE = 2472
    #SC_WRAPINDENT_FIXED  = 0 ; Wrapped sublines aligned To left of window plus amount set by SCI_SETWRAPSTARTINDENT
    #SC_WRAPINDENT_SAME   = 1 ; Wrapped sublines are aligned To first subline indent
    #SC_WRAPINDENT_INDENT = 2 ; Wrapped sublines are aligned To first subline indent plus one more level of indentation
    SendMessageTimeout_(Scintilla,#SCI_SETWRAPINDENTMODE, 2, 0, #SMTO_ABORTIFHUNG,2000,@result)                       ; <-- indent mode

    #SC_WRAPVISUALFLAGLOC_DEFAULT       = 0 ; Visual flags drawn near border
    #SC_WRAPVISUALFLAGLOC_END_BY_TEXT   = 1 ; Visual flag at End of subline drawn near text
    #SC_WRAPVISUALFLAGLOC_START_BY_TEXT = 2 ; Visual flag at beginning of subline drawn near text
    SendMessageTimeout_(Scintilla,#SCI_SETWRAPVISUALFLAGSLOCATION, 2, 0, #SMTO_ABORTIFHUNG,2000,@result)              ; <-- marker location

    SendMessageTimeout_(Scintilla,#SCI_SETWRAPMODE,wrapmode,0,#SMTO_ABORTIFHUNG,2000,@result)
EndIf


Top
 Profile  
Reply with quote  
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Sun Sep 30, 2012 7:52 pm 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1981
Location: Germany
Thank you Danilo, works great!

Besides your Smart Highlighting, this is now my second must-have IDE tool... 8)

_________________
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Mon Oct 01, 2012 2:12 pm 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1981
Location: Germany
c4s wrote:
works great!
Oh sorry, I just noticed that it doesn't work great at all. When enabled as an IDE tool (using "start after source code loaded", with PB5.0b3 on WinXP 32bit) strange things happen:
- Pressing Enter for a new line will create 2 new lines.
- Parts of my source code (maybe every 2kb or so) were replaced with random PureBasic keywords such as FileSize, If, AllocateMemory etc. Unfortunately I'm currently not able to reproduce this behavior.
- Sometimes the special wrap indication character doesn't get colored (stays gray instead of purple).

Any ideas how this can be fixed?

_________________
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Mon Oct 01, 2012 3:31 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Aug 07, 2003 7:01 pm
Posts: 3164
Location: United Kingdom
The calls to enable the line wrap shouldn't do that. It must be something else?

_________________
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system


Top
 Profile  
Reply with quote  
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Mon Oct 01, 2012 7:01 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2999
Location: Planet Earth
c4s wrote:
Any ideas how this can be fixed?

Try new Scintilla.dll? Maybe another problem with the Beta? Disable all tools for a while?


Top
 Profile  
Reply with quote  
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Mon Oct 01, 2012 8:45 pm 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1981
Location: Germany
Hm, I have no other tool installed (except the highlighter which is only triggered via a key shortcut) and Scintilla 3.1.0 should already come with PureBasic 5.0 (see changelog)...

The problem with the doubled new line and randomly inserted keywords is really strange. Maybe some memory error?!

_________________
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Mon Oct 01, 2012 8:53 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5756
Location: Berlin - Germany
c4s wrote:
and Scintilla 3.1.0 should already come with PureBasic 5.0 (see changelog)...

should, but is it? I think not :mrgreen:

_________________
PureBasic 5.71 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 19.3 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Mon Oct 01, 2012 10:34 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3383
Location: Boston, MA
Yeah, I had to paste in the latest compiled scintilla dll according to this...
http://www.purebasic.fr/english/viewtopic.php?p=391251#p391251

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Tue Oct 02, 2012 11:48 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2999
Location: Planet Earth
freak (03.01.08 [18:11]) wrote:
I can add the option, its no problem.

Thank you freak, would be nice! Maybe for PB 5.00 Final?

What about block insert? Block selection works with Shift+Alt+CursorKeys or Alt+MouseSelection - i can select a block and delete it by pressing backspace.
After deleting the block, the block cursors blink, but Strg/Ctrl+V does not insert text at all block lines... only at the first line of the block.
The same text should be inserted at all block lines. It is used to replace a block selection with other text. Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Sun Aug 30, 2015 10:39 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Feb 18, 2010 11:10 pm
Posts: 192
Quote:
WARNING: This is an experimental editor patch, it may have unpredictable results (you may lose work) !!!

I think, you should remove this warning, no unpredictable results were reported during 7 years :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Automatic splitting code across lines...
PostPosted: Wed Sep 02, 2015 11:18 am 
Offline
Addict
Addict
User avatar

Joined: Thu Aug 07, 2003 7:01 pm
Posts: 3164
Location: United Kingdom
:)

I thought they were going to build it in...

_________________
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye