# Code Tags

Status
Not open for further replies.

#### atferrari

##### Well-Known Member
Hi John,

Well there's no problem with the hyphens and other chars, just with the spaces. The spaces are not right. It's like you type a Courier New space (which is a proportional font) and you get a Arial font space instead.

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?

#### MrAl

##### Well-Known Member
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?

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.

#### jpanhalt

##### Well-Known Member
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

#### MrAl

##### Well-Known Member
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

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.

"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.

#### Attachments

• EditorSnap-1b.gif
19.4 KB · Views: 128
Last edited:

#### jpanhalt

##### Well-Known Member
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

#### MrAl

##### Well-Known Member
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,

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:
word1      word2
word3      word4
word5      word6

Third try, different number of chars in first word of one line:
Code:
word1      word2
wor3       word4
word5      word6
The above was typed by hand.

Code:
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:
word1  word2
wor3  word4
word5  word6

The following was copy and pasted, then modified by hand to add one space in second line:
Code:
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:
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:

#### jpanhalt

##### Well-Known Member
dmiyares

Puzzling...

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.

#### dmiyares

I deleted them.. was testing out the code highlight... saw that they didn't work... said.. delete these rather than confuse people...

#### dmiyares

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:
        MOV  R0, #0         ; R0 accumulates total
MOV  R1, #10        ; R1 counts from 10 down to 1
SUBS R1, R1, #1
BNE  again
halt    B    halt           ; infinite loop to stop computation

Code:
503:18 60 N
50A5:EA EA EA N
82DG

Last edited:

#### MrAl

##### Well-Known Member
Hi,

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

#### dmiyares

Hi,

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

Bonus points if you know what the 6502 code does

#### jpanhalt

##### Well-Known Member
Code:
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:

#### dmiyares

crap--- i'll dig.

Status
Not open for further replies.

Replies
5
Views
1K
Replies
4
Views
1K
Replies
3
Views
1K
Replies
4
Views
2K
Replies
6
Views
1K