FlexGUI and PNut look and feel



  • rosco_pcrosco_pc Posts: 371
    edited 2020-03-20 - 10:58:25
    cgracey wrote: »
    Uh, can we discuss the merits of coding in proportional fonts, instead of monospaced fonts? That should be even more interesting than tabs. I mean, there are a lot more proportional fonts to choose from. And does anyone know if 'Courier New' is really better than 'Courier'?

    but but but there are soo many nice monospace fonts to choose like the parallax font or some very recent entries like: https://sourcefoundry.org/hack/

    but if you insists, then let's mix it with the tab discussion, for which I'm on @Roy Eltham's side. Absolutley hate tabs, and I work with colleagues who absolutely love tabs ;(
  • That "hack" font is nice.
  • Hack does look nice... Bold and italic are very nice... Might have to see how that looks as 16x32 monochrome...
  • Roy Eltham wrote: »
    I felt you needed that "lesson", because you clearly are missing the issue (I feel intentionally now).
    1. In code (which is the context here) you are not really working with fields. You have variable length strings of code, so you either need a very large tab size or you always fail (your case 1).
    2. I don't mix tabs and spaces, I use only spaces.

    I've had to deal with cleaning up hundreds of thousands of lines of code with tabs that assumed the wrong size in my lifetime of coding. I and everyone I know coding for a living uses spaces instead of tabs for the very reasons I explained in my "lesson" that you dismiss.

    re: "tool counting spaces"
    The spin compiler doesn't care about the size of the indent when making a new scope (which is what the indenting does in spin), just that it's more than the previous scope indent amount.
    You can have your first indent be 3 spaces, then your second be at 14, and your third at 20. It doesn't care at all about the tab stops or any multiple of spaces like you described, there is no rounding up or down.

    Ok, and if your fourth indent is at 19 where does it fall? Is it the same scope as 14 or 20, or some new scope?

    Failing to agree with you is not the same as intentionally missing the issue.
    Functionally the fields are there, not at a fixed position, but there all the same. This seems to be one of the reasons that Chip likes to set an upper cap on instruction names, because of the 8 space tab stop he has in mind.

    I've not counted how many lines of text - not just code - that I've had to repair because people chose to use multiple spaces to line things up instead of tabs.
    When one line includes text that passes the current point of alignment you have to go and correct all of the lines in the block instead of simply moving a tab stop.

    As this thread began with a request that two tools be brought into line with the behaviour of one existing tool, all discussion of using different editors isn't strictly in scope. I can see your reasoning in general terms, but I still think it comes from a perspective of working with limited (or flawed) tools in the first place.
    A decent text editor should allow you to set custom tab stops and use those for effortless alignment of the text.

    Your preference for multiple spaces is not something I will ever share, but I understand better now. Thanks.
  • Indentation is critical for spin so worth careful consideration ...
    I wonder what python editors do...
  • rosco_pcrosco_pc Posts: 371
    edited 2020-03-20 - 15:36:53
    Rayman wrote: »
    I wonder what python editors do...

    from PEP 8 Style guide for Python coding:
    Use 4 spaces per indentation level.

    Tabs or Spaces?
    Spaces are the preferred indentation method.
    Tabs should be used solely to remain consistent with code that is already indented with tabs.

    Python 3 disallows mixing the use of tabs and spaces for indentation.

    Python 2 code indented with a mixture of tabs and spaces should be converted to using spaces exclusively.
    When invoking the Python 2 command line interpreter with the -t option, it issues warnings about code that illegally mixes tabs and spaces. When using -tt these warnings become errors. These options are highly recommended!

    Compare that to the linux style guide, where tabs (with 8 character width) are the preferred indent or the Openbsd style where they advocate a mix of tabs and spaces.

    And we've come full circle to any indent discussion everywhere.

    The important thing is to just be consistent in your style and although I like and use the python style indentation guide for most of my coding (in whatever language I use), I will adhere to whatever style guide is imposed on any project I'm working on. And strangely enough we do not have 1 style guideline for the whole company (>100K employees) where I work :neutral:. I've been in several committees trying to impose one, but new influx of people always make another committee needed every x years :wink:

  • AJL wrote: »
    Probably a waster of metaphoric breath to try to make my case, but here goes nothing.
    Let's not pretend that the tab key was invented by computer designers. It existed on typewriter keyboards for the very purpose of aligning text between lines and it was set by the user to the size that suited the purpose of the document they were producing.
    Thanks for the unnecessary lesson on how tabs work. It only gets messed up in two cases:
    1. You select a tab stop value that is less than the largest item in a field;
    2. You intermix spaces and tabs; this is a bad idea but you might not notice, others are the ones who suffer the consequences when they open your file in an editor with a different tab stop setting.

    Many editors let you select custom tab stop sets. That is the better option IMHO.

    Demonising the use of tabs seems like shortsightedness to me.

    I don't have an axe to grind in this tabs vs spaces controversy. There are advantages and disadvantages to both. As long as my text ends up in the right place I don't care whether tabs or spaces are used. Neither choice should be demonized.

    Not sure when tabs were first used in typewriters and card punches but it may be as early as the late 1800's. Hollerith's first tabulators were used for the U.S. 1890 Census.

  • The problem I have with mixed tabs and spaces is when more than one person edits a file and they use different tab settings. Usually, one would expect an editor to follow the convention used by the original author of the file but sometimes it isn't obvious what settings were used. If it's a large file and you only look at the part you need to change and that part is entirely indented with spaces then you could end up making a wrong assumption. This has happened more often than I can count. I've had to take over the support of a file where there is no tab setting that will cause the entire file to be indented correctly because some parts assumed one size tab and other assumed another. Best to stick with either all tabs or all spaces for indentation.
  • Chip,
    This is the coder friendly font I have been using for several months now, it's pretty great and free: https://www.jetbrains.com/lp/mono/
  • RaymanRayman Posts: 10,485
    edited 2020-03-20 - 17:47:52
    Jetbrains and Hack look pretty good with antialiasing.
    But, for display with P2 you may want one that looks good non-antialiased…
    Terminus looks like it could be a replacement/addition to the P1 Rom Font...
    585 x 481 - 35K
  • I know Spin people hate braces, but one advantage is that with braces there is no ambiguity about where logical blocks begin and end. I have worked with C code that contained various mixtures of indenting with tabs, spaces and several indenting formats. In cases like that I would run the indent utility on the source file to beautify it. This would make it much easier to understand the code. After making fixes in the beautified code, I would then incorporate the changes back into the original source file so that the source control system wouldn't report a large number of changes.
  • I wish there was run-length encoding in all text files, so that horizontal white space greater than one space would become a ctrl chr plus a count byte:

    20 20 becomes 0B 21
    20 20 20 becomes 0B 22
    20 20 20 20 becomes 0B 23

    To repeat chr "A":

    41 41
    41 41 41 becomes 0C 22 41
    41 41 41 41 becomes 0C 23 41
    41 41 41 41 41 becomes 0C 24 41

    That way, we would have granular indention, plus compaction, without exceeding ASCII sensibilities.
  • I've been sort of wondering how well some (anti-aliased?) text fonts will perform with HyperRAM external memory frame buffers on the P2 outputting in a bitmapped graphics mode. The text rendering process will slow things down a little but with the graphics based copy I'm putting into the driver you can potentially send high level requests to transfer individual characters or rows of them from one memory area to another and also have it account for scan line pitch, which helps free up the client COG making the request from repeated requests. Obviously transferring entire rows of characters will be better than doing individual characters one at a time given the overhead of switching between scan lines and starting new memory transfer bursts so it would be good to keep an intermediate text row render buffer in Hub RAM before its final graphics transfer into the frame buffer.

    This type of approach should help provide the ability for the P2 to use some very nice modern looking fonts (as linked to in the top post) for text applications displayed in very high resolution graphics modes and still perform at a sufficient speed for interactive text editing etc. If only one row of text data on the screen is being modified as you type this may appear fast enough to a user. A full screen redraw could suffer some slow down, but hardware frame buffer based scrolling/wraparound in any video driver that supports it (mine does) can also be used to hide some update delay if the text window scrolls vertically and possibly horizontally to some limit.
  • ManAtWorkManAtWork Posts: 568
    edited 2020-03-21 - 16:17:53
    Another important thing, IMHO:
    • Save File (and Compile which also does a Save in FlexGUI) should NOT clear the UNDO buffer. It is very annoying if you delete some part of the code just to try something out and after compiling you find out that it's not possible to undo the delete. Save should be "safe" and not mean "forget everything I've done before".
  • ManAtWork wrote: »
    Another important thing, IMHO:
    • Save File (and Compile which also does a Save in FlexGUI) should NOT clear the UNDO buffer. It is very annoying if you delete some part of the code just to try something out and after compiling you find out that it's not possible to undo the delete. Save should be "safe" and not mean "forget everything I've done before".

    Cut-paste that part of the code to another scratch-pad text file in another tab or corner of your screen.

    Or block comment out that section.

    Or use Save As and increment a number or letter after the filename so you can go backwards.

    Or append _temp after the filename and start experimenting.

    I'd hate to hear your scream when you deleted a huge portion of a source code file, clicked save, compiled, and had the computer or editor crash, or power got lost, or any number of things that could clear the undo buffer.
  • ManAtWorkManAtWork Posts: 568
    edited 2020-03-21 - 18:19:09
    I know, there are workarounds. And I use GIT and do a commit every time I finish a major step so it's very unlikely that I loose larger portions of code.

    But often I make some small changes to find the optimum value for a parameter. When I went too far I'd like to go back to the last state that worked. And I really don't want to rename the file each time.

    Being able to do multiple edit-compile-run cycles within 10 seconds is a big advantage of the propeller tool and I don't want to loose that by being forced to make backups all the time.
  • I made SpinEdit also so that compile automatically saves. I think it's better that way too... It's what I'm used to from Visual Studio...
  • Rayman,
    But does undo work across saves? In Visual Studio it does.
  • evanhevanh Posts: 9,041
    edited 2020-03-21 - 21:18:30
    I like a shell/console for both compiler and execution history. So I often have multiple editor windows and multiple shells too at times.

    EDIT: The 4k desktop helps. :D ... just need a bigger 43" monitor now.

  • ManAtWork wrote: »
    • A "recent files" menu would be nice, orr an option to load the last top level file at startup. I often switch between different projects so each time I have to browse through the directory tree.
    • A navigation list of the file hierarchy (dependency tree with objects and sub-objects) of the current project would also be handy. It allows to quickly open the files you need to edit once the top level file is compiled
    • Syntax highlightning helps to spot typos and syntax errors quickly. You know it... You edit a part of code and wonder why nothing happens. Then you find out that the whole part was commented out. With syntax highlighting you'd notice this immediately. There are some open source editors with configurable syntax parsers. If this is too much work simple scanning for reserved words, operators and comments would be sufficient for now.
    • separate background colors for CON, PUB, DAT ... sections. This is unique to the Propeller Tool. It makes the editor window look a bit like a candy shop but I like it. You can scroll through large files and find the section you look for faster.

    Thanks for the suggestions. FlexGUI 4.1.4 will have a "save session" option that will have it load all your previously open files at startup. A "recent files" menu option should be pretty easy to add (Tcl is very flexible that way) but I just don't have time to work on it right now. The other ideas sound good, but probably more work. @Rayman has an editor that looks a lot like the Propeller Tool and which uses fastspin as its back end. It's worth taking a look at that.

  • Roy Eltham wrote: »
    This is the coder friendly font I have been using for several months now, it's pretty great and free: https://www.jetbrains.com/lp/mono/

    I love this font too.
  • A flexgui feature request...

    Currently... When the Find text dialog appears, after a previous attempt to find some other text, the cursor is placed in front of the previous text. The user then has to move the cursor to the far end of that text in order to delete it and type in new search text. This forces the user to use a mouse, trackpad or touch of the screen to place the cursor to the end of the field.

    It would be better to have the cursor placed at the end of any previous search text to allow the user to quickly delete and replace that text! There would be no need to remove the user’s hand from the keyboard to move the cursor. Saves a step in the “find” process!

Sign In or Register to comment.