Author Topic: Word Wrap in QB64 IDE?  (Read 5131 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Word Wrap in QB64 IDE?
« Reply #15 on: April 19, 2021, 02:49:05 pm »
←┘
'

And don't forget block comment selected text from Edit menu but it still doesn't give us word wrap does it!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Word Wrap in QB64 IDE?
« Reply #16 on: April 19, 2021, 02:51:26 pm »
Word wrap would be, by far, the ugliest thing to bring to an IDE.
Shuwatch!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Word Wrap in QB64 IDE?
« Reply #17 on: April 19, 2021, 04:51:22 pm »
Word wrap would be, by far, the ugliest thing to bring to an IDE.

LOL can't argue with someone's opinion.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Word Wrap in QB64 IDE?
« Reply #18 on: April 19, 2021, 04:54:20 pm »
I do see the use for it and I do see the benefit it would have for someone who dislikes horizontal scrolling. I just absolutely abhor the idea.
Shuwatch!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Word Wrap in QB64 IDE?
« Reply #19 on: April 20, 2021, 12:34:38 am »
With all the under the hood work that would be needed to deal with syntax checking, code flow, indentations, ect. ect. When we already have this nice and  handy key on the keyboard to deal with it labeled ENTER why waste the time and potential can of worms trying to force the QB64 IDE to do even more. It already has too much glut clutter anyway.

You want word wrap then use notepad or a word document processor.
Granted after becoming radioactive I only have a half-life!

Offline codeguy

  • Forum Regular
  • Posts: 174
    • View Profile
Re: Word Wrap in QB64 IDE?
« Reply #20 on: April 20, 2021, 04:06:08 am »
I don't think word wrap would do the IDE justice. It's perfect. It's a simple intuitive IDE. Line continuations can be done using the underscore, I think. For wrapping printouts, that would be a project for notepad. But onscreen, I just can't see the necessity. It would be nice to be able to continue really long literals using a system like that, though.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Word Wrap in QB64 IDE?
« Reply #21 on: April 20, 2021, 07:58:18 am »
My final thought on this: If it is so desired to use word wrap then program in Microsoft Word.
Shuwatch!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Word Wrap in QB64 IDE?
« Reply #22 on: April 20, 2021, 08:55:46 am »
Instead of an all inclusive word wrap, I’d love to see a “PRINT PREVIEW” tool.  For example, let’s say I’m working in a SCREEN 0 environment.  What I’d love to do is hit CTRL-P (for preview) and then have a screen pop-up which I can click to set to a 80x25 text screen, and then type on....

Thus, if I type, “Hello my name is Steve.  I like to program in QB64, but sometimes I run into issues with formatting and output being longer than a single line.”, I can see the text on my desired output screen and adjust it so my words are spaced properly and don’t break in the middle.  Once finished, all I need to do is CTRL-V to copy the properly formatted text, close the preview, and then paste it into the IDE where I was working last.

Word wrap doesn’t seem too useful to me, but a print preview sounds like it’d be a real winner!
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Word Wrap in QB64 IDE?
« Reply #23 on: April 20, 2021, 01:26:28 pm »
Stimulating idea Steve! I have an experiment for today :)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Word Wrap in QB64 IDE?
« Reply #24 on: April 21, 2021, 10:37:13 pm »
'    Hi, my name is Steve.    This is my example.    It works just like a
' comment and is excluded from my code,    Because of the undefined $IF block.

' Instead of an all inclusive word wrap, I’d love to see a “PRINT PREVIEW” tool.
'  For example, let’s say I’m working in a SCREEN 0 environment.  What I’d love
' to do is hit CTRL-P (for preview) and then have a screen pop-up which I can
' click to set to a 80x25 text screen, and then type on....  Thus, if I type,
' “Hello my name is Steve.  I like to program in QB64, but sometimes I run into
' issues with formatting and output being longer than a single line.”, I can see
' the text on my desired output screen and adjust it so my words are spaced
' properly and don’t break in the middle.  Once finished, all I need to do is
' CTRL-V to copy the properly formatted text, close the preview, and then paste
' it into the IDE where I was working last.  Word wrap doesn’t seem too useful
' to me, but a print preview sounds like it’d be a real winner!

' I dont think word wrap would do the IDE justice. Its perfect. Its a simple
' intuitive IDE. Line continuations can be done using the underscore, I think.
' For wrapping printouts, that would be a project for notepad. But onscreen, I
' just cant see the necessity. It would be nice to be able to continue really
' long literals using a system like that, though.

' With all the under the hood work that would be needed to deal with syntax
' checking, code flow, indentations, ect. ect. When we already have this nice
' and  handy key on the keyboard to deal with it labeled ENTER why waste the
' time and potential can of worms trying to force the QB64 IDE to do even more.
' It already has too much glut clutter anyway.  You want word wrap then use
' notepad or a word document processor.

' Quote If theres one thing I would love to see, it would be a way to collapse
' SUB/FUNCTION blocks that one is finished working with. I presume that would be
' challenging to implement or it would have been done by now.  Well I have a
' suggestion for that, build a custom library for the app and who knows if it
' might not be helpful for others or serve as a starter with code already
' tested? When you have one worked out move it into library.

Above is some example text I pulled out of this thread and ran through following code Not in IDE but a Stand Alone .exe that takes contents of clipboard and rearranges them as word wrapped comments with a width limit of 80 including a single quote and space.

Code: QB64: [Select]
  1. _Title "Wrap up comments" 'b+ 2021-04-21
  2. 'Alter clipboard contents so that you can take some text while editing in IDE and paste it back altered and word wrapped to a given width.
  3. 'Try the above line with this one.
  4. 'And let's add some more stuff here.
  5. ' Ha, and even more stuff here.
  6. 'Hey, this is fun, let's keep going.
  7. 'And going, and going... like the Energizer bunny ;-))
  8. ClipCommentsWrap 80 ' and here is clipboard paste in paragraph below
  9. ' Alter clipboard contents so that you can take some text while editing in IDE
  10. ' and paste it back altered and word wrapped to a given width. Try the above
  11. ' line with this one. And lets add some more stuff here. Ha, and even more stuff
  12. ' here. Hey, this is fun, lets keep going. And going, and going... like the
  13. ' Energizer bunny ;-))
  14.  
  15. ' unfortunately, in order for the program to run you have to comment the lines.
  16. Sub ClipCommentsWrap (maxWidth As Long)
  17.     s$ = _Clipboard$
  18.     s$ = StrReplace$(s$, Chr$(13) + Chr$(10), " ")
  19.     s$ = StrReplace$(s$, Chr$(13), " ")
  20.     s$ = StrReplace$(s$, Chr$(10), " ")
  21.     s$ = StrReplace$(s$, "' ", "")
  22.     s$ = StrReplace$(s$, "'", "")
  23.     b$ = "' " + wrap$(s$, maxWidth - 2, t$)
  24.     While Len(t$)
  25.         s$ = t$
  26.         b$ = b$ + Chr$(10) + "' " + wrap$(s$, maxWidth - 2, t$)
  27.     Wend
  28.     _Clipboard$ = b$
  29.  
  30. 'This function returns the first segment of string less than or equal to maxLen AND
  31. 'the remainder of the string (if any) is returned in tail$ to be used by wrap$ again
  32. Function wrap$ (S$, MaxLen, Tail$)
  33.     ReDim As Long p
  34.     If Len(S$) > MaxLen Then
  35.         p = MaxLen + 1
  36.         While Mid$(S$, p, 1) <> " " And p > 1
  37.             p = p - 1
  38.         Wend
  39.         If p = 1 Then
  40.             wrap$ = Mid$(S$, 1, MaxLen): Tail$ = Mid$(S$, MaxLen + 1)
  41.         Else
  42.             wrap$ = Mid$(S$, 1, p - 1): Tail$ = Mid$(S$, p + 1)
  43.         End If
  44.     Else
  45.         wrap$ = S$: Tail$ = ""
  46.     End If
  47. Function StrReplace$ (s$, replace$, new$) 'case sensitive  2020-07-28 version    added to oh 3/16 for inpbs
  48.     Dim p As Long, sCopy$, LR As Long, lNew As Long
  49.     If Len(s$) = 0 Or Len(replace$) = 0 Then
  50.         StrReplace$ = s$: Exit Function
  51.     Else
  52.         LR = Len(replace$): lNew = Len(new$)
  53.     End If
  54.  
  55.     sCopy$ = s$ ' otherwise s$ would get changed
  56.     p = InStr(sCopy$, replace$)
  57.     While p
  58.         sCopy$ = Mid$(sCopy$, 1, p - 1) + new$ + Mid$(sCopy$, p + LR)
  59.         p = InStr(p + lNew, sCopy$, replace$)
  60.     Wend
  61.     StrReplace$ = sCopy$

Merely click the exe maybe sitting on your desktop and automatically the contents of the clipboard is wrapped to 80 char widths with comment space starting each line.


« Last Edit: April 21, 2021, 10:41:54 pm by bplus »

Offline zaadstra

  • Newbie
  • Posts: 78
    • View Profile
Re: Word Wrap in QB64 IDE?
« Reply #25 on: April 22, 2021, 02:51:22 pm »
Amazing, I've learned a new $IF command :-)