1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Code Tags

Discussion in 'Site Issues & Feedback' started by jpanhalt, Dec 23, 2015.

  1. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,816
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    Hola MrAl

    In MPLAB I use Courier New but copying and pasting to editors results in font changes.

    My doubt: if I copy and paste text in fontA, when could I be sure the font is going to be maintained in the destination text?

    Is it any "general" rule for copy/paste of text (RTF? or plain txt?) regarding the original and final fonts? Is it maintained, forcefully changed to a specific different font or does it depends of the font at the destination document?
     
  2. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,049
    Likes:
    961
    Location:
    NJ

    Hi,

    It should not matter if the font is the same in both locations. I use Courier New because is displays non proportional font (all characters have the same width even the space char). I use this for typing in any editor or copy and paste.
    This is a behavior which was standard before stupid web editors came about. Most programmers want this behavior also because it is important to keep text chars aligned vertically in many cases.
    But this problem seems to ONLY be with the space chars. Doesnt bother the other chars, which is really strange.
    Thus, it needs to be fixed.
     
  3. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,051
    Likes:
    519
    Location:
    Cleveland, OH, USA
    ONLINE
    In my post #18 yesterday, I used the phrase, "hyphens, underscores, and such" and should have been more specific. "And such" of course includes spaces . The phrase I was blanking on was "ASCII art," which was very common before inclusion of graphics in text became so easy. Problems with ASCII art are not restricted to forums, such as this, but occur with e-mails, when going from Notepad to a word processor, and other cut and paste and/or print operations -- meaning that list of examples is not complete.

    John
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,049
    Likes:
    961
    Location:
    NJ

    Hi John,

    What you are saying is that there are problems everywhere so they should not be fixed anywhere. It's simpler here because it's only one character, the space, and the others work fine.

    If you think about your own post and quote:
    "Problems with ASCII "

    even you have already recognized it as a problem yourself so i dont see what you are trying to prove.

    Since it is just one character i think it would be easy to fix. And dont get me wrong, in the software i write myself i have problems like this all the time generated by my own mistakes. For example, in a text editor i wrote for programming code like for PIC, Arduino, Windows, C, C++, etc., i had a problem with tab translation where the tabs would appear as a strange looking character when pasted from another editor. The problem was simply that the editor did not know how to handle tabs although it was able to handle every other character just fine. A little fix was to convert the tab character into a number of spaces N that the user decided on in a menu. The default was 2 spaces so whenever a tab char was encountered it was removed and replaced with two spaces. Worked great after that. The choices i added later were N=2, N=4, N=6, N=8, and 2, 4 and 8 are the most common.
    So it's not really a matter of discussing the possibility of keeping the error in the program or not, it's easy enough to get rid of. Who wants software with errors in it that show up now and then :)

    Also, text based posts work better than image based posts sometimes for a couple reasons:
    1. The text can be copy and pasted into someone else's editor for editing as text.
    2. Forum crashes often lead to image loss but not loss of text.

    Note that because of #1 above the reader has the OPTION of converting into an image, while with an image it is much harder to convert back into text if text is needed.

    Text is the most universal means of communicating between people of the same language that cant actually talk to each other. Other types require special software products such as image readers, math translators, etc. Might as well make it work as well as possible.
     

    Attached Files:

    Last edited: Jan 5, 2016
  6. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,051
    Likes:
    519
    Location:
    Cleveland, OH, USA
    ONLINE
    My concern is code tags and whether for answering questions and teaching in ETO the process effected by code tags can be modified to allow some form(s) of highlighting within the tags.

    Perhaps your discussion of ASCII art should be moved to its own thread. Simply snipping and pasting an image has never failed me. You may have a solution to the problem you "discovered" that is caused only by spaces, but you have failed to present it, nor do you seem to be working toward a solution to it. I am simply not interested in discussing the effects of spaces, fonts, special characters -- in fact all ASCII characters and controls -- on the appearance of ASCII art in different settings.

    John
     
  7. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,049
    Likes:
    961
    Location:
    NJ
    Preface:
    Note that i found that the space problem is only when we use the menu "Paste" as it eliminates most of the spaces in the text being pasted, and this occurs even when we copy and paste from this very editor, not just from some external editor like Notepad. So the problem lies within the Paste event code in the software.

    Hi John,

    Hmmm, that's not a bad idea, about starting a different thread. But before i go, let me ask one small question.

    In post #2 you showed an example that had three lines with three words starting each line (like "call" the third line) and then you had text (a word) to the right of that where the first char of each word stayed lined up, so it appeared as 'columns' not just a line of text with random spacing. I also noted you used the line "Code(asm)".
    Does putting 'asm' change any character of the spaces, so that you go it to line up like that or did you take extra steps to get the second word in each of the three lines to line up too?

    Experiment:
    [code(asm)]
    word1 word2
    word3 word4
    word5 word6
    [/code]
    I guess it takes extra work, because the above originally had 6 spaces between each word in each line.
    I would think this would affect any thing that had to do with 'teaching' too becsuse it makes it harder to type out some things that you want to type out.


    Code (text):

    word1      word2
    word3      word4
    word5      word6
     



    Third try, different number of chars in first word of one line:
    Code (text):

    word1      word2
    wor3       word4
    word5      word6
     
    The above was typed by hand.


    Code (text):

    word1      word2
    wor3       word4
    word5      word6
     


    The following was copy and pasted into another editor, then copy and pasted back into this editor without any hand modification:
    Code (text):

    word1  word2
    wor3  word4
    word5  word6
     


    The following was copy and pasted, then modified by hand to add one space in second line:
    Code (text):

    word1  word2
    wor3   word4
    word5  word6
     


    So i guess this main problem is when something is copy and pasted it does not contain the same number of spaces as the original. So that might be the only issue here. If i was doing a program that had this problem, i would simply look at the code under the menu event "paste" and see why it was not pasting correctly. It seems that it is probably that it things it has to limit spaces to a minimum like it does with proportional fonts like Arial. So it just does not recognize the space char as one from the true selected font, which is Courier New.

    I also would like to see the color option working.


    One more try:
    Code (text):

    word1  word2
    wor3  word4
    word5  word6
     
    I thought maybe reselecting the font just before pasting might help, but that didnt help either.
    I'll start another thread for this (separate) issue, thanks.

     
    Last edited: Jan 6, 2016
  8. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,051
    Likes:
    519
    Location:
    Cleveland, OH, USA
    ONLINE
    dmiyares

    Puzzling...

    I have received two notices in the past hour from Dave that don't appear in this thread. The most recent was this:
    upload_2016-1-14_9-47-21.png

    I am assuming that means you are working on the matter, which is good, but somehow your test area is sending notices to members.

    Regards, John

    BTW, Really cute kids in your avatar.
     
  9. dmiyares

    dmiyares Administrator

    Joined:
    Jun 16, 2014
    Messages:
    195
    Likes:
    10
    I deleted them.. was testing out the code highlight... saw that they didn't work... said.. delete these rather than confuse people...
     
  10. dmiyares

    dmiyares Administrator

    Joined:
    Jun 16, 2014
    Messages:
    195
    Likes:
    10
    I have UPGRADED this... several versions of Xenforo have made the version installed here incompatible. Would have been nice if there was a warning about this...

    https://marketplace.digitalpoint.com/geshi-syntax-highlighter.990/item

    The plguin will highlight over 200 "languages" ... all you need to do is add the language name into the code element like [ code = arm ] . (& remove the spaces)


    4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript3, actionscript, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, c_loadrunner, clojure, c_mac, cmake, cobol, coffeescript, c, cpp, cpp-qt, csharp, css, cuesheet, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, d, ecmascript, eiffel, email, epc, e, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, java5, java, javascript, j, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml-brief, ocaml, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, perl6, perl, per, pf, php-brief, php, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, qbasic, q, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vbnet, vb, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic,




    Code (arm):

            MOV  R0, #0         ; R0 accumulates total
            MOV  R1, #10        ; R1 counts from 10 down to 1
    again   ADD  R0, R0, R1
            SUBS R1, R1, #1
            BNE  again
    halt    B    halt           ; infinite loop to stop computation
     

    Code (6502acme):

    503:18 60 N
    50A5:EA EA EA N
    82DG
     
     
    Last edited: Jan 14, 2016
  11. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,049
    Likes:
    961
    Location:
    NJ
    Hi,

    Post #29: Looks beautiful there ! That's the way code SHOULD appear :)
     
  12. dmiyares

    dmiyares Administrator

    Joined:
    Jun 16, 2014
    Messages:
    195
    Likes:
    10
    Bonus points if you know what the 6502 code does ;)
     
  13. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,051
    Likes:
    519
    Location:
    Cleveland, OH, USA
    ONLINE
    Code (mpasm):

    movlw     0x65
    movwf     hefty
    movlw     0x02
    movwf    [COLOR=#ff0000] just[/COLOR]
     
    OK, so how do you highlight a specific line or two in a post in Assembly?

    Thank you for the update, but it hasn't addressed my original question.

    John
     
    Last edited: Jan 14, 2016
  14. dmiyares

    dmiyares Administrator

    Joined:
    Jun 16, 2014
    Messages:
    195
    Likes:
    10
    crap--- i'll dig.
     

Share This Page