Python Forum
Can WYSIWYG Die? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html)
+--- Forum: Board (https://python-forum.io/forum-26.html)
+--- Thread: Can WYSIWYG Die? (/thread-1618.html)

Pages: 1 2 3


Can WYSIWYG Die? - micseydel - Jan-17-2017

I hate WYSIWYG, because it's so misleading. Look at https://python-forum.io/Thread-Python-code-with-serial-port-and-global-undefined?pid=8325#pid8325 where the poster can't preserve indentation.

I tried to reproduce their problem and found that, spaces or tabs, pasting code into the WYSIWYG causes it to collapse. I noticed this because even though I use the less user-friendly thing at the bottom of a thread, when I hit "preview" then the post looked alright but the editor window had garbage in it. Hitting "preview" again without changing anything had the result that I expect from what the editor showed - lost indentation. So if they'd previewed and it looked good, then immediately posted, the indentation would be lost.

I realize that in theory the WYSIWYG editor could be fixed, but this is a programming forum and having button that give you the [[python]] tags should be enough. Thoughts?


RE: Can WYSIWYG Die? - metulburr - Jan-17-2017

To be honest, from day 1, i hated the WYSIWYG editor. I tried ways of removing it, but i didnt come across any successful. Sometimes though its hard to tell if it is the editor or the syntax code highlighter box doing weird stuff. 


Just so i understand correctly...do you mean this?

typing this
[attachment=109]

outputs this?
    spaces

tabs
into the editor:
    spaces

tabs

other than that i am not really sure I understand the situation?


RE: Can WYSIWYG Die? - Larz60+ - Jan-17-2017

I have become tolerant of it, however I don't dare do anything without preview.
I wouldn't be heartbroken if it was taken away.


RE: Can WYSIWYG Die? - buran - Jan-17-2017

I have no preference


RE: Can WYSIWYG Die? - wavic - Jan-17-2017

(Jan-17-2017, 11:31 AM)buran Wrote: I have no preference

Neither do I


RE: Can WYSIWYG Die? - micseydel - Jan-17-2017

@metulburr: I was seeing something worse but haven't been able to reproduce it.

@Larz60+: the thing though is that preview is necessarily in WYSIWYG mode which can ruin stuff.

So the current reproducible state of things is that the preview ruins tabs for sure, and possibly at least some of the time spaces (was only able to observe that one).


RE: Can WYSIWYG Die? - metulburr - Jan-17-2017

lwe could try to abolish the WYSIWYG editor and have the codebox the only method to reinstate whitespace. But i think that would be a process...especially since it would muck the whole forum up in while doing it. 

spaces
class Klass:
    def __init__(self):
        pass 
    
    def test(self):
        while blah:
            if blah_blah:
                if blah_blah_blah:
                    pass 
tabs
class Klass:
def __init__(self):
pass 

def test(self):
while blah:
if blah_blah:
if blah_blah_blah:
pass 
wow...i see what it does. The editor removes the tabs. Pretty much like '    '.replace('    ', '')I wonder if there is a way to replace tabs with spaces in the editor. The problem with that is we would never know when someone inputs tabs. So for example it would be harder for us to detect someone having problems mixing their tabs and spaces. 

On the other hand...why is it replacing tabs at all?


RE: Can WYSIWYG Die? - micseydel - Jan-17-2017

Another thread dealing with this - https://python-forum.io/Thread-String-index-out-of-range?pid=8400#pid8400
We can't prohibit people from using tabs, that's just not going to fly. We're going to lose a lot of people who just aren't up for that, however simple it seems to use.


RE: Can WYSIWYG Die? - metulburr - Jan-17-2017

when you say prohibit tabs...do you mean replacing tabs to spaces, or leaving it as is?

Ive tried a couple things. I assume the removal of tabs is under class_parser. There are a couple lines in there that do indeed appear to remove tabs, but they are in the default codebox code. And commenting them out do nothing. I also tried to replace tabs with html spaces, and that also appears to do nothing. 

        $message = str_replace("\t", '    ', $message);
So i am at a loss at the moment.


RE: Can WYSIWYG Die? - micseydel - Jan-17-2017

(Jan-17-2017, 11:06 PM)metulburr Wrote: when you say prohibit tabs...do you mean replacing tabs to spaces, or leaving it as is?
The feedback on the threads with this issue has been "switch to spaces." I don't want this forum to be a place where people can't post with tabs. (I use spaces personally, so it's not that kind of bias.)

If we implicitly convert tabs to spaces, that's a separate issue. It might be a good enough temporary solution but we'll have people (as others have mentioned) posting code where they're mixed and (1) we won't realize their issue and/or (2) their ugly code will work but if we copy-paste from their post it'll be incorrect indentation. We should preserve their code exactly, any changes risk communication.